cancel
Showing results for 
Search instead for 
Did you mean: 

Processing BAPIRET2 in VB.NET

Former Member
0 Kudos

I have written a VB.NET web service using VS 2003 and the SAP.NET Connector 2.0 to call custom RFC-enabled BAPIs on WAS 7.0. I'm able to invoke the BAPIs through the SAPProxy, and have figured out how to receive and process the data that is returned.

I do not have any prior experience (i.e. Java) in processing the structures returned by BAPIs. Can someone provide me with a simple example of VB.NET code that processes the messages in BAPIRET2, as well as robust handling of the returned data? I'd like to do this properly rather than through my own trial-and-error.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

The easiest way to get a consistent handling of BAPIRETs is turning the the "BAPI Exception mapping" feature on. You find a property called "MapBapiExceptions" if you click on the background of the .sapwsdl designer.

When turned on, you will find overloads of the BAPI with the result paramters removed. Calling these will automatically throw an exception in case that the BAPIRET contained an error.

For details please see SAPClient.BapiReturn and SAPClient.BapiRetTable documentation and the "SAP Client Exceptions" overview chapter in the online-documentation.

Answers (0)