Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Passing Error message to BAPI Structure in RFC

Former Member
0 Likes
1,521

Hi Experts,

I would like to know how we pass error message to BAPI structurre in RFC?

Plz some one give the details about how we handle the errors.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Sm1tje
Active Contributor
0 Likes
951

Like already mentioned before, every Standard SAP BAPI, has an export or tables parameter which is called something like RETURN with structure BAPIRET2. In here, you can store all the messages that are generated during the BAPI Call.

However, if you also want to catch errors like system exceptions and communication errors, you will have to add these exceptions manually:

EXCEPTIONS

SYSTEM_FAILURE = 1 MESSAGE RFC_MESS

COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.

However, not sure if this addition works when calling BAPI from NON-sap application.

Declaration:

DATA: RFC_MESS(128).

Like already mentioned before, every Standard SAP BAPI, has an export or tables parameter which is called something like RETURN with structure BAPIRET2. In here, you can store all the messages that are generated during the BAPI Call.

However, if you also want to catch errors like system exceptions and communication errors, you will have to add these exceptions manually:

EXCEPTIONS

SYSTEM_FAILURE = 1 MESSAGE RFC_MESS

COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.

However, not sure if this addition works when calling BAPI from NON-sap application.

Declaration:

DATA: RFC_MESS(128).

3 REPLIES 3
Read only

Former Member
0 Likes
951

hi:

In RFC function module, there should have an export parameter like BAPIRETURN

which would carry the error message.

Regards

Shashi

Read only

Sm1tje
Active Contributor
0 Likes
952

Like already mentioned before, every Standard SAP BAPI, has an export or tables parameter which is called something like RETURN with structure BAPIRET2. In here, you can store all the messages that are generated during the BAPI Call.

However, if you also want to catch errors like system exceptions and communication errors, you will have to add these exceptions manually:

EXCEPTIONS

SYSTEM_FAILURE = 1 MESSAGE RFC_MESS

COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.

However, not sure if this addition works when calling BAPI from NON-sap application.

Declaration:

DATA: RFC_MESS(128).

Read only

Former Member
0 Likes
951

Use table BAPIRET2 to get the error messages, when you are using BAPI as RFC you will not get return parameters. You have to call it in synchronous task and wait till the BAPI returns and catch the errors.