How to Convert Timestamp to String in ABAP
SAP timestamp values are stored in fields with decimal data types. In ABAP to convert timestamp to string programmer can use function modules.
ABAP function module RRBA_CONVERT_TIMESTAMP_TO_STR given in this tutorial is an example to display time stamp field values in character or string data representations.
In SAP sales documents VBAK table, there is a field named UPD_TMSTMP with data element TIMESTAMPL for storing last change date and time in UTC time stamp long form (YYYYMMDDhhmmssmmmuuun).
In my development SAP system, in VBAK table you can see sample rows with timestamp values in below screenshot.
ABAP programmers can work on such sample sales order data to convert timestamp field to string expression as we will do in this ABAP tutorial using below shared codes.
ABAP Function Module to Convert Timestamp to String
ABAP developers can use the function module RRBA_CONVERT_TIMESTAMP_TO_STR to convert timestamp values to string easily.
Let's make a test.
In this example, since ABAP function module RRBA_CONVERT_TIMESTAMP_TO_STR accepts timestamp input parameter in short form we will convert UPD_TMSTMP field value from long form to short form.
The output is as "22.03.2016 08:32:44" for the above ABAP code execution which programmers can use to convert timestamp to string or character variable.
You can check your ABAP code test results by switching to VA03 Sales Order Display transaction with your sample VBELN number. Then following top menu options "Environment > Changes" display changes on sales document sorted by "time of change". The last change will be the output of above ABAP function module RRBA_CONVERT_TIMESTAMP_TO_STR.