seangriffin

SAP UDF

96 posts in this topic

#1 ·  Posted (edited)

I would like to establish a SAP UDF post, considering the amount of discussion so far on how to automate SAP.

I recently discovered how to access SAP's Scripting COM object through AutoIT, and began writing this UDF to support it.

My time with SAP is limited to working hours so I'll post updates whenever I get the chance.

REQUIREMENTS:

  • AutoIt3 3.2 or higher,
  • SAP GUI Release 6.40,
  • SAP GUI Scripting interface is enabled
  • You are already logged into SAP (ie. The "SAP Easy Access" window is displayed)

To enable the SAP GUI Scripting interface:

  • From the SAP GUI, select the "Customize Local Layout" button on the toolbar
  • Select "Options".
  • Select the "Scripting" tab.
  • If the message "Scripting is installed!" is not displayed, then contact your SAP administrators to have SAP GUI Scripting installed.
  • Select "Enable Scripting".
  • Deselect "Notify when a script attaches to a running GUI".
  • Deselect "Notify when a script opens a connection".

LIST OF FUNCTIONS:


_SAPSessAttach($win_title, $sap_transaction = -1)
_SAPSessCreate($sap_transaction = -1)
_SAPVKeysSend($vkeys)
_SAPVKeysSendUntilWinExists($keys, $win_title)
_SAPObjDeselect($object_id)
_SAPObjSelect($object_id)
_SAPObjValueSet($object_id, $object_value)
_SAPObjValueGet($object_id = "usr")
_SAPObjFindByValue($object_id = "usr", $object_value = "", $match_type = 0, $instance = 1, $object_offset = 0)
_SAPObjPropertySet($object_id, $object_property, $object_value)
_SAPObjPropertyGet($object_id, $object_property)
_SAPWinExists($win_title)
_SAPWinClose($win_title)
_SAPErrorHandlerRegister($s_functionName = "__SAPInternalErrorHandler")

 

EXAMPLES:

_SAPSessAttach.au3_SAPSessCreate.au3_SAPVKeysSend.au3_SAPVKeysSendUntilWinExists.au3_SAPObjSelect.au3_SAPObjValueSet.au3_SAPObjValueGet.au3_SAPObjPropertySet.au3_SAPObjPropertyGet.au3_SAPWinExists.au3_SAPWinClose.au3

The following code is a simple example of using the UDF.
Ensure you have met the requirements outlined in the REQUIREMENTS section above before commencing.

#include <SAP.au3>
_SAPSessAttach("SAP Easy Access")
_SAPSessCreate("pa30")
_SAPObjValueSet("usr/subSUBSCR_PERNR:SAPMP50A:0120/ctxtRP50G-PERSONID_EXT", "00000018")
_SAPVKeysSend("Enter")
$pers_no = _SAPObjValueGet("usr/subSUBSCR_PERNR:SAPMP50A:0120/ctxtRP50G-PERSONID_EXT")

The first function is _SAPSessAttach. This establishes a connection to a SAP window. In the example, we connect to the first SAP window displayed after logging in to SAP - the SAP Easy Access window.
From here, all other functions will operate within this SAP window / session.

_SAPSessCreate then opens a new SAP session, and runs a transaction within it. In the example, this takes us to the Maintain HR Master Data screen (transaction pa30).

_SAPObjValueSet sets the value of an object / control within the current SAP window. In the example, this sets the Personnel no. field to 00000018.

To determine the ID of a SAP Object (ie. the Personnel no. field ID "usr/subSUBSCR_PERNR:SAPMP50A:0120/ctxtRP50G-PERSONID_EXT"), follow these manual steps in SAP:

  • Select the "Customize Local Layout" button on the toolbar.
  • Select "Script Development Tools".
  • Select "Do a hit test on the window".
  • Move your mouse to the object you want the ID of.
  • Click "Copy Id" in the Scripting Wizard.
  • Paste this ID into the function in your script.
  • Remove all text upto and including "wnd[n]/".

_SAPVKeysSend is then used to press the Enter key, and update the Maintain HR Master Data screen with the employee's details.

The last line of the example gets the value of the Personnel no. field, using _SAPObjValueGet.

DOWNLOAD:

Latest Version - v0.4 (07/01/09)
SAP.au3
 

SAP.au3

Edited by seangriffin
1 person likes this

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites



