The National Day holiday is coming soon, let’s talk about a light topic, about the holiday.

Jerry’s Colleague Li Ben from Chengdu, the author of “SAP Chengdu Research Institute Li Sanlang: INTRODUCTION to SCP Application Router”, once went to Germany on a business trip with Jerry in November, puzzled and asked: There are more than 80 million people in Germany. How come the streets are so empty that hardly anyone can be seen?

Jerry didn’t have an answer to that either. And this phenomenon is more prominent in Germany’s national holidays.

Jerry’s article “Jerry’s May Day Holiday in 2017: ABAP implementation of 8 Classical sorting Algorithms has mentioned that I stayed in Germany for three months last year, and the most difficult thing was that there were several days of legal holidays in Germany almost every month, because since the holiday, the staff canteen of SAP headquarters was closed, and all the stores were closed, so we had to prepare dry food one day in advance.

The food in the canteen of SAP German headquarters is very good. When Jerry wrote this, he seemed to smell the smell of food coming out from the canteen when he approached the canteen at lunch time.

The food in the headquarters staff canteen was sweet and sour, and some of the soups were slightly bitter rather than spicy. Jerry hated spicy food, so it suited me perfectly, and I ate it for 90 days without getting sick of it.

The combination of meat and vegetables is reasonable, and the meat and vegetables are not enough to fill up, which is heaven for Jerry, a big-eating programmer.

The food was so good that I ended every meal like this:

But on German national holidays and Sundays, all that disappears. German store opening hours have always been governed by rules dating back to the 1950s: stores are open at 6:30 p.m. on weekdays, close at 2 p.m. on Saturdays and closed all day on Sundays.

Therefore, Jerry had to rely on the dry food for three days from April 29 to May 1 in 2017, spending a total of 9 euros.

Jerry is a programmer, not fussy about what he eats, and Zopf is hungry. What is Zopf?

I live in rural Germany and rarely see people on weekdays, let alone holidays. The streets are full of this style:

Jerry thought he was in the world of the science fiction film I am Legend until he heard the sounds of a passing car and German children playing in his garden.

On the last day of the May Day holiday, my colleague Liang Simon invited me to his home for an authentic German barbecue. Having eaten Zopf for two days before this, I thought it was the best barbecue I’ve ever had in my life! After the roast was gone, Simon’s wife brought out a homemade chocolate cake.

When Jerry finished eating, he thought regretfully, The cake would have been made with a few more centimeters in radius.

In this case, as a programmer, the only way to have fun is by stroking code. So these things mentioned in this article are the product of Jerry’s boredom during the German holidays and may not be helpful to the actual work of ABAP consultants. But since it is a holiday, we should read a novel to amuse ourselves.

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

Eight kinds of sorting algorithms learned in undergraduate course are implemented one by one with ABAP.

One SAP user, Sinai, probably thought I was too full to do anything (which is true), since SORT in ABAP is just the keyword SORT.

But fortunately, there are other netizens jumped to my defense, the central idea of four words: happy.

2. Use four operators to compare the size of two integers

Reading the description, you can see that this is another requirement that makes programmers feel awkward.

With bitwise manipulation, JavaScript can be implemented elegantly:

Java also works:

It’s ABAP’s turn. Because ABAP’s bit-xor operation does not support integer types.

Since the language level is not supported, we have to do our own simulation.

I used an ABAP inner table of size 32 to store the value of each bit of a 32-bit integer, and then based on this inner table I simulated the integer’s and/or and xor operations, as well as the bit shift left and right.

The simulated implementation code for ABAP integers to support bitwise logic operations like JavaScript and Java is in my blog:

Bitwise operation ( OR, AND, XOR ) on ABAP Integer

The ABAP code implemented this way is twice as long as JavaScript and Java. It’s ugly, but it satisfies the problem.

3. Give as many schemes as possible for calculating the sum of two integers

The following answers can be summed up as:

  • The average programmer’s answer

  • 2B programmer’s answer

  • The literary programmer’s answer

  • Very boring programmer’s answer

  • .

A final solution to the actual is the adder of undergraduate course of computer principle in: through the bitwise logic and arithmetic (&) to judge whether the current operation have carry, using bitwise or (|) to save the current computation carry value.

ABAP version of the last solution:

Here are some gadgets.

1. If you are an ABAP consultant, do you know which SAP transaction code you use the most times each month?

Just write a simple ABAP report and execute the answer. The source code for the report is available by clicking “Read the original” at the bottom of the article. The figure below is the result of Jerry’s execution of the report in SAP’s internal development system. It is not surprising that SE24 ranked first, which was used 713 times in a month. To my surprise, SAT was used 692 times. Needless to say, this month will be a struggle with various performance-related incidents.

2. Enhanced ABAP code version management capabilities.

For example, if I wanted to find out which ABAP version of the comment “* Wave 12 Schema version is 7” was first introduced, IT turned out to be version 45.

In practice, SAP developers often need to do similar things, such as analyze a bug, locate the introduction of a line of code, and then need to find which version of the request number introduced the problematic line of code.

However, there are 77 versions of this method. Am I going to start with the first version and compare it to the current version and work my way up to the last version?

This is pure manual labor, order n time. We can also use binary lookup to compare the intermediate version of the 77, version 39, to the current version. If version 39 does not show the code we are looking for, we can use binary lookup again for versions 40 and 77.

