Ento
Ento

Reputation: 43

Is there an advantage of using direct RFC calls instead of the BAPI?

I'm not very familiar with working with SAP but my current task is to utilize RFC calls for creating purchase orders in SAP software via a C# project I'm working on.

Is there any advantage to using direct RFC calls instead of the BAPI? I asked my supervisor this and his reason was "to avoid the unknown/unneeded mess".

Our old program used the BAPI. I find with this task I'm now chasing my tail as I dive into metadata and resolve issues with using/getting the structures I need.

Things are working and coming along, but I just don't understand the insistence on using RFC instead of BAPI.

Edit to clarify my poor terminology: we currently use a wrapper that calls the BAPI for us. My task is to not use the wrapper but utilize the same RFC calls the BAPI would.

Example:

IRfcFunction poCreateFunction = _dest.Repository.CreateFunction("BAPI_PO_CREATE1");
IRfcStructure poHeader = poCreateFunction.GetStructure("POHEADER");
poCreateFunction.SetValue("POHEADER", poHeader);
...
poCreateFunction.Invoke(_dest);

Upvotes: 3

Views: 4345

Answers (2)

Esti
Esti

Reputation: 3687

Your supervisor gave you a very half-assed answer, and it makes you wonder if he understands what he is trying to achieve by forcing you to use custom (I assume) RFC's.

In .NET integrated projects I (as the ABAP programmer) will often provide wrapper RFC modules to hide some of the BAPI's complexity, or because the .NET side may not have all the information needed by the BAPI. This often results in a simpler interface, but with limited functionality. But in the end that just moves the BAPI call from .NET to within the ABAP stack.

If you are having issues with the supplied RFC function modules that does not occur when you are using the BAPI, there is probably something wrong with the function module. Or at the very least it does not serve the purpose of hiding SAP's complexity from the .NET program and does not provide you any benefit over using the standard BAPI's, which at least is well documented and supported.

Upvotes: 2

vwegert
vwegert

Reputation: 18483

A technically correct, but somewhat unhelpful answer would be ?SYNTAX ERROR, followed by a huge blue blinking cursor.

BAPIs are RFC-enabled function modules, so there is no technical difference between calling a BAPI and any other RFC-enabled function module. The difference is that BAPIs are officially released for customer and partner use. They are supported, maintained and for the most part well documented - as opposed to some internal function module that for some technical reasons has to be RFC-enabled. There is a strict set of rules that any developer who wants to provide a BAPI has to obey in order to maintain a certain set of standards throughout the programming interface. It is true that BAPIs have rather lengthy parameter names and huge data structures to cover all kinds of special applications, but calling this a "mess" does not leave a positive impression...

Upvotes: 2

Related Questions