Thanks

This job good

Please Examples for this UDF

Share this post


Link to post
Share on other sites

Thanks

This job good

Please Examples for this UDF

Examples provided. Thanks for the feedback!


Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites

Thank you. It looks very good.

Examples provided. Thanks for the feedback!

Share this post


Link to post
Share on other sites

Well done man! :)

This is exactly what I'm looking for..

I'm just wondering if it's work when the sapgui is embedded into the autoit gui..

Sadly I have limited hours to access sap, so I can not try your udf yet:) but I'll give a feedback

Last question: is it working with sapgui 710?


dworldI'm new in autoit, but I like it. My mind is open to the new things.

Share this post


Link to post
Share on other sites

Hello,

I'm am new here, but is it possible to do the following in SAP with AutoIt :

1 GOTO transaction CO01 in SAP , ( run with normal material number, but with changing (user input) quantity)

2 run transaction CO11N in SAP (accept propossed quantity for goods issue)

3 pick the batch created in transaction VL01N in SAP and deliver it to the customer, (print CMR also).

Thanks in advance

Best regards,

Jeweetwel

Share this post


Link to post
Share on other sites

Well done man! :)

This is exactly what I'm looking for..

I'm just wondering if it's work when the sapgui is embedded into the autoit gui..

Sadly I have limited hours to access sap, so I can not try your udf yet:) but I'll give a feedback

Last question: is it working with sapgui 710?

Not sure what you mean by "sapgui is embedded into the autoit gui". SAP doesn't need to be embedded in the AutoIT application for this to work. You just need to follow the REQUIREMENTS section above, and make sure your AutoIT script is running on the same computer as the SAP GUI client. This UDF even works in Citrix, so long as you copy AutoIT onto the Citrix server and run your SAP GUI client from there.

It should work with SAP 710, although I've never tried it.


Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hello,

I'm am new here, but is it possible to do the following in SAP with AutoIt :

1 GOTO transaction CO01 in SAP , ( run with normal material number, but with changing (user input) quantity)

2 run transaction CO11N in SAP (accept propossed quantity for goods issue)

3 pick the batch created in transaction VL01N in SAP and deliver it to the customer, (print CMR also).

Thanks in advance

Best regards,

Jeweetwel

Here's an example of going to trans. CO01 from the "SAP Easy Access" window, and filling in the transaction with information:

#include <SAP.au3>
_SAPSessAttach("", "co01")
_SAPObjValueSet("usr/ctxtCAUFVD-MATNR", "TOAST")
_SAPObjValueSet("usr/ctxtCAUFVD-WERKS", "1061")
_SAPObjValueSet("usr/ctxtAFPOD-PWERK", "1111")
_SAPObjValueSet("usr/ctxtAUFPAR-PP_AUFART", "2222")
_SAPObjValueSet("usr/ctxtCAUFVD-AUFNR", "3333")
_SAPObjValueSet("usr/ctxtRC62C-REFNR", "4444")

This example fills out the trans CO11N:

_SAPSessAttach("", "co11n")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-RUECK", "1234")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR", "567")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-VORNR", "123")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-APLFL", "456")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-UVORN", "789")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-KAPAR", "321")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-SPLIT", "444")
_SAPObjSelect("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_CONF_TYPE:SAPLCORU_S:0105/chkAFRUD-AUSOR")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/txtAFRUD-LMNGA", "123456")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/ctxtAFRUD-MEINH", "1")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/txtAFRUD-XMNGA", "2233")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/txtAFRUD-RMNGA", "1122")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/ctxtAFRUD-GRUND", "abc")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET2:SAPLCORU_S:0300/txtAFRUD-ISM01", "999")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET2:SAPLCORU_S:0300/ctxtAFRUD-ILE01", "5")
_SAPObjSelect("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET2:SAPLCORU_S:0300/chkAFRUD-LEK01")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET3:SAPLCORU_S:0400/ctxtAFRUD-PERNR", "12345678")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET3:SAPLCORU_S:0400/txtAFRUD-ZAUSW", "222")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET4:SAPLCORU_S:0500/ctxtAFRUD-ISDD", "10.03.2008")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET4:SAPLCORU_S:0500/ctxtAFRUD-ISDZ", "11:30:30")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET5:SAPLCORU_S:0600/ctxtAFRUD-BUDAT", "23.03.2008")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET5:SAPLCORU_S:0600/txtAFRUD-ISERH", "333")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET5:SAPLCORU_S:0600/ctxtAFRUD-ZEIER", "7")

