23.1.11

SAP Note 18660 - Incorrect time in AL11 and ST11

Symptom:

Transaction AL11 displays the wrong time for files which were modified during summertime.

This problem also occurs in Transaction ST11.

Other terms

Time zones, environment variable TZ

Reason and Prerequisites

Operating systems save time stamps of files as the number of seconds since 1970 (GMT). When a file is displayed using the operating system command ls or dir, the time stamp is worked out in the local time which applied when the modification was made. In doing this, the operating system uses a list of the times at which summer time has changed to winter time and vice versa. This can be stored in various locations, depending on the operating system.
Transactions AL11 and ST11 have, up until now, only taken into account the summer or winter time which is currently applicable.
To determine whether to display summer or winter time locally, a static table is used in form routine P6_TO_DATE_TIME_TZ in program RSTR0400 up to Release 4.5B. In the first version, this table only covered the period until 1999. By means of a support package, this period was expanded until the end of 2002, by means of another support package until the end of 2005. Customers who cannot import those support packages, can expand the corresponding tables in the form routine as shown in the example below to be able to cover the same period.

Solution

Possible advance correction:

    1. Create a report in the customer name range (e.g. ZSUMMER), and enter the following.
    program zsummer.

    *---------------------------------------------------------------------*
    * form p6_to_date_time_tz *
    *---------------------------------------------------------------------*
    * --> gmtime seconds since 1970 (GMT) *
    * <-- asc_time middle european time, format '03:00:00' *
    * <-- asc_date middle european date, format '19971231' *
    *---------------------------------------------------------------------*
    form p6_to_date_time_tz using gmtime
    asc_time
    asc_date.

    constants: begin of on_dates,
    first_year(4) value '1990' ,
    first_dat(13) value '0325 03:00:00',
    year91(17) value '19910331 03:00:00',
    year92(17) value '19920329 03:00:00',
    year93(17) value '19930328 03:00:00',
    year94(17) value '19940327 03:00:00',
    year95(17) value '19950326 03:00:00',
    year96(17) value '19960331 03:00:00',
    year97(17) value '19970330 03:00:00',
    year98(17) value '19980329 03:00:00',
    year99(17) value '19990328 03:00:00',
    year00(17) value '20000326 03:00:00',
    year01(17) value '20010325 03:00:00',
    year02(17) value '20020331 03:00:00',
    year03(17) value '20030330 03:00:00',
    year04(17) value '20040328 03:00:00',
    year05(17) value '20050327 03:00:00',
    year06(17) value '20060326 03:00:00',
    last_year(4) value '2007' ,
    last_dat(13) value '0325 03:00:00',
    end of on_dates.

    constants: begin of off_dates,
    year90(17) value '19900930 02:00:00',
    year91(17) value '19910929 02:00:00',
    year92(17) value '19920927 02:00:00',
    year93(17) value '19930926 02:00:00',
    year94(17) value '19940925 02:00:00',
    year95(17) value '19950924 02:00:00',
    year96(17) value '19961027 02:00:00',
    year97(17) value '19971026 02:00:00',
    year98(17) value '19981025 02:00:00',
    year99(17) value '19991031 02:00:00',
    year00(17) value '20001029 02:00:00',
    year01(17) value '20011028 02:00:00',
    year02(17) value '20021027 02:00:00',
    year03(17) value '20031026 02:00:00',
    year04(17) value '20041024 02:00:00',
    year05(17) value '20051030 02:00:00',
    year06(17) value '20061029 02:00:00',
    year07(17) value '20071028 02:00:00',
    end of off_dates.

    data: diff type i,
    ofs type i,
    timezone type i,
    act_year(4),
    act_date(17),
    on_date(17),
    off_date(17).

    timezone = 0 - sy-tzone.

    perform p6_to_date_time(rstr0400) using gmtime
    timezone
    asc_time
    asc_date.

    act_year = asc_date(4).
    if act_year >= on_dates-first_year and
    act_year <= on_dates-last_year.
    act_date = asc_date.
    act_date+9 = asc_time.
    diff = act_year - on_dates-first_year.
    ofs = 17 * diff.
    on_date = on_dates+ofs(17).
    off_date = off_dates+ofs(17).

    if on_date < act_date and act_date < off_date.
    subtract 3600 from timezone.
    perform p6_to_date_time(rstr0400) using gmtime
    timezone
    asc_time
    asc_date.
    endif.
    endif.
    endform.
    * ---------------------- end of zsummer ------------------------------

The CONSTANTS keywords can be replaced with DATA, if the ABAP/4 interpreter which you are using does not yet recognize them.
The on_dates and off_dates tables contain the dates and times at which summer time begins and ends in the years 1990 - 1999 for Central European Time. You can change the data to suit the appropriate local time zone.
You can also extend the tables to include earlier and later years. In doing this, you must ensure that the first_year & first_dat and the last_year & last_dat elements are always the first and last elements respectively of the on_dates structure. Both tabls must also be extended symmetrically.

    2. In reports RSTR0006 (ST11) and RSWATCH0 (AL11) you should replace the following call for FORM routine p6_to_date_time:
perform p6_to_date_time(rstr0400) using file-mtime
timezone_sec
file-mod_time
file-mod_date.with
perform p6_to_date_time_tz(zsummer) using file-mtime
file-mod_time
file-mod_date.(the call occurs three times).

Alternatively, the corresponding internal tables can be adjusted to those in Form Routine p6_to_date_time_tz of Report RSTR0400. Until now, the tables only went to 1999. In Release 4.0B, this table has been expanded to 2003 with the latest Hot Package; a Hot Package for Release 4.5B will be issued soon.
Hot Packages: 4.0B: 50, 4.5D: 28

No comments:

Post a Comment