Quantcast
Channel: SCN : Discussion List - Scripting Languages
Viewing all 325 articles
Browse latest View live

Loop does not work on VBA Script

$
0
0

Hi Guys,

 

I'm having troubles when I try to execute the script below. The first input works fine, but the loop does not.

 

Somebody has a clue what is wrong on the code listed below?

 

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

Dim ApplicationPath, CredentialsPath, ServerPath, FilePath
Dim ExcelApp, ExcelWorkbook, ExcelSheet, Row
Set ExcelApp = CreateObject("Excel.Application")
Set ExcelWorkbook = ExcelApp.Workbooks.Open("C:\temp\Excel_File.xls")
Set ExcelSheet = ExcelWorkbook.Worksheets(1)

Row = 1

Do Until ExcelSheet.Cells(Row,1).Value = ""

session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "mysaplogin"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "*******"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").setFocus
session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 10
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[1]").sendVKey 0
session.findById("wnd[0]/tbar[0]/okcd").text = "fd32"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/chkRF02L-D0210").selected = true
session.findById("wnd[0]/usr/ctxtRF02L-KUNNR").text = ExcelSheet.Cells(Row,1).Value
session.findById("wnd[0]/usr/ctxtRF02L-KKBER").text = ExcelSheet.Cells(Row,2).Value
session.findById("wnd[0]/usr/ctxtRF02L-KKBER").setFocus
session.findById("wnd[0]/usr/ctxtRF02L-KKBER").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/mbar/menu[0]/menu[5]/menu[1]").select
session.findById("wnd[1]/usr/btnSPOP-OPTION1").press
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[1]").sendVKey 0

 

Row=Row+1
Loop
ExcelApp.Quit
Set ExcelApp = Nothing
Set ExcelWorkbook = Nothing
Set ExcelSheet = Nothing


SAP SCRIPTING AND PLAYBACK

$
0
0

I HAVE AN QUESTION HOW WE CAN AUTOMATE TO RUN ONE T-CODE WITH MULTIPLE VARIANTS ONE EACH AND EXPORT IT INTO SEPARATE EXCEL FILE.(ALL VARIANT SHOULD BE RUN PARALLELY, MAX:6)

Create script for get current year

$
0
0

Good day!

I need a help please .

 

How do i get the current year, keep in a variable and then write in a text field ?

 

Thanks!

Excel VBA: How to bind to an active SAP session object?

$
0
0

 

 

Hi all,

 

I'm using VBA in Excel 2010 to open SAPlogon 720 using the codes below.

 

Let say I've run the script once, I'm connected to the SAP server and have one active SAP session, how do I prevent the script from creating another session when I run it again?

 

Have been reading the Scripting API help file and searching the internet but no hint yet.

 

Hope someone can help me with this. Really appreciate it.

 

Thanks,

MSA

 

Option Explicit
Public SAP As Object
Public SAPGui As Object
Public SAPCon As Object
Public SAPSession As Object
'run saplogon if it is not running
Sub OpenSAP()    Dim SAPTaskID As Double    Dim SAPLogonPad As String    SAPLogonPad = "C:\Program Files\SAP\FrontEnd\SAPgui\saplogon.exe"    On Error Resume Next    AppActivate "SAP Logon 720"    If Err <> 0 Then        Err = 0        SAPTaskID = Shell(SAPLogonPad, vbMinimizedNoFocus)        If Err <> 0 Then            MsgBox "Cannot start SAPLOGON", vbCritical, "SAPLOGON FAILED"        Else            MsgBox "SAP Logon activated " & SAPTaskID, vbInformation, "SAP Running"        End If    End If
End Sub
 Sub SAPLogon()    Call OpenSAP           AppActivate (ThisWorkbook.Name)    Static sapID As String    Static sapPassword As String    If sapID = "" Or sapPassword = "" Then        With loginSAP 'a userform to get the sap id and password        .Show        sapID = .SAPuser        sapPassword = .SAPPass        End With    End If         If SAPGui Is Nothing Then        Set SAP = GetObject("sapgui")        Set SAPGui = SAP.GetScriptingEngine    End If        If SAPCon Is Nothing Then        Set SAPCon = SAPGui.OpenConnectionByConnectionString("xxx.xxx.xxx.xxx", True)    Else      '(what should I put here to call the SAPCon object already declared from previous run?)     End If        If SAPSession Is Nothing Then       Set SAPSession = SAPCon.Children(0)        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        End With    Else      '(how do I call the Session already running from previous call to this script?)     End If
