SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Convert Date and Time to Timestamp in ABAP

ABAP programmers can join date and time values stored in SAP tables to convert datetime to timestamp using ABAP code sample given in this tutorial. In SAP, it is frequently seen that datetime values are stored as date and time parts seperately. ABAP developers can convert datetime values to timestamp data type easily.

For this tutorial, I will use the ERDAT and ERZET fields on SAP sales documents table VBAK.

convert to timestamp in ABAP

Here is our sample ABAP code to build timestamp variable from date and time parts (erdat and erzet fields) of SAP VBAK table.

DATA lv_vbeln TYPE vbeln VALUE '0100001418'.
DATA lv_timestamp_string TYPE string.

SELECT SINGLE erdat, erzet INTO @DATA(ls_datetime)
 FROM vbak WHERE vbeln = @lv_vbeln.

CONCATENATE ls_datetime-erdat+0(4)
  ls_datetime-erdat+4(2)
  ls_datetime-erdat+6(2)
  ls_datetime-erzet+0(2)
  ls_datetime-erzet+2(2)
  ls_datetime-erzet+4(2)
  INTO lv_timestamp_string.
WRITE: ls_datetime-erdat, ls_datetime-erzet, lv_timestamp_string.
Code

The output is in form YYYYMMDDHHMISS

ABAP convert to timestamp using Date and Time



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.