Reputation: 3
I am trying to automate SAP Organizational Level update via PFCG using scripting. I have no problems to get the loop for the row update to work. I tested this alone and it works perfectly!
What I cannot really get to work is the column looping. I could do this the manual way but it would be absurd to do copy and paste the line like this for example over and over again to simulate the column loop:
session.findById("wnd[1]/usr/tblSAPLSUPRNORG_TC/ctxtT_STORG-LOW[1,0]").caretPosition = 4
session.findById("wnd[1]/usr/tblSAPLSUPRNORG_TC/ctxtT_STORG-LOW[1,1]").caretPosition = 4
session.findById("wnd[1]/usr/tblSAPLSUPRNORG_TC/ctxtT_STORG-LOW[1,2]").caretPosition = 4`
Any ideas how the column loop can be achieved?
introw=2
Do while objsheet.Cells(introw,1).value <> ""
session.findById("wnd[0]/tbar[0]/okcd").text = "/nPFCG"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtAGR_NAME_NEU").text = objsheet.Cells(introw,1).value
session.findById("wnd[0]/usr/ctxtAGR_NAME_NEU").caretPosition = 11
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/btn%#AUTOTEXT001").press
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpTAB5").select
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpTAB5/ssubSUB1:SAPLPRGN_TREE:0350/btnPROFIL1").press
session.findById("wnd[0]/tbar[1]/btn[32]").press
session.findById("wnd[1]/usr/tblSAPLSUPRNORG_TC/ctxtT_STORG-LOW[1,0]").text = objsheet.Cells(introw,2).value
session.findById("wnd[1]/usr/tblSAPLSUPRNORG_TC/ctxtT_STORG-LOW[1,0]").caretPosition = 4
session.findById("wnd[1]/tbar[0]/btn[11]").press
session.findById("wnd[0]/tbar[1]/btn[17]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
introw = introw + 1
Loop
Screenshot of input file:
Upvotes: 0
Views: 142
Reputation: 1625
The example with the 3 columns could be implemented as follows:
for intcol = 0 to 2
session.findById("wnd[1]/usr/tblSAPLSUPRNORG_TC/ctxtT_STORG-LOW[1," & cstr(intcol) & "]").caretPosition = 4
next intcol
Regards, ScriptMan
Upvotes: 1