End Sub

Run VBS script when logged through SAP shortcut

$
0
0

Hi Experts,

 

 

I have created a desktop shortcut to access the SAP ECC environment, similar as described on this wiki: https://wiki.scn.sap.com/wiki/display/ABAP/SAPGUI+shortcuts

 

Then, when I do the login through this shortcut, the script below simple does not work.

 

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 = "/nMM03"

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

 

 

 

The error is:

 

Windows Script Host

Script: C:\temp\Script5.vbs

Line: 2

Charact.: 4

Error: Invalid Syntax

Code: 800401E4

Source: (null)

 

 

It seems that the GetObject("SAPGUI") function returns Nothing, then the Set statement does not work.

When I do the login through saplogon, it works just fine.

 

 

Has anyone experienced this before? Any ideas?

 

 

Tks

Darley

I am new and wondering is there a way to Run SAP scripts from Google sheets?

$
0
0

The input from excel works great but i was wondering if the same can be achieved from google sheet ?Experts advise will be appreciated

Working with GuiTableControl in Excel vba

$
0
0

Hi all,

 

I have a requirement to strip the contents of a GuiTableControl from SAP. The transaction KO03 doesn't have a download function enabled & some of the tables have many lines, making Ctrl+Y to copy'n'paste data manually very tedious & potentially error prone.

 

I have some code, where I count the total rows (.RowCount) visible rows (.VisibleRowCount), as well as the columns (.Columns.Count). Then I loop to populate an array of the now correct size with the contents of the cells, paging down once I hit the visible row limit & stopping at the total row limit. I then paste that into a spreadsheet. 

 

ultimately it works well enough for this specific example, but it currently requires that I specify the column ids in each loop. IE

1st column is tblSAPLKOBSTC_RULES/ctxtCOBRB-KONTY[0,0]

2nd column is tblSAPLKOBSTC_RULES/ctxtDKOBR-EMPGE[1,0]

etc

 

I'd like to make this snippet fairly reusable with minimal adjustment, is there a way to make this generic, so that I only need to loop over the array of displayed cells in the GuiTableControl without having to reference the individual ID's? Or maybe detect the cells ID's & have that as a variable at runtime?

 

Any insights gratefully received.

 

Cheers
Daniel

Trapping the Save warning?

$
0
0

Hi All,

 

If I am running a script and the SAP window that is being used currently has a open item (eg work order) that has been edited but not saved, is there any way to trap the 'Do you want to save the data entered?' warning that appears and give the user an option to do that, even if that means terminated the script to allow them to attend to this before they run the script again... 

 

My script is currently ignoring this and not saving the editing data but I would like to alert the user before I hijack that window.

 

Thanks

 

Steve.


How to capture the text in recording which is not a field in SAP

$
0
0

Hi scriptman,

 

I am trying to extract the details from SAP and paste it in the excel.I had recorded the scripting and i was able to paste the details which are related to the fields in VA03 t-code.But the credit memo number which will come in the next screen as document flow was not able to record in the script when i tried coping it.i came to know that as this is not a field its not getting recorded.Please hep me out in how to capture that events and paste it in excel.

 

Regards,

Sai

How to make script recorded work with other Windows

$
0
0

Hi,

 

Im quite new with SAP and i tried to record a script to download some reports, the script is working well in my laptop, but doesnt in the other, the problem as i know is about the SAP Window session size, its not the same with the one i have recorded in my Laptop.

 

And yes, the report does not have any T-Code to access to.

 

