Develop, Debug, and Manage C/C++ Services in SAP Business Connector 4.8

  • by Ulrich Schmidt, Senior Developer, SAP AG
  • April 28, 2010
Discover how SAP Business Connector C/C++ services work internally. Find out when it’s best to use them and when you should avoid them. Uncover tips and tricks for creating and debugging SAP BC C/C++ services smoothly.
Key Concept
The four basic rules for C/C++ services are:
  1. Keep all C/C++ services (and the interfaces used in their input/output definitions) in a separate package. Don’t mix in Java services and don’t use folder names that are also used for Java services.
  2. Keep the number of “frontier crossings” (function calls from one language to the other or data copy operations from one heap to the other) between Java and C/C++ to a minimum.
  3. Use simple data types (primitive arrays, strings, or simple records) for the data exchange between Java and C/C++.
  4. Don’t use a C/C++ service for ordinary mappings that could equally well be done in a Java service.

Assume you want to exchange electronic documents with a business partner, and these documents need to be digitally signed to become legally binding. The obvious choice for performing this kind of data exchange easily is the SAP Business Connector. However, you don’t want to endow SAP Business Connector with the ability to sign documents automatically. Instead, an authorized human person with full power of attorney needs to sign each document individually before it is sent out.

You have purchased the necessary hardware for that (e.g. a crypto-token that can be plugged into a card reader or USB device during the sending process), but this hardware needs to be accessed via a device driver written in C. How can you use it in your business process implemented on top of the SAP Business Connector?

One little-known feature of SAP Business Connector is the ability to implement services in C/C++ and to seamlessly consume these services from within Flow mappings or Java services. In the above scenario, you could write one such C/C++ service that reads the crypto-token from the card reader and then use the signature in the rest of your business process that is implemented in Flow.

In the following I’ll explain how C/C++ services work and in which situations it makes sense to use them. I’ll provide recommendations about what to pay attention to when designing and implementing C/C++ services and what pitfalls to avoid. I’ll then finish with an actual example illustrating the process of creating, developing, and debugging a C/C++ service.

Ulrich Schmidt

Ulrich Schmidt joined SAP in 1998 after working in the field of computational algebra at the Department of Mathematics, University of Heidelberg. Initially, he was involved in the development of various products used for the communication between SAP R/3 systems and external components. These products include the SAP Business Connector, which translates SAP’s own communications protocol RFC into the standard Internet communications protocols HTTP, HTTPS, FTP, and SMTP, as well as pure RFC-based tools, such as the SAP Java Connector and RFC SDK. Ulrich gained insight into the requirements of real-world communications scenarios by assisting in the setup and maintenance of various customer projects using the above products for RFC and IDoc communications.

See more by this author


No comments have been submitted on this article. 

Please log in to post a comment.

To learn more about subscription access to premium content, click here.