Home > OS >  How to get texts from screen displaying an "ABAP List"
How to get texts from screen displaying an "ABAP List"

Time:01-30

I am able to enter to the operation in SAP GUI via VBA but I am unable to find how to select or copy the value of these fields.

While recording the script via SAP GUI, copying the fields into the clipboard won't appear in the script as an action.

Any help or reference is highly appreciated.

Please find code and screenshot below (screen of type "ABAP List").

Sub XXXX()
Call SAPConnections
Session.FindById("wnd[0]/tbar[0]/okcd").Text = "Operation"
Session.FindById("wnd[0]").SendVKey 0
Session.FindById("wnd[0]/usr/ctxtP_MATRL").Text = "PartNumber"
Session.FindById("wnd[0]").SendVKey 8
Session.FindById("wnd[0]/tbar[1]/btn[1]").Press

Screenshot

CodePudding user response:

The screen you are showing is named an "ABAP List".

It contains labels and text fields, they belong to the property Children of the GuiUserArea object, and their IDs are made of prefix lbl or txt followed by the column and row numbers. The respective SAP GUI Scripting objects are GuiLabel and GuiTextField, for example:

  • label at column 0 (first column) row 12 (object GuiLabel):
    /app/con[0]/ses[0]/wnd[0]/usr/lbl[0,12]
    
  • text field at column 22 row 12 (object GuiTextField):
    /app/con[0]/ses[0]/wnd[0]/usr/txt[22,12]
    
  • checkbox at column 0 row 0 (first row) (object GuiCheckBox):
    /app/con[0]/ses[0]/wnd[0]/usr/chk[0,0]`
    

If you want to know all the fields which are in the ABAP list, you must loop at the property Children of the GuiUserArea object.

EDIT: checkbox added in the list above. I think we now have all the possible types of fields for an ABAP List (I guess other simple graphical elements objects like GuiButton, GuiComboBox, GuiCTextField, GuiRadioButton, are not possible).

  •  Tags:  
  • Related