Is there any way to fix it?

 

I Tried both maximize, resizeWorkingPane false or true. And as i know its clicking to the node

 

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]").resizeWorkingPaneEx 1131,1092,false

Session.FindById("wnd[0]/tbar[0]/okcd").Text = "/nSRET"

Session.FindById("wnd[0]").SendVKey 0

Session.FindById("wnd[0]/usr/lbl[5,11]").SetFocus 'First Node

Session.FindById("wnd[0]").SendVKey 2

Session.FindById("wnd[0]/usr/lbl[9,20]").SetFocus 'Second Node'

Session.FindById("wnd[0]").SendVKey 2

Session.FindById("wnd[0]/usr/lbl[13,34]").SetFocus 'Third Node

Session.FindById("wnd[0]").SendVKey 2

Session.FindById("wnd[0]/usr/lbl[20,37]").SetFocus 'This node has failed coz wrong node i need

Session.FindById("wnd[0]").SendVKey 2

Unable to Save documents thru VBA from VF03

$
0
0

Hi,

 

I am new in scripting VBA. Need help here. I want to download Invoice copies thru VF03 and save it a desktop or any specific folder.Filw should be saved with Invoice name which will be picked up from range as per loop.

 

Have generated below loop but unable to save further.

 

Sub Download_Invoices()

 

 

'Initiate SAP

If Not IsObject(SapGuiAuto) Then

   Set SapGuiAuto = GetObject("SAPGUI")

   Set sapapplication = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(Connection) Then

   Set Connection = sapapplication.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

 

 

'SAP Initiated

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

session.findById("wnd[0]/tbar[0]/okcd").Text = "/nVF03"

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

 

 

i = 2

Do While (Cells(i, 1).Value <> "")

session.findById("wnd[0]/usr/ctxtVBRK-VBELN").Text = Cells(i, 1).Value

session.findById("wnd[0]/usr/ctxtVBRK-VBELN").caretPosition = 10

session.findById("wnd[0]/mbar/menu[0]/menu[11]").Select

session.findById("wnd[1]/usr/tblSAPLVMSGTABCONTROL").getAbsoluteRow(0).Selected = False

session.findById("wnd[1]/usr/tblSAPLVMSGTABCONTROL").getAbsoluteRow(1).Selected = True

session.findById("wnd[1]/usr/tblSAPLVMSGTABCONTROL/txtNAST-KSCHL[0,1]").SetFocus

session.findById("wnd[1]/usr/tblSAPLVMSGTABCONTROL/txtNAST-KSCHL[0,1]").caretPosition = 0

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

session.findById("wnd[0]/tbar[0]/okcd").Text = "PDF!"

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

 

 

i = i + 1

Loop

End Sub

 

Save.JPG

Upload attachment in SAP transaction code FB03

$
0
0

Hi Script Gurus,

 

I am currently trying to automate attaching of pdf copies of invoices to FB03. I am almost done with my code but having problem with the separate vbs (Script1.vbs) i created.

 

ActiveSheet.Range("D" & i).Value is the path of the file that i want to upload but since i have a lot of invoices to attach, i want the script to capture what is in the column D. But when i try below code, i am encountering error Object required:'Activesheet'. i tried putting Dim Activesheet but not successful.

if i specify the path and put Wshell.sendkeys "1234.pdf", its working. Please help.


Below are my codes.


 

Main Macro:

 

session.findById("wnd[0]/tbar[0]/okcd").Text = "/nfb03"

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

Do While ActiveSheet.Range("B" & i) <> ""

session.findById("wnd[0]/usr/txtRF05L-BELNR").Text = ActiveSheet.Range("B" & i).Value 'docnumber

session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").Text = ActiveSheet.Range("C" & i).Value 'companycode

session.findById("wnd[0]/usr/txtRF05L-GJAHR").Text = ActiveSheet.Range("D" & i).Value 'year

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

session.findById("wnd[0]/titl/shellcont/shell").pressButton "%GOS_TOOLBOX"

