Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a library (with C programming language interface) callable from within ABAP?

Tags:

abap

cplex

I have no experience with ABAP programming and I'd like to know whether it's possible to call a 3rd party library with C programming language interface from within an SAP application.

To be more precise, the goal is to use the IBM CPLEX Optimizer (running on local machine) inside an SAP application. The Optimizer is a library and has an API adapted to C++, Java and .NET (C#, VB.NET). I suppose it's a DLL file.

So can you tell me whether it is possible to invoke the functions of an DLL from within an ABAP application?

like image 319
llasarov Avatar asked Feb 22 '17 08:02

llasarov


2 Answers

You can use external DLLs directly in a following manner:

 DATA: cmp_dll TYPE ole2_object.
 CREATE OBJECT cmp_dll 'COMPANY.STOCK_DLL'.
 CALL METHOD OF cmp_dll 'check_order' = order
 EXPORTING p_num = 'number'
           p_date = 'date'
           p_vendor = 'vendor'.

Prior to that you should register your DLL in SOLE transaction, it can be registered either on client or on application server (and thus accessible from any client).

The better option may be an RFC wrapper, mentioned by Trixx.
Also it is possible to run C code directly on AS via SXPG_COMMAND_EXECUTE but this is out of the scope of your question.

like image 146
Suncatcher Avatar answered Sep 21 '22 02:09

Suncatcher


Yes, that's possible, but only with some own development at external side. For example, you can address and call external programs from ABAP via SAP's RFC protocol. The external program needs to use some SAP Connector SDK for receiving such a Remote Function Call. Then your own program can do whatever you want, of course also use some other programs or libraries.

SAP offers these RFC Connector SDKs for various programming languages and runtime environments:

  • for Java : the SAP Java Connector (JCo)
  • for .NET : the SAP .NET Connector (NCo)
  • for C/C++: the SAP NetWeaver RFC SDK (NW RFC SDK)

Please see https://support.sap.com/connectors for further info.

like image 41
Trixx Avatar answered Sep 20 '22 02:09

Trixx