0

In a SAP GUI transaction, I have a few columns and multiple rows, I need SAP GUI Script to go through column 1 in all the rows to find the component ID and in column 3 to change the value of the component.

SAP GUI Scripting recording does not really help as in each material there are different number of rows. Could you guys take a look at my script and guide on what needs to be changed in order to make it functional?

session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]").text = "2.400"
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]").setFocus
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]").caretPosition = 3
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[11]").press
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • Please first look at how the [GuiTableControl](https://help.sap.com/viewer/product/sap_gui_for_windows/760.02/en-US?q=GuiTableControl) object works, and possibly this [answer](https://stackoverflow.com/questions/68685911/reading-text-in-va02-table-control/68715008#68715008) might help for reading the values and scrolling. – Sandra Rossi Jul 22 '22 at 12:56

1 Answers1

0

Try this !

When you need to send a key, keep it in parenthesis

session.findById("wnd[0]").sendVKey(0)

When you need to press a button, use parenthesis too

session.findById("wnd[0]/tbar[0]/btn[11]").press()

For more information, read this SendVkey

Frantisek Kossuth
  • 3,524
  • 2
  • 23
  • 42