‎2009 Jun 25 6:25 AM
Dear Experts ,
I am facing Date Time Problem , the problem is :-
My process is working fine except for example:-
Date is : 25.06.2009 Time 23:59:55
But during program execution the system saves date 26.06.2009 , which according to system has to be 25.06.2009, This only happens for last minute ex. between 23:59:00 to 23:59:59
So what will i do to save the record in the same date.
Ankesh Jindal
‎2009 Jun 25 6:29 AM
Hi ankesh,
Hope you have used SY-DATUM and SY-UZEIT.
If your system date is 26.06.09 it will show 26.06.09.
As concerned to time if that is the issue check with basis they will help you with server date & time.
Re,Manas
‎2009 Jun 25 6:29 AM
You can do one thing..
Check the time in code as below :
if time = '23:59:59'.
date = date - 1.
endif.
‎2009 Jun 25 6:42 AM
What fn module are you using. Can you give technical details
‎2009 Jun 25 6:46 AM
Well i think the problem is that you might be assigning system Date and Time to your variables, too soon in your code before you update/insert into database table. If that is the case then assign the system Date and time to your variables just before your Update Database Table code...
‎2009 Jun 25 7:07 AM
To Naresh :-
This logic cannot be applied bcos at that time system date is coming right but at the time of appending into table it is being changed by new date.
To Tripal Singh :-
Yes u r rite but it is a long process and we cant help the code to run near where databse is commiting
so the code will run there only ...
To Manas k Mishra
Hve already discussed the same issue with basis guy
To SugirdaNishanth
I am not using any FM .
Ankesh
‎2009 Jun 25 7:29 AM
Hi Ankesh,
SELECT * UP TO 1 ROWS
FROM zmailhist
WHERE vbeln EQ p_vbeln AND
kunnr EQ p_kunnr.
ENDSELECT.
IF sy-subrc = 0.
wa-vbeln = p_vbeln.
wa-kunnr = p_kunnr.
wa-vsura = sy-uzeit.
wa-erdat = sy-datum.
INSERT INTO zmailhist VALUES wa.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
CLEAR:wa.
I have used this piece of code to update my ztable with date & time. It works fine.
See if this helps you...Or plz paste your code.
Re,Manas
‎2009 Jun 25 8:34 AM
Oh! You have the Vice-Versa problem to what i was thinking, The Database has value of one day after than current date during last minute... Strange...
I was thinking that the database commit takes time and therefore Date has changed by that time but your variable have previous date...
Some Basic Points here
1) How much avg. run time does your program takes.
2) Where and when are you assigning the Date and time to variables.
3) When does the database commit occurs.
‎2009 Jun 25 9:16 AM
Hi,
may be you are directly using sy-datum value in the update code, which gets executed only on commit... due to which after 23:59:59, the value of sy-datum changes to the next date.......
in this case its better not to use sy-datum in the update code.... instead declare a local date variable and assign its value to sy-datum before the update code gets executed...... and then use that local variable instead of sy-datum in the update code which gets executed on commit.........
Regards,
Siddarth
‎2009 Jun 25 10:13 AM
hi ankesh ,
Check your code while saving and validate using such condition
as your update of date is correct when time is < 23:59:00 .
then add this condition i.e if time between 23:59:00 to 23:59:59 then sy-datum .
Regards
Deepak .
‎2009 Jun 29 10:30 AM
I got Soln for my problem . I used
GET TIME STAMP <Var-Name>.Thanks