Saturday 29 April 2017

Adding UAN Number to PaySlip – Enhancing HINCEDTO Program

Employees Provident Fund Organisation, India (EPFO) has launched a Universal Account Number (UAN) to provide a number of facilities to its members through a single window. In SAP a new subtype 08 ( Universal Account Number ) has been created for Infotype 185 to store Universal Account number.

Basically we design payslip through HR form editor ( Tcode PE51 ) and we add tables, fields to HR Form classes (PE51_Checktab).

Thursday 27 April 2017

String Template in ABAP, ES6, Angular and React

As an ABAP you probably be very familiar with String Template.

String Template in ABAP


A string template creates a string from literal text, embedded expressions, and control characters in a string expression. The most powerful feature I like is we can insert ABAP variable inside the template by wrapper variable with “{ }”, see one example below:

Wednesday 26 April 2017

Tag(Marker) Interface in ABAP and Java

“Specific predefined global interface. By integrating the tag interface, classes or other interfaces stand out against the ABAP runtime environment. A tag interface generally does not contain its own interface components, but instead assigns a particular task to the integrating classes or interfaces and changes the way they are handled by the ABAP Compiler.“
And in fact this is not a specific concept of ABAP, but exists in many other language as well.

ABAP tag interface


One of the most famous tag interface in ABAP is if_serializable_object.

Tuesday 25 April 2017

OOP Updates in ABAP 7.4 and ABAP 7.5

SAP introduced the concept of OO programming in ABAP in the year 2000. Since then, it’s been the recommended method of programming. Let’s describe the new features of ABAP that relate to OO programming.

1 Upcasting/Downcasting with CAST


In OO programming, a downcast is a process in which you turn a generic object, like a monster, into a more specific object, like a green monster. An upcast is the reverse. This functionality has been available in ABAP for a long time, but it gets a lot easier in 7.4.

Monday 24 April 2017

Setup ESR connection between ABAP system and AEX (ERP to PO / SPROXY)

Check Transaction SPROXY on the ABAP system to ensure that ESR of PI/PO is connected.

If this is not given, you need the following setup steps:

1) Create 2 RFC destinations (Type G) on your ABAP System.

The name of the first on has no naming convention. This name will be used in sxmb_adm as URL.

Sunday 23 April 2017

Various Proxy Design Pattern implementation variants in Java, ABAP and JavaScript

This blog gives an introduction about various proxy design pattern implementation variant in Java and ABAP.

Below paragraph is quoted directly from Wikipedia:

“A proxy, in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. In short, a proxy is a wrapper or agent object that is being called by the client to access the real serving object behind the scenes. Use of the proxy can simply be forwarding to the real object, or can provide additional logic. In the proxy extra functionality can be provided, for example caching when operations on the real object are resource intensive, or checking preconditions before operations on the real object are invoked. For the client, usage of a proxy object is similar to using the real object, because both implement the same interface.“

Friday 21 April 2017

Covariance in Java and simulation in ABAP

I am the trainer of one standard course “Programming Language Concept” within SAP and there is a set of concept Covariance and Contravariance, which has only built-in support by a subset of programming language like Java. For those ABAPers who don’t have chance to touch this concept in their daily work, I have built a small example to simulate how the concept works in ABAP as well for ease of understanding. The example explained in this example is just a prototype purely for training and education purpose.

Thursday 20 April 2017

ABAP Call Monitor (SCMON) – Analyze usage of your code

Do you know that on average 60% of your custom code is in reality not executed in your productive landscape? Especially in SAP Business Suite migration projects like to SAP HANA or SAP S/4HANA such amounts of unused code result in huge adaptation efforts. Therefore SAP’s recommendation is to clean up your unused custom code before migration. But how can you identify the code that is not used?

The purpose of the ABAP Call Monitor (transaction SCMON) is to monitor the execution (usage) of ABAP code (function modules, method calls etc.) in your productive system. The advantage of the SCMON compared to the UPL (Usage Procedure Logging in SAP Solution Manager) is that using this tool you not only collect the usage data (how often a specific ABAP object was called), but also the information about the calling business process. Therefore as a result of the monitoring, you get a list of business transactions (callers) along with all ABAP objects that have been called within these business transactions including the number of calls.

Wednesday 19 April 2017

Create dynamic proxy persistently in Java and ABAP

In my blog Implement CGLIB in ABAP I demonstrate how to create dynamical proxy class via CGLIB in Java and ABAP. The generated proxy class is actually a subclass which inherits the base class. Such class created by CGLIB is transient, which means the life time of generated class is only within the current session where it is created, which will not be persisted.

In this blog I will show how to create a globally persistent proxy class dynamically in Java and ABAP.

Tuesday 18 April 2017

Simulate Mockito in ABAP

What is Mockito?

Mockito is a mocking framework, JAVA-based library that is used for effective unit testing of JAVA applications. In our unit test there are usually some dependency on other external service implementation for example network or database service. Usually in order to isolate our test code from these dependencies we have to create mock class against them. Mockito in Java can create transient mock class ( which is only available in current test session ) for us in a very easy way. See one example below:

Monday 17 April 2017

Implement CGLIB in ABAP

What is CGLIB?

A Byte Code Generation Library which is high level API to generate and transform Java byte code. It is used in various scenarios such as AOP, testing, data access frameworks to generate dynamic proxy objects and intercept field access.