And this script fills out trans. vl01n:

_SAPSessAttach("", "vl01n")
_SAPObjValueSet("usr/ctxtLIKP-VSTEL", "111")
_SAPObjValueSet("usr/ctxtLV50C-DATBI", "10.03.2008")
_SAPObjValueSet("usr/ctxtLV50C-VBELN", "444")
_SAPObjValueSet("usr/ctxtLV50C-ABPOS", "1")
_SAPObjValueSet("usr/ctxtLV50C-BIPOS", "500")
_SAPObjValueSet("usr/ctxtLIKP-LFART", "55")

I don't know what these transactions do, but I can automate them :) My head is in the SAP HR space.

Edited by seangriffin

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites

Hi,

I was trying out the _SAPSessAttach sample but it seems like it won't work for me.

I'm getting the error 'Unable to find the window with title "SAP Easy Access" to attach to.' for some reason, however, I've just checked the window title with the AutoIt window info tool, which shows that the window title is correct.

Do you have any idea why this could happen?

I'm using version 7.10 by the way.

For any ideas, thanks in advance!

cheers,

b0ris

Share this post


Link to post
Share on other sites

Hi,

I was trying out the _SAPSessAttach sample but it seems like it won't work for me.

I'm getting the error 'Unable to find the window with title "SAP Easy Access" to attach to.' for some reason, however, I've just checked the window title with the AutoIt window info tool, which shows that the window title is correct.

Do you have any idea why this could happen?

I'm using version 7.10 by the way.

For any ideas, thanks in advance!

cheers,

b0ris

That is strange. I'll step through the function to see what might be happening. You are getting past the inital step of making a connection to the SAP GUI scripting engine, and failing the next step of checking if the "SAP Easy Access" window exists. The "_SAPWinExists" function is used to do this, and this function uses the session created earlier to find a window of the title "SAP Easy Access". Somewhere in this code it's failing, but of course it shouldn't be. Maybe the SAP GUI scripting language has varied slightly in V7.10 of the SAP GUI. I really need to test my UDF against V7.10. I had access to 7.10 for a brief time but no longer have it.

I'll try and search the web and see if there's a difference in the SAP GUI scripting language between versions.


Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites

That is strange. I'll step through the function to see what might be happening. You are getting past the inital step of making a connection to the SAP GUI scripting engine, and failing the next step of checking if the "SAP Easy Access" window exists. The "_SAPWinExists" function is used to do this, and this function uses the session created earlier to find a window of the title "SAP Easy Access". Somewhere in this code it's failing, but of course it shouldn't be. Maybe the SAP GUI scripting language has varied slightly in V7.10 of the SAP GUI. I really need to test my UDF against V7.10. I had access to 7.10 for a brief time but no longer have it.

I'll try and search the web and see if there's a difference in the SAP GUI scripting language between versions.

Thank you, I'll check this topic every day! I'll also try to find out why this happens, or just find another way to identify the window, and if I succeed, I will post the resolution here.

Share this post


Link to post
Share on other sites

Very good news! I've managed to find out why it can not identify the window name. Just change the "If $sap_connection = -1 then" to "If $sap_transaction = -1 Then" in line 108 of your SAP UDF and it will work like a charm.

By the way, how can you use the "hit test" efficiently for finding out the field name? When I'm trying to use it, it will identify the field while the cursor is in the desired field, but when I move the mouse over to the Copy ID button, it will change automatically to wnd[0]. This is driving me nuts, so is there another way to do this?

Share this post


Link to post
Share on other sites

Hi Sean,

Thanks for the reply

I already found the internal macro recorder. :) This snippled was recorded yesterday (VBS):

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 = "co01"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ctxtCAUFVD-MATNR").text = "101853"

session.findById("wnd[0]/usr/ctxtCAUFVD-MATNR").caretPosition = 6

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/txtCAUFVD-GAMNG").text

= "31234"

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtCAUFVD-GSTRP").text

= "04022009"

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtCAUFVD-GSTRP").setFocus

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtCAUFVD-GSTRP").caretPosition

