Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Changing filepath name(Sel. Screen parameter) in batch job

sarbajitm
Contributor
0 Likes
1,781

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.

1 ACCEPTED SOLUTION
Read only

Subhankar
Active Contributor
0 Likes
1,126

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.

7 REPLIES 7
Read only

Former Member
0 Likes
1,126

Instead of putting it on the selection screen, determine the file name dynamically at the INITIALIZATION event.

Rob

Read only

Subhankar
Active Contributor
0 Likes
1,127

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

Read only

Former Member
0 Likes
1,126

>

> 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

Read only

0 Likes
1,126

Hi Subhankar,

Can you post a code snippet for setting variant attribute?

Also thanks to both of you.

Regards,

Sarbajit.

Read only

0 Likes
1,126

Hi Rob,

I have to keep it in the Selection Screen as it is a business user requirement :).

regards,

Sarbajit.

Read only

Former Member
0 Likes
1,126

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

Read only

ThomasZloch
Active Contributor
0 Likes
1,126

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