FORM get_x_last_chars USING iv_string
iv_num_last_chars TYPE i
CHANGING cv_result.
IF strlen( iv_string ) < iv_num_last_chars.
cv_result = iv_string.
ELSE.
cv_result = substring( val = iv_string
off = strlen( iv_string ) - iv_num_last_chars
len = iv_num_last_chars ).
ENDIF.
ENDFORM.
Category Archives: Uncategorized
ABAP – How to declare a variable dynamically
In case you need to create a variable dynamically during runtime with different type, length or precision, you can use the following piece of code to achieve the same – the variable is created dynamically based on given type, length and number of decimals. Continue reading
Secured FTP – ProFTP + TLS in Ubuntu
FTP is considered as very insecure protocol because all data transferred using this protocol is passed between client and server in clear text and can be hacked by someone listening on your line. But you can easily encrypt the whole communication by enabling/forcing TLS and make FTP much more secure. This article explains how to set up ProFTPd with TLS on an Ubuntu server. Continue reading
ABAP – Export Transport request to local file system
All development or customizing in SAP is written into a transport request unless it is a local object not intended to be transported ($TMP package). Sometimes it might be useful to backup your development but in SAP this task is quite complicated to export all programs, classes, standard texts, …
Therefore there is an option to export the whole development encapsulated on a transport request level. And that’s what this article is about – exporting development encapsulated in a transport request to local file system. Continue reading
ABAP – Validation of manual input
I faced a scenario where I had an ALV grid where all columns were made generic of type (let’s make it simple) CHAR255. Each column has its name in field catalog in format TABNAME-FIELDNAME (+ more human readable column header texts of course). What I needed to achieve was to make validation of data that user entered in the ALV cells. Since the cell validation is not available by default (because of type CHAR255) I had to make it dynamically.
In this article I’d like to share my solution Continue reading
ABAP – List of all available icons
To display all available icons in SAP ABAP just enter TCode SE38 and execute either program SHOWICON or RSTXICON. In the output report you can see their image representation together with corresponding code interpretation Continue reading
Test driven development in ABAP – Unit test classes
This article provides info about creation an ABAP unit test class that might significantly reduce the future maintenance cost at the testing level. The flow is simple – you design your functional tests in advance and then you create your code. You can run the test class repeatedly to tell you which tests still didn’t pass. Continue reading