session.findById("wnd[0]/shellcont/shell").pressContextButton "CREATE_ATTA"

 

 

Set WShell = CreateObject("WScript.Shell")

WShell.Run "C:\Users\" & Format(Environ("USERNAME"), ">") & "\Desktop\Script1.vbs", 1, False

 

 

session.findById("wnd[0]/shellcont/shell").SelectContextMenuItem "PCATTA_CREA"

 

 

 

Script1.vbs:

 

Set Wshell = CreateObject("WScript.Shell")

Do

bWindowFound = Wshell.AppActivate("Import file")

WScript.Sleep 1000

Loop Until bWindowFound

bWindowFound = Wshell.AppActivate("Import file")

if (bWindowFound) Then

Wshell.appActivate "Import file"

WScript.Sleep 100

Wshell.sendkeys "{ENTER}"

WScript.Sleep 100

Wshell.sendkeys ActiveSheet.Range("D" & i).Value

WScript.Sleep 100

Wshell.sendkeys "{ENTER}"

WScript.Sleep 100

end If

 

 

Thank you in advance!

Mike

[VBA] Reading data in non-editable fields

$
0
0

Hi everyone,

 

I'm looking for a way for my VBA script to read the content of greyed out fields in VA01.

Example:

 

1.PNG

 

Normally I am able to find the path by recording myself editing the cell content in SAP:

 

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4401/subSUBSCREEN_TC:SAPMV45A:4900/tblSAPMV45ATCTRL_U_ERF_AUFTRAG/ctxtRV45A-MABNR[1,1]).Text = "1"

Afterwards I can simply fill an Excel cell with the data:

 

Sheets("X").Cells(y, z) = session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4401/subSUBSCREEN_TC:SAPMV45A:4900/tblSAPMV45ATCTRL_U_ERF_AUFTRAG/ctxtRV45A-MABNR[1,1]).Text

 

However, this method does not work for the locked fields that I cannot edit since they won't show up in my recording.

Even when I check what table the desired data lies in and replace "RV45A-MABNR" with the correct table and [1,1] with right position I get nothing.

How can I work around that? Your help would be greatly appreciated.

How to ignore SAP warning messages and continue untill warning messages end

$
0
0

Hi, I am trying to record a script to remove confirmations on LTA's in ME38, these are confirmations that have been passed from SNC.

I can easily find the required line item and pull from an excel sheet to tell SAP what LTA to modify but as the confirmations are not consistent in each LTA, i.e. volume and cells there is not always the same number of error messages in each LTA.

 

I am looking for code to enter through or ignore these yellow error messages and then save the LTA.

 

First of all is it possible, if so I would be much appreciated if you can advise on this code.

 

Thanks in advance.

SAPMoveDimension not working

$
0
0

Hello,

 

I am currently working on a Macro in VBA Excel that should, given a Tabel exported from SAP, format it with the right dimensions and filters automatically. I have found the exact solutions I am looking for here:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/003ebe5e-f382-2e10-ddab-cf5d408be00f?QuickLink=index&…

[PAGE 14]

 

However I have tried this multipe times but it does not work. If you have any advice why this is not working I would be very thankful. Or any other method that could work.

 

I am an absolute beginner with VBA and SAP, thus this might seem as a very easy task... I am not sure what official name i need to input for the dimension (in this example he inputs "0CALYEAR" and the label is Calendar Year, I am supposing that this might be the issue)

 

Thank you!


insert VBA code in SAP Script

$
0
0

Hi,

 

I have a question if possible to insert VBA code that will copy data in range A:A(from book1 file)to paste in sap tcode zse16 table MARC

 

Thank you and have a nice day.

 

 

SAP SCRIPT HERE:

 

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]").resizeWorkingPane 105,29,false

session.findById("wnd[0]/tbar[0]/okcd").text = "zse16"

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

session.findById("wnd[0]/usr/ctxtI_TABLE").text = "marc"

session.findById("wnd[0]/usr/ctxtI_TABLE").caretPosition = 4

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

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

