Integrating SAP with different systems, websites or mobile applications has become necessary, and the good news is that it has also become more simple. Formerly, connectors and programming languages were more proprietary, but in the last couple of years SAP has opened its enterprise resource planning (ERP) system and adopted more standard technologies to enable easier integration. In this post, I’d like to show one example of how you can extract the number of workflow items from SAP for a user by enabling SAP services.
For development and prototyping, I like to use the JSON adapter for ABAP, since it can sometimes take time for the SAP Gateway to be installed or added to the landscape. ABAP is the SAP proprietary programming language. It stands for “Advanced Business Application Programming,” originally “Allgemeiner Berichts-Aufbereitungs-Prozessor,” which is German for "general report creation processor."
The JSON adapter for ABAP and information on how it can be installed and loaded into a SAP system are shown on this website. Once you have the JSON adapter enabled, all remote function calls (RFC) can be called using a URL, returning the input and output results in JSON format. (Note: other notations are also supported by the adapter.)
JSON is a lightweight data-interchange format and, together with jQuery, is a great way to build an application. There are different ways to parse the JSON results, but I prefer jQuery. In addition, SAP has its own query library called SAP UI5 that can be used to parse the JSON result.
Your SAP landscape then looks like what you see in the following graphic:
Of course what is shown above is a simplified landscape—you would need a SAP Web Dispatcher or a remote proxy to proxy the request and for the DMZ. Again, for development and rapid prototyping, this landscape is simple and perfect for fast development results.
Once you have the JSON adapter for ABAP set up, you can address RFC through a URL like this one:
SAP_WAPI_COUNT_WORKITEMS is an example RFC I used to retrieve the number of work items.
SAP GUI transaction se37 shows the RFC parameters.
The RFC has input parameters like USER and DETAIL LEVEL that can be passed in through a URL parameter.
I like to use Postman and Google Chrome (or Canary for mobile device development) to test JSON queries and to view the results.
Here is an example of the JSON result in text format.
The JSON adapter for ABAP supports GET and POST. To keep it simple, I just used GET to pass the input parameters. To add value in the transparent tables with the TASK_FILTER_TABLE element, you would need to use the POST method. For just reading data from SAP, the GET method will be sufficient in most cases.
Once you have the right RFC and figure out the parameter that you have to pass, you can use the URL and add it to your jQuery HTML code and display the information.
With the above-mentioned tools (jQuery and UI5) and a JSON-enabled SAP system, building simpler and more intuitive user interfaces for more productivity is not a secret anymore. SAP services, HTML5 and the modern responsive web design methods enable us to build native and mobile web apps faster than ever before.
Do comment here or follow me on Twitter: @markusvankempen.