This search only reduced the time complexity to a logarithmic scale, and the physical work still bothered me. Is there an O (1) solution?

B: of course. Is the method of each version of the source code all downloaded to the local save into a TXT file, the version of the content inside from low to high sort, and then directly in accordance with the keyword search to find, instant can get the answer.

With the local file, I can use a text editor open at the same time it twice, and then you can, by means of the mouse slip quickly compare any two versions of the differences, without the need for SAPGUI “choose to compare version – > click the compare button – > view the comparison results – > point back button – > select the next group to compare the version of the” this clumsy operation, Work efficiency has been improved.

In my mind, repeated mouse clicks are the root of all evil for programmers.

The source code for this tool is available by clicking “Read the original”.

3. Enhanced SAT functionality.

The CRM development team of SAP Chengdu Research Institute once received a CRM On HANA test project, which was to run a series of the same ABAP codes On two systems simultaneously. The underlying databases of the two systems were non-HANA database and HANA database respectively. This is the way to measure SAP CRM performance running on HANA databases. If you find that some code doesn’t perform as well on a HANA database as it does on a non-HANA database, find out why and optimize the code accordingly.

At that time, our German colleagues required us to run the application with SAT in the two systems respectively, and then manually analyze the SAT results, find out the points that the running speed of the system with HANA database is slower than that of non-HANA system and write documents.

As soon as I received this project, I secretly complained: this is not pure physical work. If you’re testing a piece of code that calls a lot of apis, don’t you have to manually compare The Times those apis execute on both systems one by one? Even with dual screens, you need to move your head from side to side like a wave drum. It’s not like you’re practicing freestyle by turning your head for air.

Then Jerry wrote a tool to automate the comparison. The following figure shows the tool interface. HN1 and Q2U are code names of these two systems. HN1 background database is HANA, while Q2U background database is not HANA.

Green Threashold specifies 50, which means that if the same method HN1 executes 50% faster than Q2U, the comparison result of this method is Green. Yello Threshold means that HN1 is faster than Q2U, but only 20% to 50% faster. If HN1 is slower than Q2U, that’s bad, and that’s the scenario we need to do something about.

The output of the tool is an ALV that can be exported directly to Excel.

With this tool, what would have taken hours to fill out Excel can now be completed in 10 seconds. The time saved can be spent on the red-light results, the code that really needs HANA database tuning.

Later Jerry showed the tool to the project director in Germany, who liked it so much that he asked me to explain how to use it in an internal meeting with SAP colleagues in other parts of the world. This is also the only tool that Jerry has officially approved for SAP among the many boring things that ABAP has created in this article.

The complete code for this tool is available by clicking “Read the original”.

4. Execute transaction codes or functions in SAPGUI directly with Excel.

As an SAP ABAP developer, the list of systems on SAPGUI is always very long, and this is after I’ve cleaned it up many times and removed a few systems that I rarely use. Some systems I log on every day just to look at a few simple transaction codes, such as SM04, ST22, SE10, etc. To do this, every day I selected a system in SAPGUI, double-clicked it to log in, and then entered the transaction code on the keyboard.

Soon I started to get lazy again because I didn’t do any development work on these systems, so is there a way to log in without SAPGUI and execute transaction codes and see the results? Yes, excel. Do several buttons in Excel, each button event processing function with VB hardcoded into the corresponding system address, system number, user name and password, and expected to execute the function or transaction code name.

In this way, the previous tedious operation, now double click to open Excel click a few buttons, and then cut to do other things, and then cut back to Excel to check the result. The time saved could be used for other, more productive things.

This VB code is written like this:

5. Greet other online users in the SAPGUI directly.

When you execute the tool, you see a list of the current system online users and the transaction code each user is using.

Double-clicking on a user name will bring up a pop-up box in his or her SAPGUI with a pre-specified text such as:

The trick is to send a text message to the specified user using the TH_POPUP function in the form of a pop-up box:

6. Inspection tools available to the project manager.

For example, if a project manager wants to see what a consultant named WANGJER did on the system between March 1 and March 25, 2017, he can execute the tool to get a list.

The purpose of this tool is to quickly recall what was done in any given period of time, such as a month or a year ago. As programmers age, their memory deteriorates and they must be aided by tools.

The last one is a prank.

One day when I was at work, a partner on wechat asked me for help, saying that the dividing line marked in red could be dragged to the left.

Once you drag it to the extreme leftmost position, you can no longer adjust its position. As shown below, the left object list is too narrow to use SE80.

At that time, Jerry saw the screenshot sent by his friend on wechat. He was not sure about this operation.

I tried it, and I got screwed.

Fortunately, I know this list exists:

One line of code will restore the SE80 Settings to their original Settings:

DELETE FROM rseumod WHERE uname = ‘WANGJER’.

Thank you for listening to my nagging, I wish you a happy National Day in advance 2018.

Read more

  • Use ABAP Channel to develop some small tools to improve daily work efficiency

  • Talk about C and ABAP

  • ABAP vs Java, breaststroke vs freestyle

  • Three hundred lines of ABAP code implement a simplest blockchain prototype

  • Jerry’s collection of original ABAP technical articles

  • What should ABAP developers learn in the future

  • Jerry’s ABAP, Java and JavaScript stew

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