Tuesday, August 4, 2020

UiPath loop Excel and key in SAP

A lot of SAP documents are posted as Header and Line (e.g. VA01 for Sales Order, ME21N for Purchase Order). Below is a generic template to load data from Excel to SAP documents. 

Preparation:
(A) Excel file with 1 worksheet as Header and 1 worksheet as Line
    (a) For "Header" worksheet: The first column "No" is important to link to the "Line" worksheet.
    (b) For "Line" worksheet. 



(B) Declare variable in UiPath

(C) Sequence
    1: start by "Read Range" to read Header and Line workehet. Then "Call Transaction" VA01. Store the header worksheet into dtHeader and line worksheet into dtLine. 

(2) Loop through the Header for variable "RowHeader". The "RowCounter" is very important to identify the row number in Line Grid in SAP program like VA01. Use the "Filter Wizard" to filter the dtLine datatable to the current dtHeader "No"


Filter Wizard: Output to another datatable dtLine_Filtered


(3) Loop through the dtLine_Filtered datatable, then perform whatever "type in" activity. Finally, remember to increase the RowCounter. 


Next time will have a guide on using this template to fill up ME21N (Purchase Order)


No comments:

Post a Comment