0

I have a SAP GUI script that I save in a folder except that I want to vary the path if other people want to use my code except that I don't know how to modify the path.

   objSess.FindById("wnd[0]").maximize
   [...]
   
      objSess.FindById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/
     ssub%_SUBSCREEN_
     TABBL1:RFBILA00:0002/ctxtBILAVART").caretPosition = 1
     objSess.FindById("wnd[0]").sendVKey 4
     objSess.FindById("wnd[1]").Close
      objSess.FindById("wnd[0]/usr/tabsTABSTRIP_TABBL1/
      tabpUCOM2/ssub%_SUBSCREEN_TAB BL1:RFBILA00:0002/ctxtBILAVART").Text ="1"  
      objSess.FindById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/
      ssub%_SUBSCREEN_TABBL1:RFBILA00:0002/ctxtBILASKAL").Text = "0/0"
      objSess.FindById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/
      ssub%_SUBSCREEN_TABBL1:RFBILA00:0002/ctxtBILASKAL").SetFocus
     objSess.FindById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/
     ssub%_SUBSCREEN_TABBL1:RFBILA00:0002/ctxtBILASKAL").caretPosition = 3
     objSess.FindById("wnd[0]/tbar[1]/btn[8]").Press
     objSess.FindById("wnd[0]/mbar/menu[0]/menu[3]/menu[2]").Select
     objSess.FindById("wnd[1]/tbar[0]/btn[0]").Press
     objSess.FindById("wnd[1]/usr/ctxtDY_FILENAME").Text = text.txt 
     objSess.FindById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 8
     objSess.FindById("wnd[1]/tbar[0]/btn[11]").Press

In fact, I can't find the line to vary the path (I saved the script locally)

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
dfiu
  • 5
  • 1
  • 5
  • When recording a macro in SAP you need to "change" all relevant fields, removing one letter and adding it again suffices, to have all fields show up in the macro. I'm guessing you're using the default path? That should be the same for every user, except for the windows profile name, of course. – Nacorid Jun 25 '19 at 13:12
  • Yes, I did, but I can't find the record line of the file. No, it's my own path, not the default one. – dfiu Jun 25 '19 at 13:14

1 Answers1

0

As mentioned in a comment it's vital to change, or at least click into, every field one wants to change while recording a macro in SAP. So that on has the record of the name of the field.

An educated guess for the path field on my part would be:

objSess.FindById("wnd[1]/usr/ctxtDY_PATH").Text

I advise you to record the macro again, as the name may be slightly different depending on the context in SAP, and especially the number of windows open at the time may differ.

PS: .CaretPosition is the number of letters from the left where the cursor will be positioned in the text field.

Nacorid
  • 783
  • 8
  • 21