Copyright 2024 - BV TallVision IT

Abap coding blocks can be created where needed. They are aimed at getting the value for 1 specific field and can effectively do anything to achieve this goal. A number of coding blocks are already available which can be used for your interface or as a reference on how to set up an Abap coding block. 

First of all, the coding block needs to be available as a method on either lcl_Abap or the interface-specific class, e.g. lcl_AbapADP in case of ADP. Then the method will need to be called via method convert_field( ). on lcl_Abap in which abap coding blocks (or rather the token parameters of such blocks) are mapped to a method call. As you are going along with the interface setup, you will have to decide where to put additional methods for coding blocks. Will it go into the lcl_Abap or the lcl_AbapADP which is specific to your interface. Mind you, moving coding from one to the other is no effort. The superclass subclass relation will make sure both locations are checked.

The abap coding blocks that are available at installation:

FIND_EARLIEST_DATE

ABAP:FIND_EARLIEST_DATE;P1:0001;DATE

This coding block will look up the first start date in a sequence of infotypes, where the end of an infotype and the beginning of the follow-up infotype show no gaps. The P1 or PARAM1 parameter will hold the infotype that needs to be checked. Note that the DATE option is also involved, as the outcome of this coding block is a date.

In method convert_field( ) the option parameter (or token parameter) is checked and method find_earliest_date( ) is called to determine the field value.

HR_LEAVING_DATE

ABAP:HR_LEAVING_DATE;DATE

A coding block to determine the leaving date for a person. As the outcome is a date, the DATE option is also added.

LOONCOMPONENT

ABAP:LOONCOMPONENT;P1:7001;P2:0014;P3:T510J

The value of a looncomponent can be retrieved via the LOONCOMPONENT coding block, which will search the fields in infotype 0008 or the instances of infotypes 0014 and 0015 for the looncomponent specified via P1. The P2 and P3 parameters are optional. If you know where the looncomponent should be picked up from, the infotype can be specified with P2. Then there are a few options that can be controlled via P3. The parameter can be either T510J or ANZHL. The first setting will look up the value in table T510J for an infotype 0014 specification. The ANZHL option can be used to indicate you need a percentage instead of a value.