Today’s story starts with ABAP games.

Chinese ABAP practitioners more or less have a collection of ABAP mini-games, such as the following.

Destroy the stars:

Mine:

From my friend Liu Meng, tetris from the public account SAP Dry Goods Shop:

Drawing with ABAP:

And table tennis using the ABAP Channel technology we’re talking about today, and doubles.

I always wondered how German developers, known for their rigor, would react when they saw these little games popular in the ABAP ecosystem in China.

Last year, I worked as a standard developer in SAP Germany headquarters and often attended some meetings. In a meeting, SEVERAL other CRM German colleagues and I were waiting for an S/4HANA colleague to arrive in the conference room. Why, you might ask, do Germans, with their reputation for punctuality, arrive late for work meetings?

That’s because SAP’s German headquarters is huge, with more than 20 buildings. The picture below shows the first building of SAP’s German headquarters in Walldorf, taken in late autumn. We used to call it Building 1, where I was working.

The side of the building looks like this, taken in early summer:

These 20 buildings are scattered in all corners of the park:

The S/4HANA colleague who attended the meeting was working in Building 3 and had just finished the last meeting. It took 5 minutes to walk to the conference room in Building 1 at Jerry’s walking speed.

While waiting for his colleagues, Jerry connected his computer to the projector and showed the games one by one to his German colleagues. When my colleague Carsten, the lead architect of SAP CRM, saw ABAP’s minesweeper game, he burst out laughing and said it was the game he had played the most on Windows 98.

Finally S/4HANA’s colleagues arrived in the conference room, where a table tennis game written in ABAP Channel was playing on the projector. The German colleague stared at it for a moment and then said humorously, “Am I in the wrong room?”

Here is the text.


ABAP Channel is a new event-driven front and background communication technology released by Netweaver 740. The underlying implementation is based on WebSocket and TCPSocket.

CRM consultants who have worked in the SAP CRM Interaction Center must be impressed by the polling mechanism of this product. Due to the limitations of technology at that time, there was no way to notify the front WebClient UI whenever an event occurred in the ABAP background. In order to display the latest data, the ABAP backstage can only poll periodically at a fixed interval.

Using Chrome Developer tools, you can easily observe this polling behavior: The following figure shows that the CRM call center sends an HTTP request to the background every one second for polling.

In 2014, Netweaver 740 released the underlying ABAP Channel technology based on the Web Socket protocol, so CRM call centers also adopted this technology to replace the previous clumsy and inefficient polling solution.

For more information, see the blog of CRM Call Center Product Manager Henning:

Replace polling in CRM Interaction Center by ABAP Push Channel

Many colleagues who have done CRM development in SAP Chengdu Research Institute have come into contact with Henning, a Very amiable German with profound business knowledge in CRM field.

There have been many SAP practitioners blogging about ABAP Channel on the SAP community site, including many examples developed by SAP itself, which are released along with Netweaver.

Jerry will not repeat these examples, but for those who are interested please refer to this article:

ABAP Channels Examples

Today I’m going to share a concrete example of how Jerry used ABAP Channel to improve the efficiency of his daily job analysis.

ABAP practitioners often use a variety of tracking and performance monitoring tools when working on projects, the most typical being ST05 and SAT. Jerry does think these tools are very useful for ABAP developers, and Jerry’s only blog post on the SAP community that has received more than 100,000 views is this one on alternative uses of ST05 and SAT:

Six kinds of debugging tips to find the source code where the message is raised

SAP Community was revamped in September 2016 and migrated to the SAP cloud platform. After the migration, all blog views were reset, so now this blog only sees over 40,000 views instead of 100,000.)

However, Jerry says there is one limitation to all the tools currently available in Netweaver: developers must manually turn on the tool’s trace mode to run the application in that mode. At the end of the run, the trace mode can be turned off manually or automatically by the tool. That is, none of these tools can provide developers with the information they need in real time while the application is running.

I participated in refactoring and prototyping of the migration of the original CRM One Order framework to S/4HANA in Germany last year. See Hello World, S/4HANA for Customer Management 1.0 for more details.

Once the prototype is done, you have to test it. I have to perform a series of operations on the new S4CRM UI that I did on the old CRM UI, and then see if the input parameters passed into the API and the output parameters returned by the API are correct.

I started by setting breakpoints in the API and checking them in the ABAP debugger. I quickly found this inefficient: CRM development consultants know that apis like CRM_ORDER_MAINTAIN/READ have so many input and output parameters that you have to double click one in the ABAP debugger to see it, and then double click back to see another. If you want to check all the parameters of the API, you need to click the mouse more than 100 times.

What Jerry couldn’t stand was the repetitive physical work. Is there a way to make Netweaver work like the SAP cloud platform’s CloudFoundry programming environment, a

The **cf logs ** command is used to print the logs generated by the running application to the browser. There are! Use ABAP Channel.

So I started working on a tool. See how this tool works: A BSP application, accessed in a browser:

Then switch directly to the One Order app and proceed as usual. For example, to create a new service order, maintain the following fields:

Switching back to the tool I made, the One Order API’s input and output parameters are now displayed in real time in the browser, without the hassle of clicking through the debugger.

Because it is displayed through a browser, I can also search by keyword directly with CTRL+F, which is not possible in SAPGUI. I later recommended this tool to Carsten as well.

The following are detailed development steps for the tool.

1. Transaction code SAPC, create a new APC(ABAP Push Channel) application ZORDER_LOG_APC, and select WebSocket as connection type.

Click the button “Generate Class and Service” to automatically Generate processing classes and ICF nodes.

2. Transaction code SAMC, create a new AMC(ABAP Message Channel) application named ZORDERLOG.

Maintain the name of the ABAP class automatically generated by the step 1 APC application under the Authorization Program. The purpose of this step is to specify the name of the ABAP processing class that sends and receives data through WebSocket in the ABAP Channel scenario. Copy the Channel ID**/order_log**.

3. As you can see from the above figure, I have specified the ABAP class CL_CRM_ORDER_LOGGER to send logs generated by application calls to the One Order API to the Web Socket, so this step needs to program this class. The full code is on my Github, but here is just the gist.

In the static constructor, pass in the producer’s constructor the AMC ID and channel ID created in step 2. Indeed, the scenario of an ABAP Channel is a typical producer/consumer pattern, with messages produced behind the scenes by ABAP being sent to the browser through Web sockets for consumption by the browser.

The message is sent using the SEND method below.

4. Redefine the ON_START method of the first APC application that generates the processing class automatically:

In this method, bind the APC application created in step 1 to the AMC application created in step 2.

5. Create an enhancement for API CRM_ORDER_MAINTAIN and inject my CL_CRM_ORDER_LOGGER into it. Each time the API is called, it is automatically logged and sent to the browser through the Web Socket.

The above five steps are the implementation of an ABAP Channel producer. Next comes the consumer, the development of a Web application running in a browser.

Create a BSP application and maintain the following code in index.htm:

Line 17 declares the Web Socket URL for front and back communication:

So the consumer development is done.

In actual work, when you encounter tedious and time-consuming physical work, you can also think more about whether you can use tools to reduce workload and improve work efficiency. Thanks for reading.

Read more

  • Talk about C and ABAP

  • Jerry’s ABAP, Java and JavaScript stew

  • Jerry’s collection of original ABAP technical articles

  • What should ABAP developers learn in the future

  • Jerry’s 2017 May Day Holiday: ABAP implementations of eight classical sorting algorithms

  • Where are all the developers over 35 at SAP Chengdu Research Institute?

  • The nunchaku path of an SAP developer

For more of Jerry’s original articles, please follow the public account “Wang Zixi “: