Skip to Content

Search for values from excel in SAP table

Feb 12 at 04:48 PM


avatar image

Currently I'm creating a sap script that will automatically comment in SAP when values is found.

Basically, I have an excel file which contains list of items.

In column AK (Assignment), column V (Document Number) and column AM (Quantity), these are the columns that I need to search for in SAP Table.

Here is the excel:

SAP table:

So I want to search the table based on the column AK, V, and AM then it will double click the line item and edit the text.

As this is my first time to deal with SAP scripting I'm not sure on how to proceed.

This is my code so far:
'***********Initiate Tcode to access*****************
session.FindById("wnd[0]/tbar[0]/okcd").Text = "fbl3n"
session.FindById("wnd[0]").SendVKey 0

'***********End Initiate Tcode to access*****************

'*******Choose Layout***************
session.FindById("wnd[0]/usr/ctxtPA_VARI").Text = RangeLayout.Value
session.FindById("wnd[0]/usr/ctxtPA_VARI").CaretPosition = 11
'*******End Choose Layout************

'*****GL Account*******************


Application.CutCopyMode = False

session.FindById("wnd[0]/usr/ctxtSD_BUKRS-LOW").Text = RangeCompanyCode.Value

'**********End GL Account************

'table name RFPOSXEXT
'FI Doc Column 22
'assignment Column 37
'Quantity Column 39

excel.jpg (199.3 kB)
sap-table.jpg (272.7 kB)
10 |10000 characters needed characters left characters exceeded

Hello Repsev,

welcome in the SAP Community.

In my opinion is this a very complex problem, considering your first contact with SAP GUI Scripting.

My suggestion: You should read the whole table in an array - you can find an example here, but instead as CSV file store the content in an array. So you can locate the line by comparing the cells. Then you have the number of the line and you can trigger the event you need.

Best regards

* Please Login or Register to Answer, Follow or Comment.

0 Answers