Excel to sap data export isuee


I’m tasked with automating data transfer from an Excel spreadsheet to SAP, where I need to create A/R invoices. The Excel file has entries for 2 customers. The first customer has 4 items, while the second has 2 items.

My bot, made with UiPath, uses two loops to add items to invoices in SAP. But it’s not working right. Instead of giving each customer their invoice with the right items, the bot puts all 6 items under just the first customer.

Please check all ss and let me know the sollutions


Hi @badal_patel

As you are storing the values in datatable. Did you put any condition to sort the values according to the customer no? And then input the values in sap according to customer no?

Can you share your xaml file along with the Excel.?



You need to first get unique invoice number and then use the loop

So your folow shpuld be like this

  1. Read csv to datatablr dt
    2 assign activity with uniqurdt = dt.DefaultView.ToTable(True,"Unique InvoiceColumnName")
  2. Now use for loop with uniquedt
  3. Inside the for loop use filter datatable with input as dt and output as filtereddt and filter same unique invoice column with currentrow(0).ToString
  4. Now in filtered dt for eqch iteration you will have only one set of unique invoice data which can be used using for each again on filtereddt and perform steps on sap

So the outer loop repeats all steps on sap for each invoice and inner loop will add only related invoice items in sap

Hope this helps