Adapter for SAP 10.1 | webMethods Adapter for SAP Documentation | webMethods Adapter for SAP Installation and User’s Guide Documentation | Coding Client Applications and Services | Calling a BAPI Asynchronously from an SAP System
 
Calling a BAPI Asynchronously from an SAP System
 
Creating Similar Routing Notifications
Handling Inbound XML Message
Example of an XML
This example demonstrates how to call a BAPI asynchronously from an SAP system over the Web. For this purpose, you have to create an ABAP program inside the SAP system. This program calls the proxy function module to generate an ALE message for a BAPI. After performing a COMMIT WORKcommand, the SAP system will generate an IDoc through the ALE service layer and send it to Adapter for SAP. There the IDoc will be transformed into the original BAPI representation and sent as XML using HTTP to any remote web system.
Note:
While BAPI function module names usually start with the prefix BAPI_, the corresponding ALE proxies are usually named equally with the prefix ALE_
To run an example, you should set up your SAP system for ALE processing as described in the SAP system documentation and in this guide. When defining the partner profile for the outgoing IDoc in the SAP system, ensure that the option Transfer IDoc immediatelyis selected because the BAPI conversion tool on Adapter for SAP does not support IDoc packages.
Create the following report in your SAP system to test the BAPI conversion with the BAPI Bank.Create(available as of SAP release 4.6C).
REPORT Z_BAPI_ALE_DEMO .
parameters receiver like BDI_LOGSYS-LOGSYS.
parameters country like BAPI1011_KEY-BANK_CTRY default 'DE'.
parameters bankkey like BAPI1011_KEY-BANK_KEY default '34981255'.
data: receivers like BDI_LOGSYS occurs 0 with header line,
address like BAPI1011_ADDRESS.
*prepare the distribution information
move receiver to receivers-LOGSYS.
append receivers.
*prepare the BANK addres parameter
address-BANK_NAME = 'Demo Bank'.
address-REGION = 'BW'.
address-STREET = 'Neurottstr. 16'.
address-CITY = 'Walldorf'.
address-SWIFT_CODE = 'ABCDDE12'.
address-BANK_GROUP = 'SB'.
address-BANK_NO = '12345678'.
address-ADDR_NO = '123'.
*send data to ALE
CALL FUNCTION 'ALE_BANK_CREATE'
EXPORTING
BANKCTRY = country
BANKKEY = bankkey
BANKADDRESS = address
TABLES
RECEIVERS = receivers
EXCEPTIONS
ERROR_CREATING_IDOCS = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
write: / 'IDoc could not be created'.
ELSE.
write: / 'IDoc successfully created'.
ENDIF.
*trigger processing
commit work and wait.