Loop in sap automation

how to set the loop in sap automation. Suppose if there are 21 codes , each code should be double click and download the data how to set the loop for that

Certainly! Here are the simple steps to create a loop in UiPath to double-click on codes and download data:

  1. Prepare Data: Store your 21 codes in a list or array variable in UiPath.
  2. Use For Each Activity: Drag and drop a “For Each” activity onto the UiPath canvas.
  3. Configure For Each Activity: Set the “TypeArgument” property of the “For Each” activity to match the data type of your list or array containing the codes.
  4. Perform Actions in the Loop: Inside the loop:
  • Use activities to interact with SAP, such as “Click Text” or “Double Click,” to access the code.
  • Perform necessary actions like navigating to the code and downloading data.
  1. Dynamic Input Handling: Ensure your automation handles dynamic input by using variables to input code values into SAP.
  2. Exception Handling: Implement proper exception handling to manage unexpected errors.

in that 21 GL s
I should go to every GL individually and double click that gl and then download the data can I put the loop for it


  1. Use a “For Each Row in Data Table” activity to loop through each row in the DataTable or “For Each” activity for an array.
  2. Inside the loop, use activities like “Type Into” or “Click” to navigate to the SAP window and enter the current code.
  3. Use a “Double Click” activity to double-click on the entered code.
  4. use click or other activities to download the data.
  5. Repeat the loop for the next code.

every time the item change
like wise 21 items should be double clicked

Hi @anjani_priya,

You can use the following workflow and add your SAP Screen and change in selector too for ExtractLineItemsDT, Download and Back Button.

Hope it will work.

SAPLoop.zip (118.3 KB)

can you explain the code


Application Scope Implementation:

Utilize the current screen mapping to facilitate item iteration.

Table Data Extraction:

Implement the ‘Extract Table Data’ activity to retrieve items in a tabular format, ensuring dynamic code for seamless iteration through each item (Basically used to get number / count of items).

Click Item Activity:

Implement this action to select the current item. Ensure the flexibility to handle varying index starting points (0 or 1) by employing an index variable. Utilize this variable in the ‘For Each’ activity and the ‘Click Item’ action for dynamic functionality.

Click Download Action:

Use this action to initiate the download process for the selected item, adjusting the selector as required.

Click F3 for Navigation:

Execute the ‘Click F3 (Back)’ action to navigate back to the previous screen for selecting the subsequent items.

I have used extract table data activity but its extracting only the visible sheet data

Hi, you have to fine tune the ExtractTableData activity to get data from all the hidden pages.
Please follow the below video to extract all hidden pages.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.