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

Varient.,

Former Member
0 Likes
1,215

Hi,

I am new to SDN..

I have a requirement to save a varient to run a Program in background. The selection screen has a date field set as sy-datum. However due to some business changes the program should pick up data for the previous date, a day before the sy-datum field. When i save the varient is it possible to do this..

Thanks,

Shreekant.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,191

Yes, it is. First, run the program, click the save button, now you are at the variant screen. For the certain field, mark the check box for "Selection Variable". Then click the selection variables button on the app toolbar . Click the icon in the column defined as "D", for dynamic data calc. the icon should now be green, now click the down arrow under the "T" column. From the dialog, select the line for "Current Date +/- ??? Days". Click choose. Enter -1 and click green check. CLick save, then save again. Now choose your variant from the variant dialog, notice that the date field is now set to yesterday.

Regards,

Rich Heilman

13 REPLIES 13
Read only

Former Member
0 Likes
1,191

Hi,

Yes . Just write the logic in the AT SELECTION SCREEN event and you will be able to manipulate the date accordingly.

or you could just write it in the program itself.

Suppose p_date is your date parameter

p_date = p_date - 1.

Read only

0 Likes
1,191

Thanks,

I dont want to change the program.

Its already in PRD, I am trying to fix it without changing the program.

Shreekant

Read only

Former Member
0 Likes
1,191

it's not possible, change the program to take previous date in selection screen and save it as variant.

Read only

Former Member
0 Likes
1,191

Hi Shreekanth,

Check if you can specify a variable using Selection Variables in the variant attributes.

Check this link:

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

Regards,

ravi

Message was edited by: Ravi Kanth Talagana

Read only

Former Member
0 Likes
1,191

hi Shreekanth,

You can do that ..

There is a function for substract time from a date, days, months, year

use FM <b>SUBTRACT_TIME_FROM_DATE</b>

REgards,

Santosh

Read only

Former Member
0 Likes
1,191

Hi shree,

It is possible to set the predefined value to Date Field using the Dynamic Variant by maintaining the values to the Date fields in the Variant Attributes.

Thanks,

Satya

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,192

Yes, it is. First, run the program, click the save button, now you are at the variant screen. For the certain field, mark the check box for "Selection Variable". Then click the selection variables button on the app toolbar . Click the icon in the column defined as "D", for dynamic data calc. the icon should now be green, now click the down arrow under the "T" column. From the dialog, select the line for "Current Date +/- ??? Days". Click choose. Enter -1 and click green check. CLick save, then save again. Now choose your variant from the variant dialog, notice that the date field is now set to yesterday.

Regards,

Rich Heilman

Read only

0 Likes
1,191

Thanks Rich,

But I am a bit confused, in ur answer..

"For the certain field, mark the check box for "Selection Variable". where do i find this..

Shreekant

Read only

0 Likes
1,191

In the variant screen, where you are defining your variant, there should be a list of your selection-screen fields at the bottom, notice all of the checkboxes? Well here you need to check the box in the "L" column for your field. This tells the variant to allow a selection variable here.

Regards,

Rich Heilman

Read only

0 Likes
1,191

Thanks Rich..

Got everything done. But how would I test it without actually excuting the program in back ground.

I executed the program in SE38 and the selection screen shows the sy-datum.

Thanks again for your help.

Shreekant.

Read only

0 Likes
1,191

You must now select your variant. Click the button next to the "Execute" button, select the variant from the dialog, now you should see yesterday's date in your field.

Regards,

Rich Heilman

Read only

0 Likes
1,191

Thanks everyone for all the help,

Got it.

Shreekant

Read only

Former Member
0 Likes
1,191

Hi,

Sorry about that..

regds

dominic

Message was edited by: Dominic Pappaly