= 8

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[0]/btn[11]").press

session.findById("wnd[0]/mbar/menu[0]/menu[4]").select

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[1]/btn[25]").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 = "co11n"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR").text

= "10171726"

session.findById("wnd[0]/usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR").setFocus

session.findById("wnd[0]/usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR").caretPosition

= 8

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[1]/btn[18]").press

session.findById("wnd[1]").sendVKey 4

session.findById("wnd[2]/usr/cntlCONTAINER/shellcont/shell").selectionInterval

= "20090209,20090209"

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[0]/usr/subTABLE:SAPLCOWB:0500/tblSAPLCOWBTCTRL_0500/ctxtCOWB_COMP-CHARG[6,0]").setFocus

session.findById("wnd[0]/usr/subTABLE:SAPLCOWB:0500/tblSAPLCOWBTCTRL_0500/ctxtCOWB_COMP-CHARG[6,0]").caretPosition

= 0

session.findById("wnd[0]/tbar[0]/btn[11]").press

i can see the resemblance in your coding, en so also the possibility's for our deparment.

Unfortunatly, scripting is only enabled on the maintenace environment. Can you think of a valid reason why this shoud not be enabled on the production environment? (The real environment).

Thanks in advance, and sorry for the poor english!

Best regards,

Rody (Jeweetwel).

Here's an example of going to trans. CO01 from the "SAP Easy Access" window, and filling in the transaction with information:

#include <SAP.au3>
_SAPSessAttach("", "co01")
_SAPObjValueSet("usr/ctxtCAUFVD-MATNR", "TOAST")
_SAPObjValueSet("usr/ctxtCAUFVD-WERKS", "1061")
_SAPObjValueSet("usr/ctxtAFPOD-PWERK", "1111")
_SAPObjValueSet("usr/ctxtAUFPAR-PP_AUFART", "2222")
_SAPObjValueSet("usr/ctxtCAUFVD-AUFNR", "3333")
_SAPObjValueSet("usr/ctxtRC62C-REFNR", "4444")

This example fills out the trans CO11N:

_SAPSessAttach("", "co11n")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-RUECK", "1234")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR", "567")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-VORNR", "123")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-APLFL", "456")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-UVORN", "789")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-KAPAR", "321")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/txtAFRUD-SPLIT", "444")
_SAPObjSelect("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_CONF_TYPE:SAPLCORU_S:0105/chkAFRUD-AUSOR")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/txtAFRUD-LMNGA", "123456")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/ctxtAFRUD-MEINH", "1")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/txtAFRUD-XMNGA", "2233")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/txtAFRUD-RMNGA", "1122")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET1:SAPLCORU_S:0200/ctxtAFRUD-GRUND", "abc")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET2:SAPLCORU_S:0300/txtAFRUD-ISM01", "999")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET2:SAPLCORU_S:0300/ctxtAFRUD-ILE01", "5")
_SAPObjSelect("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET2:SAPLCORU_S:0300/chkAFRUD-LEK01")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET3:SAPLCORU_S:0400/ctxtAFRUD-PERNR", "12345678")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET3:SAPLCORU_S:0400/txtAFRUD-ZAUSW", "222")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET4:SAPLCORU_S:0500/ctxtAFRUD-ISDD", "10.03.2008")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET4:SAPLCORU_S:0500/ctxtAFRUD-ISDZ", "11:30:30")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET5:SAPLCORU_S:0600/ctxtAFRUD-BUDAT", "23.03.2008")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET5:SAPLCORU_S:0600/txtAFRUD-ISERH", "333")
_SAPObjValueSet("usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_DET5:SAPLCORU_S:0600/ctxtAFRUD-ZEIER", "7")

And this script fills out trans. vl01n:

_SAPSessAttach("", "vl01n")
_SAPObjValueSet("usr/ctxtLIKP-VSTEL", "111")
_SAPObjValueSet("usr/ctxtLV50C-DATBI", "10.03.2008")
_SAPObjValueSet("usr/ctxtLV50C-VBELN", "444")
_SAPObjValueSet("usr/ctxtLV50C-ABPOS", "1")
_SAPObjValueSet("usr/ctxtLV50C-BIPOS", "500")
_SAPObjValueSet("usr/ctxtLIKP-LFART", "55")

