Jump to content

Recommended Posts

Posted

I had to automate the SAP GUI myself - until the problem was solved by exporting the data to a text file yb the SAP Guys.

After doing some research I came to the conclusion that the SAP UDF you mentioned above is the only proper way to automate SAP.

If your company wants you to do the job by automating SAP they have to provide the tools you need (enable SAP scripting etc.)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 1 month later...
Posted

Hello Aber and Water,

there are a few ways to communicate with an SAP system. SAP GUI Scripting is only one to automate your user input.

My suggestion is the same as Waters: Talk with your admin to enable SAP GUI Scripting on the application server you need. With the TAC RZ11 he must set the value from the parameter sapgui/user_scripting to TRUE. And activate the option Scripting in your local SAP GUI Logon. If it is also not possible, talk with your admin too. There is no way around this security options.

You can use SAP GUI without enabled SAP GUI Scripting, you find a few (older) examples in my knowledge collection - Tips for AutoIt. But it is not comfortable and if there are some changes in the UI, it could be problematically.

With AutoIt you can also use the SAP GUI ActiveX components or the SAP NetWeaver RFC SDK, if you know the RFC function modules or BAPI interfaces.

Cheers

Stefan

  • 2 months later...
Posted

Hello, Stefan

I wonder if it is possible to manipulate the field values ​​of a transaction through the AutoIt, it would be asking too much if you post an example? Or some site that teaches how to do.

Note: Through GuiXT could see that the field names and their values ​​appear on the screen, this is what I ask above.

Thankful.

Márcio.

I am Brazilian, I live and work in Brazil.

Excuse me if there are errors, I'm using Google Translator.

Posted

Use AutoIt's Window Info Tool to check if SAP uses Controls that can be accessed by AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 1 month later...
Posted

Hello Márcio,

sorry for my late answer.

With SAP GUI Scripting you can automatically manipulate nearly all objects of SAP GUI for Windows, also field values.

Here an example how to use the ok-field:

;-Begin-----------------------------------------------------------------

  ;-Variables-----------------------------------------------------------
    Dim $SAPROT, $SapGuiAuto, $application, $connection, $session

  $SAPROT = ObjCreate("SapROTWr.SAPROTWrapper")
  If Not IsObj($SAPROT) Then
    Exit
  EndIf

  $SapGuiAuto = $SAPROT.GetROTEntry("SAPGUI")
  If Not IsObj($SapGuiAuto) Then
    Exit
  EndIf

  $application = $SapGuiAuto.GetScriptingEngine()
  If Not IsObj($application) Then
    Exit
  EndIf

  $connection = $application.Children(0)
  If Not IsObj($connection) Then
    Exit
  EndIf

  $session = $connection.Children(0)
  If Not IsObj($session) Then
    Exit
  EndIf

  $session.findById("wnd[0]/tbar[0]/okcd").text = "/nse16"
  $session.findById("wnd[0]").sendVKey(0)

;-End-------------------------------------------------------------------

To analyze SAP GUI and to find out the IDs and names of the objects look here http://scn.sap.com/docs/DOC-32728 and here http://scn.sap.com/docs/DOC-40265 > cool AutoIt analyzer.

Hope it helps a little bit.

Cheers

Stefan

  • 1 year later...
Posted

Hi all,

When I use the following script

 

;-Begin-----------------------------------------------------------------

 
  ;-Variables-----------------------------------------------------------
    Dim $SAPROT, $SapGuiAuto, $application, $connection, $session
 
 
  If Not IsObj($SAPROT) Then
 
  $SAPROT = ObjCreate("SapROTWr.SAPROTWrapper")
  EndIf
 
 
  If Not IsObj($SapGuiAuto) Then
  $SapGuiAuto = $SAPROT.GetROTEntry("SAPGUI")
  EndIf
 
 
  If Not IsObj($application) Then
  $application = $SapGuiAuto.GetScriptingEngine()
  EndIf
 
 
  If Not IsObj($connection) Then
  $connection = $application.OpenConnection("XXXXXXXXX")
  EndIf
 
;  $session = $connection.Children(0)
;  If Not IsObj($session) Then
;    Exit
;  EndIf
 
  $session.findById("wnd[0]/tbar[0]/okcd").text = "/nse16"
  $session.findById("wnd[0]").sendVKey(0)
 
;-End-------------------------------------------------------------------
 
 
------ Error Msg ----------
 
"C:\Program Files (x86)\AutoIt3\Include\SAP_GenFunc.au3" (56) : ==> Variable must be of type "Object".:
$connection = $application.OpenConnection("xxxxxxxx")
$connection = $application^ ERROR

 

 

Can somebody help me, please.

Thanks

Posted

Hello everyone

I got the resolution.  All I did is launch the SAP Logon pad as "Run as Administrator".  I tried on Windows 8 (Laptop).

Here is the code

Local $sapapp, $sap_connection, $sap_session

Local $sap_connection_url = "XX_XXX_XXXX"
 
If Not IsObj($sapapp) Then
$sapgui = ObjGet("SAPGUI")
$sapapp = $sapgui.GetScriptingEngine
EndIf
 
 
If Not IsObj($sap_connection) Then
$sap_connection = $sapapp.Openconnection($sap_connection_url, True)
EndIf
 
 
If Not IsObj($sap_session) Then
$sap_session = $sap_connection.Children(0)
EndIf
 
 
 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...