2006 Apr 10 4:16 PM
hello everyone,
Is there a way I can default sy-datum and sy-uzeit in TVARV table, so that whenever the user uses the variant, current date and time pops up for end-date and end-time?
I am using 4 variables as variants: begin date, begin time, end date, end time.
Requirement is that whenever the report is run, end date and end time needs to be sy-datum and sy-uzeit. And next time when the report is run, end date and end time need to be moved into begin date and begin time, and end date end time will again become sy-datum and sy-uzeit. The reason for this is to load deltas.
Your help is greatly appreciated.
Thanks in advance.
Regards,
Fred.
2006 Apr 10 4:24 PM
Store LAST_RUN_DATE & LAST_RUN_TIME entries in TVARV table.
In the intialization event.
Retrive LAST_RUN_DATE & LAST_RUN_TIME from TVARV table & initialize to begin date & begin time.
And intialize end date & end time to system date & time.
At the end of the program update LAST_RUN_DATE & LAST_RUN_TIME entries in TVARV table to system date & time.
hello everyone,
Is there a way I can default sy-datum and sy-uzeit in TVARV table, so that whenever the user uses the variant, current date and time pops up for end-date and end-time?
I am using 4 variables as variants: begin date, begin time, end date, end time.
Requirement is that whenever the report is run, end date and end time needs to be sy-datum and sy-uzeit. And next time when the report is run, end date and end time need to be moved into begin date and begin time, and end date end time will again become sy-datum and sy-uzeit. The reason for this is to load deltas.
Your help is greatly appreciated.
Thanks in advance.
Regards,
Fred.
2006 Apr 10 4:22 PM
HI Fred,
Going by your requirement, I think you need to have a Z table which holds the last run date and last run time for that program.
In you program, you can default the parameters accordingly in the initialization section.
Initialization.
select single *
from Ztable
into ztable
where progname = <program name>.
p_start_date = ztable-last_run_date.
p_start_date = sy-datum.
.
.
at last in the program ,you should update the z table again with the run date and run time .
ztable-last_run_date = sy-datum.
ztable-last_run_time = sy-uzeit.
insert ztable.
2006 Apr 10 4:24 PM
Store LAST_RUN_DATE & LAST_RUN_TIME entries in TVARV table.
In the intialization event.
Retrive LAST_RUN_DATE & LAST_RUN_TIME from TVARV table & initialize to begin date & begin time.
And intialize end date & end time to system date & time.
At the end of the program update LAST_RUN_DATE & LAST_RUN_TIME entries in TVARV table to system date & time.
2006 Apr 10 4:25 PM
Hello Fred,
You can do by Import / Export also.
Import the date and time in Intialization and Export the date and time after your processing completes.
Regards,
Naimesh.
Reward points, if it is useful..!
2006 Apr 10 4:34 PM
hi naimesh,
i had considered the option for z-table before, but since SAP provides the tvarv table, z-table is eliminated.
I think i will try what vijay has told me and see if it is working fine.
thanx.
regards,
fred.
2006 Apr 10 7:20 PM
The values are not automatically updated to the database. You have to do that in your program as
UPDATE tvarv SET low = sy-datum
WHERE name = LAST_RUN_DATE
AND type = 'P'.Do the same for the time. It is very important to note the date and time after you do the select because, if you wait until the end of your program and if your program runs for a long time, you may lose anything that is updated/created between the time you last selected and the time when you update TVARV.
For example, let us say you are searching for something that is created or updated after 10:00:00 on april 10th 2006. Let us say you come to your select statement at 10:30:00 and select all the records between 10 and 10:30, and start the rest of the processing. You come to the point where you update TVARV. Your program took, say 3 minutes to reach this point. If you update TVARV with the current time, you will update TVARV with 10:33:00. But if there are additional updates/creates that happened in those 3 minutes, you will looose them. That is why you should always store the date and time at the point right after the select statement, to be as close as possible.
Also if you are on version 47 or higher, SAP introduced a new table TVARVC that is client dependent as compared to the client-independent TVARV table. This is particularly important if you have access restrictions to update client-independant tables.