2011 Jan 20 6:27 PM
Hi,
I have to develop a program which will run daily as a batch job.Seletion Screen of the program have a parameter for application server file.
The filename will be changed daily based on the current date(as the file will come from some other source).We know that while creating a batch job we have to give the name of a variant. If we create a variant today which have Application server file(File name contains today's date) then when the batch job run tommorrow it will process today's file again instead of the new file which will come tomorrow.I want to know how to handle everyday's new file through the batch job.
Thanks in advance.
Regards,
Sarbajit.
2011 Jan 20 7:21 PM
Yes, as Rob already advised, you need to do the coding intilization event. Also you need to change the existing variant attribute.
If you go to the variant attribute there is one column 'Save field Without values'. You need to check this field for your file parameter. Otherwise it will overwrite/suppress the initilization event code.
Thanks
Subhankar
Hi,
I have to develop a program which will run daily as a batch job.Seletion Screen of the program have a parameter for application server file.
The filename will be changed daily based on the current date(as the file will come from some other source).We know that while creating a batch job we have to give the name of a variant. If we create a variant today which have Application server file(File name contains today's date) then when the batch job run tommorrow it will process today's file again instead of the new file which will come tomorrow.I want to know how to handle everyday's new file through the batch job.
Thanks in advance.
Regards,
Sarbajit.
2011 Jan 20 7:13 PM
Instead of putting it on the selection screen, determine the file name dynamically at the INITIALIZATION event.
Rob
2011 Jan 20 7:21 PM
Yes, as Rob already advised, you need to do the coding intilization event. Also you need to change the existing variant attribute.
If you go to the variant attribute there is one column 'Save field Without values'. You need to check this field for your file parameter. Otherwise it will overwrite/suppress the initilization event code.
Thanks
Subhankar
2011 Jan 20 7:34 PM
>
> Yes, as Rob already advised, you need to do the coding intilization event. Also you need to change the existing variant attribute.
>
> If you go to the variant attribute there is one column 'Save field Without values'. You need to check this field for your file parameter. Otherwise it will overwrite/suppress the initilization event code.
>
> Thanks
> Subhankar
No - I meant it should not even be on the selection screen.
Rob
2011 Jan 20 7:35 PM
Hi Subhankar,
Can you post a code snippet for setting variant attribute?
Also thanks to both of you.
Regards,
Sarbajit.
2011 Jan 20 7:39 PM
Hi Rob,
I have to keep it in the Selection Screen as it is a business user requirement :).
regards,
Sarbajit.
2011 Jan 20 8:02 PM
Hi Sarbajit,
Like Rob mentioned change the filename dynamically.
Define it as a parameter on the selection screen.
Create a text-symbol with the file name/path which contains a place holder for the date.
At the event at selection-screen output replace the place holder with the current date (local either system).
I believe that this should also work in batch mode. However on the safe side you can always replace the file name at a latter event as well as in case the place holder was already replaced, the file name/path will not change.
Kind regards,
Robert
2011 Jan 20 9:57 PM
Also look into using logical file names, transaction FILE. Date is just one of many variables that can be replaced dynamically. See SAP online help or FM FILE_GET_NAME for further information.
Thomas