Thank you so much!
Re: How to Logon with RFC
Re: How to Create Script Mass User Login & Doing Transaction
Dear Husin,
I'm not sure whether that is possible... perhaps you can refer this discussion: http://scn.sap.com/thread/3467700
Thanks,
Sayuti
Re: How to Create Script Mass User Login & Doing Transaction
Hi Sayuti,
I can run the script concurrently, but i found the other problem there.
I'm using c# to call vbs script (macro) in excel concurrently using backgroundworker component. I can call it concurrently until display logon form in sap gui. but the new problem is when entering below part, the script was executed sequencely per user.
With sapsession
.FindById("wnd[0]/usr/txtRSYST-MANDT").Text = "200"
.FindById("wnd[0]/usr/txtRSYST-BNAME").Text = sapID
.FindById("wnd[0]/usr/pwdRSYST-BCODE").Text = sapPassword
.FindById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
.FindById("wnd[0]").SendVKey 0
.StartTransaction "IW33" '//transaction to test
-=== guiscript code ===-
End With
So my assumption is with sapsession ... end with cannot be executed concurrently. there is something behavior that make sapsession scope is not concurrently.
Is there anyone experienced with this?
Please give suggestion on this.
Thanks & Regards,
Husin
failed to connect to sap using php
In intranet it was connecting .. When I tried to connect to the client server the following error..
Failed to connect to the SAP serverRFC Error Info : Key : RFC_IO5 Status : RFC DRV=??? ??? Message : >>> RfcOpenEx ... Got following connect_param string: ASHOST=[ipaddress] SYSNR=01 CLIENT=100 USER=IMP_SLCM PASSWD=******* CODEPAGE=1100 <<< RfcOpenEx failed Internal: IO HANDLE=1 DRV=??? LINE=1068 CODE=5
Can any one help me on this .. thanks in advance..
Copy-Paste dates from Excel in SAP script
Hello,
I did a script in SAP. It goes in an Excel file to copy delivery dates and goes and paste them in a purchase order.
The date format in Excel is the same one as in SAP (YYYY/MM/DD), except that the script pastes the date format shown in the toolbar only (YYYY-MM-DD). Which is different and blocks the script.
I know you can change the regional settings of the computer, but to get YYYY/MM/DD I need to put it to English South Africa which is not good because it changes other settings. I can also change the date format in SAP to make it match to my Excel file, but this is not good either because the people using this script will have a date format in SAP different then the other users and will cause confusion.
Is there a way for the SAP script to copy-paste the date format in the cell 2014/01/16 and not the 2014-01-16?
Patricia
Re: Copy-Paste dates from Excel in SAP script
Dear Patricia,
What script platform are you using? VBA or VBS? Can you share your codes snippets so that we could understand your situation better?
If you are using Excel VBA you can use the FORMAT function. e.g:
session.FindById("wnd[0]\txtSomething").Text = Format(Sheet1.Range("D4"), "YYYY/MM/DD")
Thanks,
Sayuti
Re: Copy-Paste dates from Excel in SAP script
Hello, I am using a vbs file that reads as below.
Is this what you meant by code snippets?
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]/tbar[0]/okcd").text = "me22"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtRM06E-BSTNR").text = GetSheetRowValue("PO")
session.findById("wnd[0]/usr/ctxtRM06E-BSTNR").caretPosition = 10
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtRM06E-EBELP").text = GetSheetRowValue("item")
session.findById("wnd[0]/usr/txtRM06E-EBELP").setFocus
session.findById("wnd[0]/usr/txtRM06E-EBELP").caretPosition = 1
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tblSAPMM06ETC_0120/txtRM06E-BSTPO[0,0]").setFocus
session.findById("wnd[0]/usr/tblSAPMM06ETC_0120/txtRM06E-BSTPO[0,0]").caretPosition = 0
session.findById("wnd[0]/tbar[1]/btn[17]").press
session.findById("wnd[0]/usr/txtRM06E-ETNR1").text = GetSheetRowValue("livraison")
session.findById("wnd[0]/usr/txtRM06E-ETNR1").setFocus
session.findById("wnd[0]/usr/txtRM06E-ETNR1").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtRM06E-EEIND[1,0]").text = GetSheetRowValue("delivery")
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtEKET-SLFDT[6,0]").text = GetSheetRowValue("statistical")
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtEKET-SLFDT[6,0]").setFocus
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtEKET-SLFDT[6,0]").caretPosition = 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/btn[11]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/okcd").text = "me23n"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[3]").press
'Record result Message and Back
oSheet.Cells(iRow, 1).Value = oSheet.Cells(iRow, 1).Value & "|" & session.findById("wnd[0]/sbar").text
oSheet.Cells(iRow, 1).Select
oSheet.Cells(iRow, 1).Interior.ColorIndex = 4 'Green
Re: How to Create Script Mass User Login & Doing Transaction
Dear Husin,
I believe SAPGUI does not support multi-threading, hence it cannot execute Sessions concurrently.
Do post if you could find a workaround.
Thanks,
Sayuti
How to grab the value of an RC return on stms table?
I have to do a massive amount of transports in order from sap gui becouse of the athorization level i got on my company.
i've been using sapgui script to do some simple tasks like adding roles or adding a massive amount of transport request to the stack.
Now i want to make a script that transports some orders one by one in order but only after the previus one is over and the RC=0.
for that I'm planing on readign the icon on the third column to know if its green to proceed.
i've tried to get the value as a text like this:
session.findById("wnd[0]/usr/lbl[24,6]").text
but it doenst return any text.
Do you know how can i get the icon or the tooltip value that apears when i drag the mouse over the icon as a text?
I would really apreciate your help.
Re: How to Create Script Mass User Login & Doing Transaction
Dear Sayuti,
OK, i'm still search how make that happen. Sure, i will post it in this discussion if i find the way.
Thanks & Best Regards,
Husin
Re: How to grab the value of an RC return on stms table?
Hello Giancarlo,
welcome in the SCN Scripting Language forum.
To read the tooltip try this:
session.findById("wnd[0]/usr/lbl[24,6]").ToolTip()
To read the icon Name try this:
session.findById("wnd[0]/usr/lbl[24,6]").IconName()
Green = S_LEDG
Yellow = S_LEDY
Red = S_LEDR
Let us know the results.
Cheers
Stefan
Re: Copy-Paste dates from Excel in SAP script
Dear Patricia,
I'm not familiar with the GetSheetRowValue function you are using in your codes above.
Sorry can't offer further help.
Re: How to grab the value of an RC return on stms table?
Thank you very much Stefan, that was exactly what i needed.
can you please recommend me a guide or documentation where i can learn all this parameters?
Re: How to grab the value of an RC return on stms table?
Hello Giancarlo,
sure, look in the directory [C:\]Program Files\SAP\FrontEnd\SAPgui\SAPguihelp resp. Program Files[x86) on 64-bit Windows. You find in this directory the file SAPGUIScripting.chm. This file describes the complete SAP GUI Scripting API. E.g. open the node Objects > GUILabel > Properties to find IconName and ToolTip.
Cheers
Stefan
Input from Excel to SAP - make cycle.
Hi masters.
Could someone help me with my different problem...again?
now Im working in trscn QM02. Excel create numbers of lines and add part number, then it fills long text of each part number... Script looks like this:
Private Sub ITEMS_Click()
Dim App, Connection, session As Object
Set SapGuiAuto = GetObject("SAPGUI")
Set App = SapGuiAuto.GetScriptingEngine
Set Connection = App.Children(0)
Set session = Connection.Children(0)
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "qm02"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtRIWO00-QMNUM").Text = Range("L37").Value
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10").Select
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB01/ssubSUB_GROUP_20:SAPLIQS0:7110/tblSAPLIQS0POSITION_VIEWER/ctxtVIQMFE-BAUTL[9,0]").SetFocus
Application.Wait DateAdd("s", 1, Now)
Range("C2:C25").Copy '''''''''Add part numbers...thats ok
SendKeys "^v", True
Application.Wait DateAdd("s", 1, Now)
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB01/ssubSUB_GROUP_20:SAPLIQS0:7110/tblSAPLIQS0POSITION_VIEWER/txtVIQMFE-POSNR[0,0]").SetFocus
Application.Wait DateAdd("s", 1, Now)
Range("Q2:Q25").Copy '''''''''Add numbers of lines...thats ok
SendKeys "^v", True
Application.Wait DateAdd("s", 1, Now)
SendKeys "{ENTER}", True
'' Now it opens first line long text and insert the value of copied cell.
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB01/ssubSUB_GROUP_20:SAPLIQS0:7110/tblSAPLIQS0POSITION_VIEWER/btnQMICON-LTFEHLER[8,0]").SetFocus
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB01/ssubSUB_GROUP_20:SAPLIQS0:7110/tblSAPLIQS0POSITION_VIEWER/btnQMICON-LTFEHLER[8,0]").press
Application.Wait DateAdd("s", 1 / 3, Now)
Range("G2").Copy
SendKeys "{PGDN}"
Application.Wait DateAdd("s", 1, Now)
SendKeys "^v", True
Application.Wait DateAdd("s", 1 / 3, Now)
session.findById("wnd[0]/tbar[0]/btn[3]").press
''First Long text is filled. Now I have the same script but it focus on second row/line long text in sap and takes value from next cell in excel:
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB01/ssubSUB_GROUP_20:SAPLIQS0:7110/tblSAPLIQS0POSITION_VIEWER/btnQMICON-LTFEHLER[8,1]").SetFocus
session.findById("wnd[0]/usr/tabsTAB_GROUP_10/tabp10\TAB10/ssubSUB_GROUP_10:SAPLIQS0:7210/tabsTAB_GROUP_20/tabp20\TAB01/ssubSUB_GROUP_20:SAPLIQS0:7110/tblSAPLIQS0POSITION_VIEWER/btnQMICON-LTFEHLER[8,1]").press
Application.Wait DateAdd("s", 1 / 3, Now)
Range("G3").Copy
SendKeys "{PGDN}"
Application.Wait DateAdd("s", 1, Now)
SendKeys "^v", True
Application.Wait DateAdd("s", 1 / 3, Now)
session.findById("wnd[0]/tbar[0]/btn[3]").press
.......
""And so on 24times...
End Sub
So is there a way how to make a loop in SAP, when I have for example 5 part numbers to have just one of this block - something like i, For and Loop function in excel? Its working now but there is error when it comes to row/line in SAP where it isnt long text (which is created by entering a number of line and adding PN, so 6th line in this case). Using error handler I jump to another command to save the inserted values in SAP and everything is OK, but I find it extremely unpractical, loooong and unsafe due other errors that may occur.
If there is a thread with this problem I will be pleased to just link me there or explain here.
And as usual thanks in advance for your effort and time.
Re: Copy-Paste dates from Excel in SAP script
I got the same result.
This is what I put in the script:
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtRM06E-EEIND[1,0]").text = mid(GetSheetRowValue("delivery"),1,4)&"/"&mid(GetSheetRowValue("delivery"),6,2)&"/"&mid(GetSheetRowValue("delivery"),8,2)
Re: Copy-Paste dates from Excel in SAP script
You should tryit the wayI suggestedit. Intermediate storage inavariable mayalreadybe important.
. . .
Delivery = GetSheetRowValue("delivery")
'You can viewthe contenthere.
msgbox Delivery
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtRM06E-EEIND[1,0]").text = mid(Delivery,1,4) & "/" & mid(Delivery,6,2) & "/" & mid(Delivery,9,2)
. . .
Regards,
ScriptMan
Re: Copy-Paste dates from Excel in SAP script
Thank you for replying to my problem.
But I really don't understand what you are trying to tell me.
What line should I put in my script?
This one?
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtRM06E-EEIND[1,0]").text = mid(Delivery,1,4) & "/" & mid(Delivery,6,2) & "/" & mid(Delivery,9,2)
What do I do with Delivery = GetSheetRowValue("delivery") ?
Re: Copy-Paste dates from Excel in SAP script
After theextension, your scriptshouldlook like this:
. . .
session.findById("wnd[0]/usr/txtRM06E-ETNR1").text = GetSheetRowValue("livraison")
session.findById("wnd[0]/usr/txtRM06E-ETNR1").setFocus
session.findById("wnd[0]/usr/txtRM06E-ETNR1").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
Delivery = GetSheetRowValue("delivery")
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtRM06E-EEIND[1,0]").text = mid(Delivery,1,4) & "/" & mid(Delivery,6,2) & "/" & mid(Delivery,9,2)
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtEKET-SLFDT[6,0]").text = GetSheetRowValue("statistical")
. . .
Re: Copy-Paste dates from Excel in SAP script
I did a copy-paste of your lines.
And Line 132 being the Delivery = GetSheetRowValue("Delivery")
I got this error message. Sorry, the error message is in french. But I'm sure you can understand it anyway. It says that the delivery variable is not defined.
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]/tbar[0]/okcd").text = "me22"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtRM06E-BSTNR").text = GetSheetRowValue("PO")
session.findById("wnd[0]/usr/ctxtRM06E-BSTNR").caretPosition = 10
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtRM06E-EBELP").text = GetSheetRowValue("Item")
session.findById("wnd[0]/usr/txtRM06E-EBELP").setFocus
session.findById("wnd[0]/usr/txtRM06E-EBELP").caretPosition = 1
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/mbar/menu[3]/menu[1]").select
session.findById("wnd[0]/usr/txtRM06E-ETNR1").text = GetSheetRowValue("Ligne")
session.findById("wnd[0]/usr/txtRM06E-ETNR1").setFocus
session.findById("wnd[0]/usr/txtRM06E-ETNR1").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
Delivery = GetSheetRowValue("Delivery")
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtRM06E-EEIND[1,0]").text = mid(Delivery,1,4) & "/" & mid(Delivery,6,2) & "/" & mid(Delivery,9,2)
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtEKET-SLFDT[6,0]").text = GetSheetRowValue("Statistical")
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtEKET-SLFDT[6,0]").setFocus
session.findById("wnd[0]/usr/tblSAPMM06ETC_1117/ctxtEKET-SLFDT[6,0]").caretPosition = 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/btn[11]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/okcd").text = "me23n"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/btn[3]").press