See one example in unit test.

In line 17, a new dynamic proxy class is generated as mock.
In line 19, we tell the proxy, “if get(0) is called on this mock class, then return mocked data “hello, world”.

Saturday 15 April 2017

General properties of ABAP Classes / Interfaces

Every day you create or change ABAP class in class builder. When you activate your change, have you noticed a series of objects with several “=” in the middle part of each?

SAP ABAP Tutorials and Materials, SAP ABAP Guide, SAP ABAP Certifictions

Technically speaking, an ABAP class consists of several parts. In order to figure them out, I just create a simple class with the following source code:

Friday 14 April 2017

Integer in ABAP, Java and JavaScript

When I first begin to program with ABAP I get confused with different kinds of integer type available for ABAP developers: i, int1, int2, int4, and int8.
According to ABAP help, predefined data types consists of two types:

1. predefined ABAP types: b, c, d, decfloat16, decfloat34, f, i, int8, n, p, s, string, t, x, and xstring.
2. predefined dictionary types: INT1, INT2, INT4, INT8,DEC,DF16_DEC,DF16_RAW,DF34_DEC,DF34_RAW and FLTP.

How to write a “correct” program rejected by compiler: Exception handling in Java and in ABAP

Recently I am prepare an internal training and have been racking my brains to find a real example for my attendees about writting a “correct” program which gets rejected by compiler. The tricky point here is as a programmer, we always treat compiler as our god: if compiler complains that our program has errors, then we are wrong. Programmers tend to believe in that compiler will NEVER make mistakes.

SAP ABAP Tutorials and Materials, SAP ABAP Guide, SAP ABAP Certifications

And finally I got inspiration from Alexandru Constantin Bledea’s github.

Wednesday 12 April 2017

Renaming objects in ABAP for Eclipse

If you want to rename ABAP classes, methods or variables you have two possibilities: Feel the pain or use Eclipse…

It’s pretty simple! Just right click on the object and choose “Rename”:

SAP ABAP Tutorials and Materials, SAP ABAP Cetifications, SAP ABAP Guide

Local class in ABAP, Java and JavaScript

Local class in ABAP


Suppose I have a global class with a public method ADD with following signature. I would like to implement with a local class inside this global class.

SAP ABAP Tutorials, SAP ABAP Materials, SAP ABAP Certifications, SAP ABAP Guide

Tuesday 11 April 2017

Four different TEST ISOLATION techniques to build your ABAP unit test

As far as I know test isolation is widely used in SAP internal to build unit test code, at least in my team. Test isolation in unit test means that in your production code you make use of some API(class method/Function module) which are developed by other team, and you would not like to really consume them during your unit test, since you would not accept that most red lights in your unit test report are caused by the bugs in those external API,right? Instead, you expect that the call of those external API during your unit test execution will be replaced by some dummy code written by yourself.

Friday 7 April 2017

How to configure transports of XS Classic native applications

CDS view with input parameters consumption via OData

I decided to write this blog after I spent a lot of time in figuring out how to consume the CDS view with input parameter via OData.Hope this helps

CDS view with input parameters require a special syntax when you are making a call via OData. The steps to be followed in the CDS View are:
1) Annotations: Odata.publish:true
2) If you have Date field as your input parameter with datatype as Dats ,it might create an issue so cast it to Char. You will get the following error in that case:

Wednesday 5 April 2017

Try to access static private attribute via ABAP RTTI and Java Reflection

In ABAP we can define a static attribute for a class via keyword CLASS-DATA, whose validity is not associated with instances of a class but with the class itself. In order to prove this fact I use the following simple Pointer class for demonstration:

class ZCL_POINT definition
  public
  final
  create public .
public section.

Tuesday 4 April 2017

Searching the ABAP Keyword Documentation

The ABAP Keyword Documentation is what appears when you hit F1 on ABAP statements in the ABAP Editor in SAP GUI (SE80, SE38, SE24, …) or in ADT. Hitting F1 triggers a search. The ABAP Keyword Documentation framework analyzes the context of the current cursor position and tries to find the most appropriate document(s). That works rather good for ABAP keywords. It is a bit less reliable in expressions.

The basis of the search is an index table that is generated from keywords attached to the documentation topics. E.g., if you use F1 on DO, there is an entry like “DO, ABAP Statement” in that table and the context sensitive search will recognize that the cursor is placed on the first word of the statement and will directly call the respective document.

Monday 3 April 2017

Using KeePass to logon to a ABAP Project in ABAP in Eclipse

Many systems with many clients means many passwords to me. And if I do want to make things right, I need to use a password manager (and generator) for this task. To manage my logons I am using KeePass, from which I can directly access the systems via SAPGUI.

For to be able to use KeePass also for to logon in ABAP in Eclipse, I would appreciate very much, if you could change the title of the Logon Window from “Logon to System” to “Logon to System for ABAP Project <name of the project>” or any other title which at least contains the name of the ABAP project.

Sunday 2 April 2017

Stateless and Stateful – Different behavior in application side

In this blog I will explain how stateful and stateless BSP application behave differently.

The test BSP application I am using



SAP ABAP Tutorials, SAP ABAP Materials, SAP ABAP Guide, SAP ABAP Certifications

It consists of three files.