cancel
Showing results for 
Search instead for 
Did you mean: 

Return Response fron BAPI

Former Member
0 Kudos

Hi..

I have scenario..which will post the data into R/3 side.

My source system is JDBC(SQlDatabase) ,and target system is BAPI(R/3).. after successfully insert the data into R/3, the return code should check success and failure message and based on that i should call commit and rollback BAPIs.

Please let me know let it be possible in XI?

Its appriciated and honour to eligible for points if you provide logical steps about this scenrio.

Thank you...

Regards..Rambarki!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Rambarki-

BAPI Commit needs to happen in the same LUW (Logical Unit of Work) as the main BAPI.

Hence, you need to have a wrapper module where in you will call the BAPI first, check the return parameter and then based of success you will call BAPI commit.

Here is a sample for creating customer master.

- Create a wrapper module 'Z_BAPI_WRAPPER'. Make sure the import, export etc. parameters are the same as customer master create BAPI.

- Inside this BAPI, call the customer master create BAPI. Check the Return structure for any errors

- If no error, call BAPI_COMMIT

From XI, you will call the wrapped module.

Additionally check SAP note 730870.

Let me know if you need more info.

KK

Former Member
0 Kudos

KK

Thanks for timely suggestion...and it could be more help for me,if you provide detail steps for creating Wrapper module ,because i'm in lit.bit confusion in creating Wrapper modules.

Thank you Once again.

Regards..Rambarki!

Former Member
0 Kudos

Hi Rambarki,

Which service pack you are working on ?

If you are on SP14 then you need not create a wrapper, you can use standar SAP feature to do this.

**********************

http://help.sap.com/saphelp_nw04/helpdata/en/c8/e80440a832e369e10000000a155106/content.htm

Commit Control for Individual BAPI Calls

If you want to use this communication channel to call BAPIs as remote-enabled function modules that change data in the database, set the indicator.

If executed successfully, the transaction is written to the database by calling the function module BAPI_TRANSACTION_COMMIT explicitly. If an error occurs, the transaction is rolled back by BAPI_TRANSACTION_ROLLBACK.

The result is determined by the value of the field TYPE in parameter RETURN. If successful, the tables are empty and the values “”, “S”, “I”, and “W” are displayed. All other values are regarded as errors.

To change this setting, set the indicator BAPI Advanced Mode.

In the Successful RETURN-TYPE Values table, enter the values that should lead to a successful execution.

**************************

If your working on service pack <SP14 then refer the link below...this will help you in creating a wrapper..

https://websmp203.sap-ag.de/~sapdownload/011000358700000328352005E/HowtouseBAPandccBPM.pdf

Regards

Anand

Former Member
0 Kudos

Thanks Anand,

Yes we are using SP14, and if you dont mind please give clear clarity of your words.of follwing..!

"The result is determined by the value of the field TYPE in parameter RETURN. If successful, the tables are empty and the values “”, “S”, “I”, and “W” are displayed. All other values are regarded as errors."

Thank you for timely response..

Regards..Rambarki

Former Member
0 Kudos

Hi Rambarki,

Check SAP note note 730870 - Question 10 for more information..

As of SP 14 support for commit handling for single BAPI calls was added to the RfcAdapter receiver channel. If activated in the receiver channel setting, the received XI message will be executed as synchronous RFC (sRFC) in the receiving system. This is also true for asynchronous (QoS EO) XI messages to receive and analyze the execution result by the RfcAdapter.

The received response is parsed by the RfcAdapter to get the BAPI return parameter with name "RETURN". This return parameter can be of BAPIRETURN, BAPIRET1 or BAPIRET2 types. The "RETURN" parameter is checked for the response status (field TYPE) which can take following values:

1. 'S' : Success

2. 'I' : Information

3. 'W' : Warning

4. '' : Empty String

5. 'A' : Abort

6. 'E' : Error

If the response contains one amongst the first four response status then it implies that the BAPI was successful. If the response contains one amongst the last two response then the BAPI failed. If the BAPI "RETURN" parameter is of not of type ABAP structure rather of type ABAP table, a empty table is also considered as successful execution result.

In case of a successful execution the BAPI function module "BAPI_TRANSACTION_COMMIT" is called within the same context to trigger the commit of the BAPI. In case of a failure the BAPI function module "BAPI_TRANSACTION_ROLLBACK" is executed by RFC Adapter which rolls back the changes.

If the XI request message was of QoS BE, the result of the BAPI execution is send back as XI response. In case of a QoS EO request message nothing is send back as response.

Regards

Anand

Former Member
0 Kudos

Hi Anand,

ur extremely great..thanks for brief explanation..let me try ...if i required any thing i'll let you know.Still you need to pass any suggestions ..please share!

regards..rambarki

Former Member
0 Kudos

The explanation is from SAP note specified, the complete explanation is avilable in the same note and help.sap.com. I have not yet tried this feature, as I am still working on SP12.

Hope this works for you without any issues.

Regards

Anand

Former Member
0 Kudos

Hi Anand,

we have SP14 installed. But I coudn't find the indicator

for "Commit Control for Individual BAPI Calls" in the

"Advanced Mode" of the Receiver RFC Adapter.

Do you know why?

There is only the table for applying parameters.

Best Regards

Wolfgang

stefan_grube
Active Contributor
0 Kudos

Hi Wolfgang,

when this parameter is missing, you might have to update the "XI Content" from service marketplace.

Look out for: XI CONTENT SAP_BASIS 6.40

Upload this into your Integration Repository.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

thank you very much!! Now I see the parameters.

Best Regards

Wolfgang