04-19-2015 7:08 AM
Dear All,
Is there any Formula that we could use and convert SAP system Date to LDAP time Format.
Ex: SAP Date : 18.06.2015 Time 21:00:00 (UTC+3)
Required Output : 130790484000000000 ( LDAP Format).
Bala.M
04-19-2015 7:26 AM
The LDAP date format is number of 100s of nanoseconds since 12:00 a.m. January 1st 1601. To convert it to an ABAP date:
1. Create a timestamp constant of that initial date (i.e. CONSTANTS c_time_base TYPE timestamp = 16010101120000.)
2. Add your ldap number to this c_time_base in another timestamp variable.(my_timestamp = c_time_base + ldap_value ).
3. Use CONVERT keyword to convert the timestamp to date and time.
04-19-2015 7:26 AM
The LDAP date format is number of 100s of nanoseconds since 12:00 a.m. January 1st 1601. To convert it to an ABAP date:
1. Create a timestamp constant of that initial date (i.e. CONSTANTS c_time_base TYPE timestamp = 16010101120000.)
2. Add your ldap number to this c_time_base in another timestamp variable.(my_timestamp = c_time_base + ldap_value ).
3. Use CONVERT keyword to convert the timestamp to date and time.
04-19-2015 7:48 AM
Hi Mathew,
I want to convert SAP Date to LDAP Value.
The Above isn't working and I want it the other Way.
Convert 18-june-2015 to LDAP Format.
Bala
04-19-2015 12:41 PM
Do it the other way then. Convert 18-june-2015 to a timestamp using CONVERT then subtract c_base_time.
04-19-2015 12:50 PM
I have done this way.
SAP Provided FM to get seconds CCU_TIMESTAMP_DIFFERENCE.
I used the same Logic and got this result and solved my problem
Thankyou so much.
DATA : v_data_ad(18) TYPE n ,
ls_date TYPE sydatum ,
ls_date1 TYPE sydatum ,
ls_time TYPE sy-uzeit ,
ls_time1 TYPE sy-uzeit.
ls_date = '16010101'.
ls_date1 = '20150618'.
ls_time1 = '210000'.
ls_time = '120000'.
v_data_ad = ( ( ls_date1 - ls_date ) * 86400
+ ( ls_time - ls_time1 ) ) .
v_data_ad = v_data_ad * 10000000 .
Final Result : v_data_Ad = 130790286000000000.
04-19-2015 12:55 PM
Now code it as CONSTANTS with meaningful names. If you don't know why you should do that, read this: http://c2.com/cgi/wiki?MagicNumber
04-19-2015 1:01 PM
04-19-2015 1:19 PM
Not just "can". "Should".
Not using constants would be bad programming.
04-19-2015 1:22 PM