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

Need to create Dynamic Varient

Former Member
0 Likes
1,005

Hi,

Need to create Dynamic Varient

My Requirement is :

When the program runs on last day of the month, varient has to be set up to populate the

the File path as :

/PA1/Interfaces/FlatFiles/new_sales_history.txt

When the program runs on Working day + 1, then the other varient has to be set up to populate the File Path as :

/PA1/Interfaces/FlatFiles/sales_history.txt

Can anybody let me know how i can create Dynamic Varient...?

Any suggestions will be appreciated!

Regards,

Kittu

1 ACCEPTED SOLUTION
Read only

former_member203501
Active Contributor
0 Likes
980

hi check the run date...and do like this ...

initialization.

if v_rundate = 'last day of the month'..

p_file = 'PA1/Interfaces/FlatFiles/new_sales_history.txt '

else.

p_file = '/PA1/Interfaces/FlatFiles/sales_history.txt'

endif.

Hi,

Need to create Dynamic Varient

My Requirement is :

When the program runs on last day of the month, varient has to be set up to populate the

the File path as :

/PA1/Interfaces/FlatFiles/new_sales_history.txt

When the program runs on Working day + 1, then the other varient has to be set up to populate the File Path as :

/PA1/Interfaces/FlatFiles/sales_history.txt

Can anybody let me know how i can create Dynamic Varient...?

Any suggestions will be appreciated!

Regards,

Kittu

6 REPLIES 6
Read only

former_member203501
Active Contributor
0 Likes
981

hi check the run date...and do like this ...

initialization.

if v_rundate = 'last day of the month'..

p_file = 'PA1/Interfaces/FlatFiles/new_sales_history.txt '

else.

p_file = '/PA1/Interfaces/FlatFiles/sales_history.txt'

endif.

Read only

Former Member
0 Likes
980

Hi,


data : p_filepath(50).
data : l_date type sy-datum,
g_date_last type sy-datum,
g_date_1 type sy-datum.
At initialisation.
" calc last day of month and store in g_date_last
"calc workday + 1 and store in g_date_1
l_date = sy-datum.

if l_date = g_date_last.
p_fielpath = '/PA1/Interfaces/FlatFiles/new_sales_history.txt '.
endif.

if l_date = g_date_1.
p_filepath = '/PA1/Interfaces/FlatFiles/sales_history.txt '.
endif.

Read only

Former Member
0 Likes
980

Hi,

Thank you for your quick response.

I cannot hardcode the path of the UNix file.....

The user still may want to fill up the Path manually.....

So if you know the way to create Dynamic Varients then please let me know...

Can you let me know the Tcode for creating varients...?

Thanks & Regards,

Kittu

Read only

0 Likes
980

Consider the following option:

1) Create two parameters on selection screen. One for working day file and another for working day + 1 file.

2) Use logic inside program to determine if working day or not. Accordingly use the correct file name (from parameter).

3) Users can override the file parameters online. If needed, when the program is run online (SY-BATCH = ' '), issue a confirmation popup for the file to be used.

I am not sure "dynamic variants" is the way to go here because you will have to build another program/process of updating it everyday. But here is information about it anyways...

To create customer defined variables to be used in a variant, you will have to create it in table TVARV. See the following two links for further information:

http://help.sap.com/saphelp_45b/helpdata/en/c0/980398e58611d194cc00a0c94260a5/frameset.htm

https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/creatingdynamicvariantusingtable+TVARV

Read only

0 Likes
980

Hi Kittu , when you are creating the job create two variant... end, end+1

schedule one job with variant end on every end of month

schedule another job with variant end+1 every end of month + 1.

or let the user create a variant and save it.

Read only

Former Member
0 Likes
980

Thank you for your response!

The information provided was helpful..

Regards,

Kittu