3

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);
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Ento
  • 43
  • 1
  • 6

2 Answers2

2

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...

vwegert
  • 18,371
  • 3
  • 37
  • 55
  • I don't think he believes it's really a mess, but more of a brush-off answer. As I replied to Esti, we currently utilize a wrapper that works well for us but now I'm trying to redo everything with IRfcFunctions and IRfcStructures. – Ento Apr 29 '13 at 17:34
2

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.

Esti
  • 3,677
  • 8
  • 35
  • 57
  • Yes, our current program uses a wrapper function so we only have to pass in the parameters that we need/use. It's easy to use and works well for us. My terminology may be wrong. I'm not creating any new Rfc's but utilizing IRfcFunction and all the IRfcStructures it needs. Example: `IRfcFunction poCreateFunction = _dest.Repository.CreateFunction("BAPI_PO_CREATE1");` – Ento Apr 29 '13 at 17:24
  • @Ento looks like I didn't really answer your question in that case. I googled IRfFunction, but don't have the expertise on the .NET side to tell you if there's a benefit to using IRfcFunction. All I know is in the projects that I worked on the .NET programmer was able to pull in the interface of the RFC via the connector and did not have to do much additional setup on their side. This is something I'm going to get my head around when I have free time again. ( I think I have some time off scheduled in 2025 :) ). – Esti Apr 30 '13 at 04:09
  • haha that is ok. Thank you for thinking on it and replying. It's really just a curious question on my part. This is my task, though, and I have it mostly working now, so I continue on. Thanks. :) – Ento Apr 30 '13 at 19:36