Found 4 Articles for VBA

How we can extract data using VB Scripting from SAP

SAP ABAP Expert
Updated on 30-Jul-2019 22:30:20

455 Views

You can use VBA for fetching data from SAP. You can find lot of blogs if you search online.If I explain in short, it depends on the level of access that you have to SAP system. I have done something similar in past. It worked like this; I had an existing RFC which will fetch the required data for me and for some part I had an ABAP program in place to fetch the data.Then I will use macros to make a call to respective RFC and program to do their job.

Print screen using VBA in SAP

Swarali Sree
Updated on 16-Dec-2019 07:51:47

583 Views

If you are using SendKeys then avoid using it. I had used it in the past project and it seems to be inconsistent and error-prone.You can use the below snippet at the top of the module and call it wherever required.Option Explicit Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _bScan As Byte,  ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Const KEYEVENTF_KEYUP = &H2 Private Const VK_SNAPSHOT = &H2C Private Const VK_MENU = &H12 Sub PrintScreen()     keybd_event VK_SNAPSHOT, 1, 0, 0  End Sub

Exporting data from SAP system to an Excel Report

Smita Kapse
Updated on 30-Jul-2019 22:30:20

595 Views

You can write an ABAP program for exporting the data from SAP and then use a remote function call which can be invoked my macro to fetch the data. Also, you can go for creating the file itself if that fits the requirement.You can also opt for SAP GUI Scripting as an alternative. The scripting framework allows you to automate the interface for Windows and Java. It can let you perform a lot of activities.Scripting API provides you with the good number of scriptable objects which wraps the SAP GUI objects. You can use these objects from macros. SAP GUI ... Read More

Using VBA macro to call an ABAP code

Amit Sharma
Updated on 14-Feb-2020 11:18:55

411 Views

Please try using below script −Dim sapConn As Object \Declaring a connection object Set sapConn = CreateObject("SAP.Functions") \Creating an ActiveX object sapConn.Connection.user = "username" sapConn.Connection.Password = "xxxx" sapConn.Connection.client = "client#" sapConn.Connection.ApplicationServer = "Application Server” sapConn.Connection.Language = "PT" If sapConn.Connection.Logon(0, True) True Then //Checking connection here    MsgBox "Not able to login to SAP" Else    MsgBox "Login Successful !!" End If Dim rfcAcctDocCheck As Object Dim oAcctHeader As Object Dim otAcctAR, otAcctGL, otAcctAP, otAcctAMT, otReturn As Object Set rfcAcctDocCheck = sapConn.Add("BAPI_ACC_DOCUMENT_CHECK") Set oAcctHeader = rfcAcctDocCheck.Exports("DOCUMENTHEADER") Set otAcctGL = rfcAcctDocCheck.Tables("ACCOUNTGL") Set otAcctAR = rfcAcctDocCheck.Tables("ACCOUNTRECEIVABLE") Set otAcctAP = ... Read More

1
Advertisements