I don't know what these transactions do, but I can automate them :) My head is in the SAP HR space.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Hi Sean,

Thanks for the reply

I already found the internal macro recorder. :) This snippled was recorded yesterday (VBS):

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 = "co01"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ctxtCAUFVD-MATNR").text = "101853"

session.findById("wnd[0]/usr/ctxtCAUFVD-MATNR").caretPosition = 6

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/txtCAUFVD-GAMNG").text

= "31234"

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtCAUFVD-GSTRP").text

= "04022009"

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtCAUFVD-GSTRP").setFocus

session.findById("wnd[0]/usr/tabsTABSTRIP_0115/tabpKOZE/ssubSUBSCR_0115:SAPLCOKO1:0120/ctxtCAUFVD-GSTRP").caretPosition

= 8

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[0]/btn[11]").press

session.findById("wnd[0]/mbar/menu[0]/menu[4]").select

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[1]/btn[25]").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 = "co11n"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR").text

= "10171726"

session.findById("wnd[0]/usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR").setFocus

session.findById("wnd[0]/usr/ssubSUB01:SAPLCORU_S:0010/subSLOT_HDR:SAPLCORU_S:0110/ctxtAFRUD-AUFNR").caretPosition

= 8

session.findById("wnd[0]/tbar[0]/btn[0]").press

session.findById("wnd[0]/tbar[1]/btn[18]").press

session.findById("wnd[1]").sendVKey 4

session.findById("wnd[2]/usr/cntlCONTAINER/shellcont/shell").selectionInterval

= "20090209,20090209"

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[0]/usr/subTABLE:SAPLCOWB:0500/tblSAPLCOWBTCTRL_0500/ctxtCOWB_COMP-CHARG[6,0]").setFocus

session.findById("wnd[0]/usr/subTABLE:SAPLCOWB:0500/tblSAPLCOWBTCTRL_0500/ctxtCOWB_COMP-CHARG[6,0]").caretPosition

= 0

session.findById("wnd[0]/tbar[0]/btn[11]").press

i can see the resemblance in your coding, en so also the possibility's for our deparment.

Unfortunatly, scripting is only enabled on the maintenace environment. Can you think of a valid reason why this shoud not be enabled on the production environment? (The real environment).

Thanks in advance, and sorry for the poor english!

Best regards,

Rody (Jeweetwel).

Hi Rody,

I'd love to give you an expert opinion on whether GUI scripting should be enabled in a production environment. I'm no SAP expert though. I've only been working with SAP for the past 12 months and only recently discovered how the SAP GUI scripting language could be integrated into AutoIT.

I can tell you this though. I work alongside some experienced SAP consultants here at my work, and after showing them the GUI scripting capability of SAP they have recommended it directly to our client, as a means of automating data entry into SAP from their legacy payroll system (in cases where the data migration may have failed). Other tools recommended to our client include SAP's fast entry transaction, and LSMW.

I can't see any downside in using it in production. In fact, it was put forward to out client as an alternative to the SAP scheduling tool "Redwood" (http://www.redwood.com/solutions/business/solutions-for-sap-customers).

The great thing about integrating SAP's GUI scripting with AutoIT is that you get to include AutoIT's powerful functions inside SAP. The combination of the two work really well. For instance, I have had issues synchonising windows using the native SAP GUI scripting VBS scripts. AutoIT's window functions fill in the gaps in this case.

Edited by seangriffin

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites

Very good news! I've managed to find out why it can not identify the window name. Just change the "If $sap_connection = -1 then" to "If $sap_transaction = -1 Then" in line 108 of your SAP UDF and it will work like a charm.

By the way, how can you use the "hit test" efficiently for finding out the field name? When I'm trying to use it, it will identify the field while the cursor is in the desired field, but when I move the mouse over to the Copy ID button, it will change automatically to wnd[0]. This is driving me nuts, so is there another way to do this?

Great you found a solution! :) It's actually not the solution I was hoping for though.

I maintain $sap_connection as an indicator of whether the script has already connected to the SAP GUI scripting engine, and if subsequent calls are made to _SAPSessAttach then the code to make a connection to the SAP GUI scripting engine shouldn't get executed again (in other words, the IF statement on line 108 shouldn't get executed more than once).

