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 Kodyaz SAP and ABAP Programming Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




CRM Companies List
Web Based CRM Software


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.

The output is in form YYYYMMDDHHMISS

ABAP convert to timestamp using Date and Time






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table








Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems