cancel
Showing results for 
Search instead for 
Did you mean: 

FILE TO BAPI :- how to filter only the error responses from BAPI

Former Member
0 Kudos

Dear Experts,

I am working on a synshronous file to rfc ( BAPI) scenario.

Sender will drop the required file on XI directory and XI will pull the file and map it with the BAPI u2013 and crate service entries in SAP SCM. If errors are encountered during the process they are returned to the client in a report or as erroneous file.

1) sender will FTP the file to XI directory

2) XI will send the file after validation with BAPI for time entry creation in SAP R/3.

3) If there is an error encountered XI will get an error response from BAPI

4) The erroneous file is sent to XI directory for client to view

This is the whole design. I have developed teh whole scenario.

Question is: From SAP R/3, if error response is coming then we are supposed to write in a file and keep on to some location.

If response is successful then need not write to the files, only for error responses we have to write on the files and give it to the client. How do we filter teh response messages as it will contain both the successful nad un successful messages and we are only interested to get teh error responses.

Please help me with this. I will appreciate each and every answer.

Thanks

Veeru

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member200962
Active Contributor
0 Kudos
If response is successful then need not write to the files, only for error responses we have to write on the files and give it 
to the client.

I think this needs to be done using a BPM......in the response mapping from RFC if you try to check it using IF-ELSE then either you wont get any structure on the target end (which will cause an error in XI) or it may create an empty file at the target in case of success....so instead get the response in the BPM....do a check using SWITCH....if success cancel the process without any error/ alert.....if error then create the file.

Regards,

Abhishek.

Former Member
0 Kudos

@ Abhishek

may create an empty file at the target in case of success

In receiver file adapter, you can Select the Handling of Empty Messages:

○ Write Empty File

An empty file (length 0 bytes) is put in the target directory.

○ Ignore

No file is put in the target directory.

http://help.sap.com/saphelp_nw04/Helpdata/EN/bc/bb79d6061007419a081e58cbeaaf28/content.htm

Regards,

Siva Maranani

former_member200962
Active Contributor
0 Kudos

Only if the mapping does not fail while creating an empty target (without any structure).

Former Member
0 Kudos

The BAPI will send you all messages in return table (BAPIRET1).

In your mapping, you can filter (by using If-Else function) the error messages (Type-E) from other messages. [Message type: S Success, E Error, W Warning, I Info, A Abort]

Create the response msg if atleast one of the msg's is E-error (or W-warning).

Regards,

Siva Maranani

Former Member
0 Kudos

Dear Siva,

Could u please explain ur response a bita more clearly. I would be very thankful to u if u could explain me this a bit more clearly.

How I have to do a mapping so that I can filter only error response and send.

Thanks

Veeru

Former Member
0 Kudos

It is a msg mapping that you need to perform.

[IF-WITHOUT-ELSE function] If TYPE(BAPIRET1) = E(Constant), the map the Message(BAPIRET1) to Targetfield.

Also create the Targetmsg node if atleast one of the values with TYPE=E.

Regards,

Siva Maranani