$sap_connection is a global variable that should always be set to -1 the moment you script starts running (because line 67 of states "Global $sap_connection = -1"). It's strange that the first time you call $sap_connection isn't equal to -1. Can you check your code for this, or post your code to me to have a look. Bit strange.

There might be a smarter way to check if a connection has already been made to the scripting engine. Perhaps by trying to make a call to the scripting engine before a connection is made and then trapping for the error. I'll give it some thought.


Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites

Dear Sir,

I have used your SAP UDF.

_ But I have faced the problem that When the dialog shown, I have to move the mouse cursor to this dialog then the code can run.

_ In some case I can not log on SAP, then the error was shown. How can I handle this error.

Tks,

LVD

;Logon to SAP
;Run the saplogon.exe
;At the folder C:\Program Files\SAP\FrontEnd\SapGui
ShellExecute("saplogon.exe","","C:\Program Files\SAP\FrontEnd\SapGui")

;Waiting for the Sreen "SAP Logon 640" was shown
WinActivate("SAP Logon 640")

Sleep(1000)
Send("!l")
;Enter to logon
;send("{ENTER}")
;Waiting for the sreen "SAP" was shown
WinActivate("SAP")

;Logon to SAP 

; Cach 1 - Hay hon
_SAPSessAttach("SAP")
;/app/con[0]/ses[0]/wnd[0]/usr/txtRSYST-MANDT
_SAPObjValueSet("usr/txtRSYST-MANDT","117")
;/app/con[0]/ses[0]/wnd[0]/usr/txtRSYST-BNAME
_SAPObjValueSet("usr/txtRSYST-BNAME","00008381")
;/app/con[0]/ses[0]/wnd[0]/usr/pwdRSYST-BCODE
_SAPObjValueSet("usr/pwdRSYST-BCODE","thanhnhan2007")

; Cach 2 - Khong hay
;Sleep(1000)
;Send("+{TAB 1}")
;send("117")
;send("{TAB}")
;Send("00008381")
;send("{TAB}")
;Send("thanhnhan2007")

send("{ENTER}")

;Waiting for the sreen "SAP Easy Access"
WinActivate("SAP Easy Access")

; Before running this script, ensure the "SAP Easy Access" window is open.
; Attach to the session with the window titled "SAP Easy Access"
_SAPSessAttach("SAP Easy Access")

; Put the value "/nmb52" into the command field.
_SAPObjValueSet("tbar[0]/okcd", "/nmb52")

; Press the "Enter" key.
_SAPVKeysSend("Enter")
; Set some fields 
; Field Plant: 9068
_SAPObjValueSet("usr/ctxtWERKS-LOW","9068")
; Field Layout: ALVD
_SAPObjValueSet("usr/ctxtP_VARI","ALVD")
; Press Enter then F8 to run this T-Code
_SAPVKeysSend("Enter")
_SAPVKeysSend("F8")
; Waiting for the sreen "Display warehouse stocks of material" 
WinActivate("Display Warehouse Stocks of Material")

; Press button to extract to Local file
;_SAPObjSelect("tbar[1]/btn[45]")
;Or
_SAPVKeysSend("Ctrl+Shift+F9")
WinActivate("Save list in file...")

_SAPSessAttach("Save list in file...")
;WinSetOnTop("Save list in file...", "", 1)
;$size = WinGetPos("[active]")
;MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
; Need to look into the following code
;WinActive("Save list in file...")
;/app/con[0]/ses[0]/wnd[1]/usr
;Thu cach 1
_SAPObjSelect("usr/sub:SAPLSPO5:0201")
_SAPObjSelect("usr/sub:SAPLSPO5:0201/radSPOPLI-SELFLAG[1]")
_SAPObjSelect("tbar[0]/btn[0]")


;/app/con[0]/ses[0]/wnd[1]/usr/sub:SAPLSPO5:0201/radSPOPLI-SELFLAG[1,0]
;Send("{DOWN}")
;_SAPObjSelect("usr/sub:SAPLSPO5:0201/radSPOPLI-SELFLAG[1,0]")
;_SAPObjValueSet("usr/sub:SAPLSPO5:0201/radSPOPLI","1")
;Press Enter
_SAPVKeysSend("Enter")
;Waiting for the sreen "Display Warehouse Stocks of Material"
WinActivate("Display Warehouse Stocks of Material")
; Set the File Name
_SAPObjValueSet("usr/ctxtDY_FILENAME","Stock_Temp.xls")
; Press the button Replace
_SAPObjSelect("tbar[0]/btn[11]")

