Nested Loop DT1 AND DT2

I am about 6 to 7m months in UiPath, and likde the tool very much for automation.
I am working on SAP automation where i need to push data from Excel to SAP.
Due to scenarios in SAP process, I am forced to use the 2 loops for Each data row.

In the first loop, the header data is updated.

In the second loop, it goes to multiple line updation in SAP.

After looping multiple rows, the process ends in the second loop and it breaks.

Instead of going actually to current row of Excel of the first Loop, it goes to fist row of excel in the first loop

For e.g First Loop
row 1 data1 header data updated in SAP
Seond Loop
row1 data1
row2 data2
Validation Process Ends and exists from Second Loop
break
End of Second loop.
after the Break process should goto Row3, but in my case it goes to Row1

Any Suggestion is desperately sort for.

Please share your workflow to understand the scenario.

If this is nested “for each row of datatable” loops then the second for each row will of course always start with the 1st row for every row of the first datatable. You need to provide more context why you would like the 2nd datatable to start in other row when looping on next row of first datatable.

@Syed_Taqi,

Welcome to the UiPath Forum!

As per your details I think you have GR/IR Posting kind of use case in hand.

I would strongly recommend having header data into a Dictionary datatype variable as you will require that data only once for that particular posting.

So instead of looping through each dictionary key develop a sequence which will have type into/click/ Select Item activities to enter all header data.

For line items you should use DataTable as currently using and loop through all the row.

This should resolve your problem.

Thanks,
Ashok :slight_smile:

I m using 2 datatable as the data is to keyed into of different multiple screens of SAP. The first Screen allows me to key only the header row. Subsequent screens requires some other data to be updated. when the first row data is updated in SAP, the second row should start from the 2nd screen only which is the second loop as i get the selector error UI Element not found for the first screen. Hence i have use second loop.

Yes I m clearing customer account in SAP . You got it right

Hope my answer was able help you. Please Mark my answer as solution so it will be helpful to other community members.

Thanks,
Ashok :slightly_smiling_face:

It has not yet resolved