Tuesday, 27 April 2021

Getting acquainted with automating ABAP unit testing – Part 8

Part 7 – Write a second unit test

To recap from the preceding blog, we had added a new unit test method to call subroutine get_flights_via_carrier three times, each time using a different carrier value, and found that this unit test method issued two failures, suggesting that one of the carrier values did not cause a test failure. Here is the source code as we left it in the previous blog:

Monday, 26 April 2021

Getting acquainted with automating ABAP unit testing – Part 7

Part 6 – Using the correct method call syntax to request a unit test assertion

To recap from the preceding blog, we had changed the call to method assert_not_initial of class cl_abap_unit_assert so that it uses the standalone static method call syntax instead of the former dynamic method call syntax. We also know there is a bug in the production code: the ALV report presents rows for the wrong airline. Here is the source code as we left it in the previous blog:

Monday, 19 April 2021

Getting acquainted with automating ABAP unit testing – Part 6

Part 5 – Fix the production code bug identified by the first unit test

To recap from the preceding blog, we corrected the bug exposed by a failing unit test. Now the unit test passes and the program, when executed, produces an ALV classic list report instead of issuing an error message, though the rows appearing in the report do not necessarily match the value specified on the initial selection screen. Here is the source code as we left it in the previous blog:

Sunday, 18 April 2021

How to use a RFC Function module using RESTful ABAP Programming

I got a requirement to use RFC function module to get the data third party system. Using ABAP programming it is a cake walk for any ABAP developer. But, my client asked to use Eclipse and CDS to achieve this functionality. As many of us are new to Eclipse and CDS views. After doing R&D and found one reference to achieve my requirement. I hope this blog helps to all those who are going to start using Eclipse ADT for their developments.

1. Create a CDS view using templet “Custom entity with parameters”.

2. Create custom entity as per your required output and make sure to give the Class name “ABAP:ZCL_RFC_DETERMINE_JURISDICTION” where you are going to call your function module.

Friday, 16 April 2021

Getting acquainted with automating ABAP unit testing – Part 5

Part 4 – Complete the process of writing the first unit test

To recap from the preceding blog, we added an assertion to our unit test method, and when we executed the unit test it promptly detected a failure after calling production-code subroutine set_alv_field_catalog. Here is the source code as we left it in the previous blog:

Thursday, 15 April 2021

How To Switch Between ABAP Editor’s Insert (INS) And Overwrite (OVR) Modes.

Personally, I am not a fan of the overwrite mode in text editors and believe it is a relic from the past that has found its way into modern editors. In command line text editors (big time vim fan here), OVR mode can be very useful and efficient but It is hard for me to fathom the use of OVR mode in modern text editors. I believe most of my readers will also share the same sentiment.

There are very easy methods of switching between the two modes (INS and OVR) to match your preference but some users will face an uphill battle in changing between these modes due to hardware and software constraints. In this tutorial I will walk you through a method that will reliably afford you the ability to make this switch in a no frills style.

Wednesday, 14 April 2021

RSA Encryption in ABAP

Recently I stumbled across a lot of unanswered questions about RSA encryption. Here I will try to provides some examples how to use public/private key encryption in ABAP. All the overhead like certificates, trust, revocation and key generation will not be touched here. The keys will be generated with openssl.

Example 1 – Using own RSA implementation  in ABAP.

RSA encryption is quite simple. All you need is integer arithmetic – mainly modular exponentiation. The only problem is, the integers involved are longer than ABAP and most other languages can handle by default. 

Monday, 12 April 2021

Getting acquainted with automating ABAP unit testing – Part 4

Part 3 – Continue the process of writing the first unit test

To recap from the preceding blog, we applied the “for testing” clause to the one and only unit test method defined for the local class named tester, resulting in that empty method being invoked by the test runner of the ABAP Unit Testing Framework. Here is the source code as we left it in the previous blog: