Blogs / SAP / SAP BW/HANA / SAP BW/4HANA / Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

Sep 25, 2020

SHARE

AMDP scripts are widely used these days to achieve the idea of code pushdown in HANA. To incorporate the code pushdown mechanism in BW transformations, we can replace ABAP code with AMDP scripts.

This blog is a continuation of the “Converting ABAP code into AMDP scripts in SAP BW transformations – Part 1”. Here, you can find some more commonly used ABAP functions and some tips and tricks that can be used to convert these ABAP codes into their AMDP counterparts in BW transformations.

Extracting parts of a string

In ABAP, any part of a string can be extracted easily with the help of the “OFFSET” function. Similar string manipulations are achieved in AMDP using the function “SUBSTRING”, which allows us to specify the start and end positions of the part to be extracted. In the example below, we separate parts of a string into two different output columns.

ABAP

Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

AMDP

Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

In many BW transformations, we come across scenarios where a string needs to be split into two different strings based on the location of a separator (like space, comma, etc.). An example of splitting a string based on “SPACE” separator is shown below.

In ABAP, “SPLIT” function together with AT addition enables us to split any string into two parts. This functionality can be achieved in AMDP using SUBSTRING along with “LOCATE_REGEXPR” function that identifies the position of the separator, which is ‘/s’ (space) in this case.

ABAP

Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

AMDP

Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

Removing leading zeros

Removal of leading zeros, that is the zeros attached to the beginning of a number, can be important in many cases that deal with numbers in a specific format. In ABAP, usually, the “ALPHA” function module is used to remove the leading zeros from any column. In AMDP, the same functionality can be achieved using the “LTRIM” function. This helps in removing all the zeros that are attached to the beginning of a number.

ABAP

Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

AMDP

Converting ABAP code into AMDP scripts in SAP BW transformations – Part 2

Some more complex ABAP functions and the tips to convert them into AMDP scripts in BW transformations will be discussed in the upcoming blog.

Know more about Visual BI Solutions SAP BW Services offerings here.


Corporate HQ:
5920 Windhaven Pkwy, Plano, TX 75093

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com


Copyright © Visual BI Solutions Inc.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This!

Share this with your friends and colleagues!