Jump to content

Recommended Posts

Posted

Hi All,

        I have created one script in this i logon to sap but i want first logon then log off and then logon and log off.My code working for one time logon and log off but its not working multiple.

 

Please help me

 

Regards

Mukesh

Posted

#include <Misc.au3>
#include <SAP.au3>
#include <IE.au3>
_IEErrorHandlerRegister()


$SAPVersion = "SAP Logon 640"
run("C:Program FilesSAPFrontEndSAPguiSAPlogon.Exe")
Sleep(2000)
if WinActive($SAPVersion) = False Then
$SAPVersion = "SAP Logon 720"
EndIf
Local $file = FileOpen("test.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
   Local $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $line)
sleep(1000)

_SAPSessAttach("SAP")
 ;_SAPObjValueSet("usr/txtRSYST-MANDT","200")
_SAPObjValueSet("usr/txtRSYST-BNAME","test")
_SAPObjValueSet("usr/pwdRSYST-BCODE","password")

_SAPVKeysSend("Enter")
WinActivate("Log Off")
_SAPSessAttach("Log Off")

WEnd

FileClose($file)

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...