; Waiting for the sreen "Display warehouse stocks of material" 
WinActivate("Display Warehouse Stocks of Material")
_SAPSessAttach("Display Warehouse Stocks of Material")
_SAPObjValueSet("tbar[0]/okcd", "/nend")
;Press Enter
_SAPVKeysSend("Enter")
WinActivate("Log Off")
_SAPSessAttach("Log Off")
Sleep(2000)
;/app/con[0]/ses[0]/wnd[1]/usr/btnSPOP-OPTION1
_SAPObjSelect("usr/btnSPOP-OPTION1")
;Send("{TAB}")
Send("{ENTER}")

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Hi Sean,

Thanks for this post.

I personally have been making some noobly scripts in autoit to run SAP and this should help me a lot however I have SAP gui 710 and receive this error:

Unable to find the window with title "SAP Easy Access" to attach to.
C:\Program Files\AutoIt3\Include\SAP.au3 (442) : ==> Variable must be of type "Object".:
$sap_session.findById("wnd[" & $sap_window_num & "]/" & $object_id).text = $object_value
$sap_session^ ERROR

I have check all prerequisites and even tried the modification suggested by B0ris however i continue to receive this error message.

Any ideas what i can do?

Thanks,

Negative1

Edited by Negative1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Share this post


Link to post
Share on other sites

Dear Sean,

I get the same problem with Negative1. Could you check.

Thanks and regards,

LVD

Hi Sean,

Thanks for this post.

I personally have been making some noobly scripts in autoit to run SAP and this should help me a lot however I have SAP gui 710 and receive this error:

Unable to find the window with title "SAP Easy Access" to attach to.
C:\Program Files\AutoIt3\Include\SAP.au3 (442) : ==> Variable must be of type "Object".:
$sap_session.findById("wnd[" & $sap_window_num & "]/" & $object_id).text = $object_value
$sap_session^ ERROR

I have check all prerequisites and even tried the modification suggested by B0ris however i continue to receive this error message.

Any ideas what i can do?

Thanks,

Negative1

Share this post


Link to post
Share on other sites

Hi Sean,

Thanks for the reply again, i got it partly working on the manintenance environment. The only problem is i can't save........

How do i save? Send keys dosn't work (with cntr + s) and how do i put this line in your UDF:

session.findById("wnd[0]/tbar[0]/btn[11]").press

Thanks for the help, after this i can work it all out. Thanks again.

Gtz,

Jeweetwel.

Hi Rody,

I'd love to give you an expert opinion on whether GUI scripting should be enabled in a production environment. I'm no SAP expert though. I've only been working with SAP for the past 12 months and only recently discovered how the SAP GUI scripting language could be integrated into AutoIT.

I can tell you this though. I work alongside some experienced SAP consultants here at my work, and after showing them the GUI scripting capability of SAP they have recommended it directly to our client, as a means of automating data entry into SAP from their legacy payroll system (in cases where the data migration may have failed). Other tools recommended to our client include SAP's fast entry transaction, and LSMW.

I can't see any downside in using it in production. In fact, it was put forward to out client as an alternative to the SAP scheduling tool "Redwood" (http://www.redwood.com/solutions/business/solutions-for-sap-customers).

The great thing about integrating SAP's GUI scripting with AutoIT is that you get to include AutoIT's powerful functions inside SAP. The combination of the two work really well. For instance, I have had issues synchonising windows using the native SAP GUI scripting VBS scripts. AutoIT's window functions fill in the gaps in this case.

Share this post


Link to post
Share on other sites

And now, looking in the UDF itself, i see this comment line, something i didn't know:

; NOTE - "F11" is the same as "CTRL+S"

So, tomorrow, i wil test it, but i'm sure, it will be the solution i am looking for. Thanks for the nice documented UDF!

Best regards,

Rody

Hi Sean,

Thanks for the reply again, i got it partly working on the manintenance environment. The only problem is i can't save........

How do i save? Send keys dosn't work (with cntr + s) and how do i put this line in your UDF:

session.findById("wnd[0]/tbar[0]/btn[11]").press

Thanks for the help, after this i can work it all out. Thanks again.

Gtz,

Jeweetwel.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now