Hi Everyone,
In SAP i Have table i want iterate that in ascending order and click that row only how can do that in uipath?
please help
Thanks in Advance
Krishnareddy
Hi Everyone,
In SAP i Have table i want iterate that in ascending order and click that row only how can do that in uipath?
Thanks in Advance
Krishnareddy
Hi,
Could you explain a bit more by clicking that? Do you mean that you have a specific row that you need to click or that you want to iterate through from bottom to top and click on each row?
Hi @strqsr
Numbering is like random (1,3,6,7,8,2,3 ).here i want to put them in ascending order and i want click each row one by one.
Check this
DataView view = new DataView(table)
DataTable distinctValues = view.ToTable(true, "Column1", "Column2" ...)
or
DataTable =DataTable.DefaultView.ToTable(true)
Thanks
Ashwin.S
in SAP itself, is sorting not possible? Like you click the order tab for it to sort into ascend/descend?
Is scripting enabled at both end? Can you use data scraping?
If not. what you could do is you could create a do a loop where you extract the number from order and sort it in an excel/csv file for example, and then use an assign function to go through the rows and use text exists and click text
it possible when i was use mouse right click it is showing both ascending and decending.but how to handle them i was not able to do that can u please suggest how to do that.
Thanks
Krishnareddy
Do you mean you can’t click on the button using UiPath? I’m not too sure what you mean by it’s possible but you aren’t able to handle it.
If that’s the case you can use getVisibletext (native) to make the mouse click on the text for it to be sorted. You can also use an If activity to check the first and last row to see if the first row is smaller than the last row to check if it is sorted correctly. I can’t show you as I don’t have SAP installed on my computer.
Perhaps these two links may be able to help you
https://docs.uipath.com/studio/docs/introduction-to-sap-automation
Hi @krishnareddy ,
You can use below vbs script for iterating the Table
Use invoke vbs to call the Script
On Error Resume Next
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
Set Arg = WScript.Arguments
session.findById("wnd[0]").maximize
''Check Vendor Number
totalRows = session.findById("wnd[0]/usr/cntlCONTAINER_0111/shellcont/shell").rowCount
visibleRows = session.findById("wnd[0]/usr/cntlCONTAINER_0111/shellcont/shell").visiblerowCount
'maxVerPos = session.findById("wnd[0]/usr/cntlCONTAINER_0111/shellcont/shell").firstVisibleRow
'Msgbox(totalRows&" "&visibleRows)
rowCount = visibleRows-1
counter = 0
ccPos = 0
verPos = 1
flagSearch = "No"
Do
If counter > totalRows Then
WScript.Echo("Error, could not found any vendor number("&Arg(1)&") while blocking payment in SAP")
WScript.Quit
Exit Do
End If
If counter > (visibleRows-1) Then
session.findById("wnd[0]/usr/cntlCONTAINER_0111/shellcont/shell").firstVisibleRow = verPos
verPos = verPos + 1
End If
textVendor = session.findById("wnd[0]/usr/cntlCONTAINER_0111/shellcont/shell").GetCellValue(counter,"LIFNR")
If InStr(textvendor, Arg(0)) > 0 Then ''Vendor number
session.findById("wnd[0]/usr/cntlCONTAINER_0111/shellcont/shell").setCurrentCell counter,"LIFNR"
session.findById("wnd[0]/tbar[1]/btn[2]").press
'''''######Search Document######''''''
textVendor1 = ""
'''''Check Document Number'''''
totalRows1 = session.findById("wnd[0]/usr/cntlCONTAINER_0112/shellcont/shell").rowCount
visibleRows1 = session.findById("wnd[0]/usr/cntlCONTAINER_0112/shellcont/shell").visiblerowCount
'Msgbox(totalRows&" "&visibleRows)
rowCount1 = visibleRows1-1
counter1 = 0
ccPos1 = 0
verPos1 = 1
Do
If counter1 > totalRows1 Then
'MsgBox("Error, could not found any document("&Arg(1)&") number while blocking payment in SAP")
session.findById("wnd[0]/tbar[0]/btn[3]").press
'WScript.Echo("Error, could not found any document("&Arg(1)&") number while blocking payment in SAP")
'WScript.Quit
flagSearch = "No"
Exit Do
End If
If counter1 > (visibleRows1-1) Then
session.findById("wnd[0]/usr/cntlCONTAINER_0112/shellcont/shell").firstVisibleRow = verPos1
verPos = verPos + 1
End If
textVendor1 = session.findById("wnd[0]/usr/cntlCONTAINER_0112/shellcont/shell").GetCellValue(counter1,"BELNR")
'MsgBox(textVendor1)
If InStr(textvendor1, Arg(1)) > 0 Then ''Document number
'Msgbox("Match"&textVendor1)
session.findById("wnd[0]/usr/cntlCONTAINER_0112/shellcont/shell").setCurrentCell counter1,"BELNR"
session.findById("wnd[0]/tbar[1]/btn[5]").press
information_tab=session.findById("wnd[1]/usr/txtMESSTXT1").text
if InStr(1,information_tab,"items")then
session.findById("wnd[1]/tbar[0]/btn[0]").press
WScript.Sleep(3000)
End if
Err.Clear
flagSearch = "Yes"
Exit Do
Else
counter1 = counter1+1
End IF
Loop
'''''######End Search Document####
If flagSearch <> "No" Then
Exit Do
Else
counter = counter+1
End If
Else
counter = counter+1
End IF
Loop
sBarText = session.findById("wnd[0]/sbar").Text
If Err.Number <> 0 Then
WScript.Echo("Error occured while blocking payment for vendor("&Arg(0)&") and document("&Arg(1)&"). Error: " & Err.Description &" "& sBarText)
WScript.Quit
Err.Clear
End If
On Error Goto 0
Regards
Sanjay
HI All,
There is no single need to use any SAP VBS scripts. All action in SAP WinGUI can be performed just with help of UiPath Studio.
For Table operation, check the latest docu
We have invested a lot of effort to make it easy of use for users.
Check it out! And just to let you know, our SAP WinGUI Automation capabilities are certified by SAP
Best regards, Lev
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.