session.findById("wnd[1]/usr/chk[2,7]").selected = true

session.findById("wnd[1]/usr/chk[2,7]").setFocus

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

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

session.findById("wnd[1]/usr/txtV-LOW").text = "marc dl"

session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 7

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

session.findById("wnd[0]/usr/btn%_I1_%_APP_%-VALU_PUSH").press

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

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

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

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

 

 

INSERT copy paste VBA here. This should paste material codes in multiple selection(sap)

 

 

 

 

 

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

session.findById("wnd[1]/usr/chk[1,4]").selected = true

session.findById("wnd[1]/usr/chk[1,5]").selected = true

session.findById("wnd[1]/usr/chk[1,6]").selected = true

session.findById("wnd[1]/usr/chk[1,6]").setFocus

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

session.findById("wnd[0]/tbar[0]/okcd").text = "%pc"

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

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus

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

session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "a6p.xls"

session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 7

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

the control could not be found by id

$
0
0

Hi, how are you!

I would run the script to process many script entries below, but this giving error: The control could not be found for id.The code does not go into loop. Run only one entry.

 

How can I run varies entries?

 

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]/usr/ctxtP_MUNIC").text = ""

session.findById("wnd[0]/usr/ctxtP_STCD").text = "201387"

session.findById("wnd[0]/usr/ctxtP_STCD").caretPosition = 6

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

session.findById("wnd[1]/usr/btnBUTTON_1").press

 

Thank you so much!

 

Alysson

Insert VBA code in a SAP script

$
0
0

Hi,

 

I have a question if possible to insert VBA code that will copy data in range A:A(from book1 file) to this script. Data in range A are material codes in thousands. So that SAP will execute the query automatically.

 

Thank you and have a nice day.

 

 

SAP SCRIPT HERE:

 

If Not IsObject(SAPguiApp) Then
Set SAPguApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SAPguiApp.OpenConnection("A6P(HK/TW) - SSO", True)
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]").resizeWorkingPane 105,29,false

session.findById("wnd[0]/tbar[0]/okcd").text = "zse16"

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

session.findById("wnd[0]/usr/ctxtI_TABLE").text = "marc"

session.findById("wnd[0]/usr/ctxtI_TABLE").caretPosition = 4

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

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

session.findById("wnd[1]/usr/txtV-LOW").text = "marc dl"

session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 4

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

 

VBA code here

 

session.findById("wnd[0]/usr/btn%_I1_%_APP_%-VALU_PUSH").press

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

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

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

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

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

session.findById("wnd[1]/usr/chk[1,4]").selected = true

session.findById("wnd[1]/usr/chk[1,5]").selected = true

session.findById("wnd[1]/usr/chk[1,6]").selected = true

session.findById("wnd[1]/usr/chk[1,6]").setFocus

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

session.findById("wnd[0]/tbar[0]/okcd").text = "%pc"

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

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select

session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus

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

session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "a6p.xls"

session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 7

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

Need help to convert script from VBS to VBA (Excel Macro).

$
0
0

Please help me to convert the following script from VBS to VBA (Excel Macro). Instead of open SAP log on and type User and Password every day. I want it to open it from an excel file.

Here is the current script I have, but for some reason the SAP popup screen does not remain open and the excel does not work after running it.

 

Sub LOGONSAP()

If Not IsObject(SAPguiApp) Then

    Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")

End If

If Not IsObject(Connection) Then

    Set Connection = SAPguiApp.OpenConnection("MYSYSTEM", True)

End If

If Not IsObject(session) Then

   Set session = Connection.Children(0)

End If

session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "MYUSER"

session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "MYPSSW"

session.findById("wnd[0]/usr/pwdRSYST-BCODE").SetFocus

session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 2

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

End Sub

SAP - PHP integration

$
0
0

I am using SAPRFC library to integrate SAP with PHP, and it is very slow when I call the RFC for the first time.. is there a way to make it fast.

 

 

 

Also what is the best way to integrate SAP with PHP ?

 

 

thanks

Viewing all 325 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>