Skip to Content
0
Nov 07, 2012 at 01:22 AM

Batch job picking up wrong default date using SAP default date function

1255 Views

First of all - ECC 5 system, not ECC 6

Second of all, system USED to be set up for the GMT time zone but isn't anymore

Third of all, a different ID runs this in batch than me but I don't have it's SU3 defaults but am trying to get them

Fourth of all, the system is now set to UTC-5 time zone as a default

Fifth of all, our BASIS person is in the UTC+1 zone

six of all, my defaults are UTC-5 time zone ( same as system )

I have a custom program that runs in batch. One of the input parameters ( not a range - a parameter ) is a date field. We set up a variant to feed the current date to the job using the "D - Dynamic Date Calculation" and asking it for the current date ( no offsets ).

The program stopped working awhile ago, and I couldn't for the life of me figure out why. So the first thing I did was throw in some WRITE statements. After I got that to production I took a look at the spool output and noticed that it's picking up the FOLLOWING day which is worthless because I don't want things that haven't happened yet.

The job is part of a multi-step job, so then I thought it might have gone over midnight so to speak - but according to SM37 in all instances, the step ran well before midnight, so that wasn't it. It's not an hour off either, some steps ran before 11 PM and others ran after, so that's not it. The first step in the job always runs at 19:30 EST and the 2nd step always runs right after it's done ( anywhere from 22:18 to 23:45 ). In no case did it ever return the correct date, it's always the next day.

If I run the job as my user at the same time, it works. Only when the job runs with this batch ID does it work differently. As I mentioned above, I am in the process of obtaining for that user what their defaults are as maybe that is causing it.

My current theory is that in ECC 5 the system uses SY-DATLO for when it wants the date as opposed to SY-DATUM and that the special user is set up with their timezone in UTC-0 which would push it over the next day. I can't schedule an earlier run because of the same reason I can't change the code easily. I am also in the process of asking for FF access to do this should my BASIS team not be able to do so.

Has anyone ever been caught in this situation and/or seen it and dealt with it?

If you need more information don't hesitate to ask and I can try to get it