cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP GUI Scripting select active row

wkn
Discoverer
0 Likes
16,888

Hi,

I'm trying to automate some SAP actions with Excel.

I Recorded some Script from SAP an most is working just fine, I only have a problem selecting the active row in CS02 after positioning the right RowID.

Recording results in:

session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").getAbsoluteRow(39).selected = true

But I can't select a row with the AbsoluteRow number since I don't know that number.

Any ideas how to select the entire line so it can be deleted?

Thanks.

View Entire Topic
Former Member
0 Likes

Hi Stefan

I searched a long time how select an item in CS02.
The problem with 'getAbsoluteRow().selected = true' and 'VisibleRowCount' is that it does not work proprely and I had to use 'on error resume next'. Now I could find the row number after use menu 'edit\Position'.

You can find the position on field RC29P-ENTAC, example select pos. 305

session.findById("wnd[0]/tbar[0]/okcd").text = "/ncs02"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtRC29N-MATNR").text = "material number"
session.findById("wnd[0]/usr/ctxtRC29N-WERKS").text = "plant"
session.findById("wnd[0]/usr/ctxtRC29N-STLAN").text = "1"
session.findById("wnd[0]/tbar[1]/btn[5]").press
session.findById("wnd[0]/mbar/menu[1]/menu[11]").select
session.findById("wnd[1]/usr/subPOS_SETP:SAPLCSDI:0710/txtRC29P-SELPO").text = "0305"
session.findById("wnd[1]/tbar[0]/btn[0]").press
Pos_nb = (session.findById("wnd[0]/usr/txtRC29P-ENTAC").text)
session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").getAbsoluteRow(Pos_nb - 1).selected = True

Best regards

Jean-Luc