cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with synchronisation accountExpires attribute of active directory

daniella_rebel
Discoverer
0 Kudos

Hello,

We want to synchronize the Active Directory attribute 'accountExpires' with the field 'GLTGB' in SAP by using the program RSLDAPSYNC_USER.

When running the program the field 'GLTGB' is filled, but in most cases the value is very strange (e.g. 73.67.1290). The input value that is recieved from Active Directory is not a regular date format, but the number of 100-nanosecond intervals since 12:00 AM January 1, 1601 (e.g. 129067739400000000).

Does anyone know how to convert this value in SAP to a format which SAP can read?

Daniella Rebel

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I tried to apply the follow code:

v_data_ad = '129076488000000000' " Sample of AD Data

v_data_ad_conv = v_data_ad / ( 60 * 1440 * 10000000 ) - ( 299 * '365.24' ) + 1.

v_data_sap = ''19000101' + v_data_ad_conv.

In excel this formula works fine, but it doesnt work as it should in ABAP, there is a difference between 3 to 4 days.

If you improve it, please let me know.

Regards.

Diovani.

daniella_rebel
Discoverer
0 Kudos

Hi Diovani,

Thanks for your reply.

With the help of a collegue I found a solution: there are function modules to add a duration (for example a number of seconds) to a date and time.

I have used the function module TIMESTAMP_DURATION_ADD and the CONVERT-statement (to convert the result of the function module to my timezone).

See below for an example code:

DATA: seconds(11) TYPE n,
      date        TYPE sy-datum,
      time        TYPE uzeit,
      output      TYPE timestamp.
        
seconds = strange date value / 10000000.

CALL FUNCTION 'TIMESTAMP_DURATION_ADD'
     EXPORTING
         TIMESTAMP_IN  = 16010101000000
         TIMEZONE      = 'UTC'
         DURATION      = seconds
         UNIT          = 'S'
     IMPORTING
         TIMESTAMP_OUT = output.

CONVERT time stamp output TIME ZONE sy-zonlo
      INTO DATE date TIME time.

Daniëlla

Former Member
0 Kudos

Hi Daniella,

Great job!

Thanks for posting the code!

Faced the same issue, now working fine.

Keep it up!