How to fill all column in SAP GUI SCRIPT by IF / IFEND

49 views Asked by At

As i was trying to RPA my SAP, I encountered a problem. enter image description here by using SAP script recoding, i was able to fill these column one by one by this script code. under is my script code.

    `If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").currentCellColumn = "FLIEF"
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").pressF4
session.findById("wnd[1]/usr/lbl[1,3]").caretPosition = 6
session.findById("wnd[1]").sendVKey 2
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell")
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").modifyCell 1,"FLIEF","1190361578"
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").currentCellRow = 1
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").triggerModified
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").modifyCell 2,"FLIEF","1190361578"
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").currentCellRow = 2
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").triggerModified
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").modifyCell 3,"FLIEF","1190361578"
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").currentCellRow = 3
session.findById("wnd[0]/usr/cntlCONTAINER_ALV/shellcont/shell").triggerModified`

and so on.

However my rows are over atleast 100.

So what i want is it needs to repeat until it reaches the end of the row.

like this. enter image description here The repeated data is same. Please teach me if there is a easier way.

Thank you.

0

There are 0 answers