Sei sulla pagina 1di 15

Enterprise Resource Planning (SAP ERP):

Dynamic date selection in Variants


Posted by Anup Patil Jul 24, 2012
Dear All,
While answering one of the post related to screen variant creation/setup for SAP transactions,
I thought of preparing a small document on the same and sharing the same on forum. It might
be possible that most of the SAP gurus knowing this function but this blog will be helpful to new
comers in SAP :-)
So whats it about Its about creating screen variants for SAP transactions with dynamic
selections as desired.
Take an example of widely used QM transaction-QA32.

Generated by Jive on 2016-03-28+02:00


1

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants


Above QA32 screen has a field-Lot Created On, with a date range already populated on initial
screen. So how these dates are appearing? And can I set my own date range here? Can I have
any other fixed value on the same screen e.g. Plant ? Number of questions can come up in
mind
To answer, yes, a respective user can set his/her own variant with specific values. Im planning to
explain it below, with few screenshots.
On Tcode-QA32 screen, click on SAVE. System will display an existing variant as below, showing a variable
set for a particular field, if any.
Put your own Variant Name along with meaning.

As seen on above screen there are few functions available as SAP standard in variant attributes. E.g.
- Only for Background Processing: If you select the field Background only, the variant can only be executed in
the background. Otherwise, it can be run both in the background and online.
- Protect Variant: If you select this field, the variant can only be changed by the person who created it or last
changed it.
Based on requirement one can select/deselect it.
Search for the field on which a dynamic/variable date needs to be setup. Go to column-Type of selection
variable (Third from right hand side) and click on the dropdown icon or press F4 to show the popup menu for
the selection variable.

Generated by Jive on 2016-03-28+02:00


2

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Double-click on the line D for dynamic date calculation. Selecting 'type of variable' is nothing
but we are declaring the field which need dynamic date calculation.

To mention a dynamic value, we need to select a Variable. Click on the dropdown icon or press F4 on columnName of variable to show available selection variables.

You need to select a sign field which allows to enter either "I" or "E".
"I" (Inclusive) means that the single value or range you specified is selected itself.
"E" (Exclusive) means that the single value or range you specified is excluded from the selection.
The default is "I".

Generated by Jive on 2016-03-28+02:00


3

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Along with the sign field, need to select 'Option'. With the operators in this field, you specify whether the
entered values are to be used as a single value, range, or search string for limiting data selection. Possible
operators are: EQ- Equal: Single Value, NE- Not Equal: Everything Apart from the Specified Single Value, LELess or EQUAL: Everything <= Value in Field LOW, GT- Greater Than: Everything > Value in Field LOW, GEGreater or Equal: Everything >= Value in Field LOW and LT-Less Than: Everything < Value in Field LOW.

Once you fill in selection variables on screen, click on 'SAVE'.


On transaction selection screen, click on tab-Get Variant (Shift+F5) and select your own variant. Depending
upon selection variables, system will populate a particular field with required values (as below).

Similarly, you can even choose other operators and check effect.

Generated by Jive on 2016-03-28+02:00


4

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

I chose option operator as 'Less Than' and variable as 'Current Date +/- ??? days'. System will come up with a
pop-up window and ask value for days.

Put value with sign - in order to have date in past from current date whereas sign + for future
date.

Generated by Jive on 2016-03-28+02:00


5

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Click on 'SAVE' & go back. Select your Variant to check.

In addition to above, we can chose a variable to set a date range. For the same, choose Variable
name: Current date xxx, current date + yyy.

Generated by Jive on 2016-03-28+02:00


6

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

System will ask for date values as below.

Press Enter.

Generated by Jive on 2016-03-28+02:00


7

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Click on save and go back (F3). Select your variant.

And you will see dates as per Variable selected (shown below).

Similar way, one can try different options of variables.


Along with it, just by adding field values on initial screen and saving the variant, system will put some fixed
values. E.g. one can have his/her Plant as fixed value in his/her variant.
Hope this will help.
Thanks & Regards,
Anup
48658 Views Tags: screen_variants

Ananth Thiruvengadam
Feb 19, 2016 10:52 AM
Very Useful
Anup Patil in response to John McKee on page 9

Generated by Jive on 2016-03-28+02:00


8

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Sep 25, 2015 4:45 PM


Hi John,
Thanks for your comments above. Also to mention, I never tried this function in SE16N but shall check.
Thanks.
Swati Kaushal
Jul 16, 2015 2:14 PM
Really good stuff.. thanks
John McKee
Jul 10, 2015 7:21 AM
Hi
This is excellent material here.
However, I would like to know how we can use this with the updated data browser SE16N?
I have a requirement to run an extract for some HR data from table PA0001.
I want to extract all records where End Date is greater than the current date -1 and Start Date is less than
Current date +1, effectively status as at today, eg ENDDA > 09.07.2015 and BEGDA <11.07.2015 meaning
status as at 10.07.2015 - but to have this update dynamically at run time.
I know how to do this in SE16 and save as a variant using Dynamic Date Calculation.
But how do you do this with and SE16N variant and schedule with SE16N_BATCH. I can't find where to store
these parameters with SE16N?
Can this be done?
John McKee
Anup Patil in response to Shashank Agarwal on page 9
Jan 14, 2015 8:40 PM
Hi Shashank,
I've given printscreen of the requirement same as yours & definitely it would work.
Could you please check again in my blog about this & try?
Thanks.
Poonam Chawla in response to Anup Patil on page 10
Jan 10, 2015 10:14 AM
Thank you Anup
Shashank Agarwal
Jan 9, 2015 4:24 PM
Hello All,

Generated by Jive on 2016-03-28+02:00


9

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

My requirement is to select the variant "Current date + 0 , Current date + 50" in working days but when i
select the variant Date - xxx, Date + yyy(work days), it doesn't work.
Could anyone help or give any suggestion regarding this?
Thanks,
Shashank
Jimmy Dahl Pedersen
Nov 19, 2014 2:18 PM
Exactly what I needed Thank you :-)
Anup Patil in response to Poonam Chawla on page 10
Nov 8, 2014 10:48 PM
Hi Poonam,
You can simply put in date value as 'greater than or equal to 01/23/2013 (your fixed date)' in date field and I
think it should work.
So whenever you run your report/program, system will take documents from that date (01/23/2013) to current
date on which you're executing it.
Hope it helps.
Thanks.
Kind Regards,
Anup
Kashi Yadaram
Oct 9, 2014 10:55 PM
Excellent...wish I know this before.
Kashi
Poonam Chawla
Oct 9, 2014 8:28 PM
Hi,
I have a requirement for date range where the first date is fixed (01/23/2013) and last date is current date
which varies depending on sy-datum.
Which option will help me to get this resolved.is it possible with dynamic selection screen?
Kindly reply.
Mary Milliron
Sep 9, 2014 7:55 PM
Thank you. Learned something new today.
sreehari tokala
Aug 6, 2014 12:33 PM
nice document but i need Segment field where i can get his field.

Generated by Jive on 2016-03-28+02:00


10

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Andrea Fuschetto in response to Thomas Zloch on page 11


Jul 9, 2014 4:15 PM
They must have used different programmers for APO because it is very different than ECC. I see tons of other
choices in ECC, but only the ones I listed above in APO.
I'm going to post in an APO forum and see what suggestions I get.
Thanks for the response, though.
Andrea
Daniel Lippmann
Jul 9, 2014 4:05 PM
I knew about this before, but it's great to have it written down. Great post!
Thomas Zloch in response to Andrea Fuschetto on page 11
Jul 9, 2014 3:57 PM
I don't know in what way APO is special in this regard. For "normal" selection variants there is a function
module RS_VARI_V_INIT which collects the available options for dynamic date calculation.
I have SAP_BASIS 700 to 731 systems here, and all have the option I quoted above. What is your SAP_BASIS
level?
I once had the idea to enhance this function module to include a new option at the end (driven by a new Zfunction module that would contain the calculation logic), but enhancements there are forbidden by SAP with a
hint to "central basis" component.
Thomas
Andrea Fuschetto in response to Thomas Zloch on page 12
Jul 9, 2014 3:34 PM
Hi Thomas:
I wish I had that option. In APO (mc90 and also in lcout), these are my choices. (I'm selecting from Current
Date row, which is about 7 or 8 down in the list):
Current Date
Current date +/- ??? days
current date +/- ??? work days
First day of current month
nth working day of current month
First day of next month
First day of previous month
Last day of previous month
Last Day of the Current Month

Generated by Jive on 2016-03-28+02:00


11

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Do you know how I can get the "Beginning of mth-xx-months, end of mth+yy months" option to show? That
would be perfect and exactly what I need.
Thanks.
Andrea
Thomas Zloch in response to Andrea Fuschetto on page 12
Jul 9, 2014 9:12 AM
At the bottom of the choices for dynamic date calculation, I can see
"(Beginning of mth-xx months, end of mth+yy months)"
Try this for your scenario.
Thomas
Andrea Fuschetto in response to Anup Patil on page 15
Jul 8, 2014 5:35 PM
Hello Anup:
I'm changing my Planning area in both DP and SNP from 2 years to 5 years in monthly buckets. I need to
release my forecast from DP into SNP for all buckets. In the variant, I see the choice for "Current day +/days". When I try to enter any value over 1000 days, I get an error saying it can't accept it (too long).

Entry too long (enter in the format __~V)


It appears that only 3 characters are accepted, so 999 is my limit. But this is only 33 months instead of 60
months.
Do you know how I can get an option to enter "Current month +/- months"? Then I could say "60 months"
I'm using /n/sapapo/mc90 to release the fcst from DP to SNP.
Thanks.
Andrea
Douglas Lin
Jun 19, 2014 4:31 AM
Thanks Anup , this is really helping me to understand the dynamic data .
Narayana N
Apr 19, 2014 8:13 PM
Dear Anup,

Generated by Jive on 2016-03-28+02:00


12

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Good effort

keep it up

Regards,
Narayan N
Dave Thomas
Apr 15, 2014 11:35 AM
Thanks, great post. I have a report which requires a date range including a working day and a non-working
day. I need the 'date from' to be working day - 1 and the 'date to' being yesterday.
This is so that on a Monday, document postings from Friday to Sunday are picked up. Does anyone know if
this is possible via SQ02 if not in the variant?
Thanks
Thomas Zloch in response to Thanga Prakash on page 13
Mar 19, 2014 2:22 PM
But this means you want everything up to 19.03.2013. You can set "LE" (less or equal) as "option" for the
dynamic date variant "current date +/- ??? days" and that should do it.
Thomas
Thanga Prakash in response to Thomas Zloch on page 13
Mar 19, 2014 2:04 PM
If I do like that I will end up like below.
Created on 19.03.2013 TO <blank>.
My requirement is like FROM should be the initial date and TO should be current date - 365 days like.
Created on <blank> TO 19.03.2013.
Thomas Zloch in response to Thanga Prakash on page 13
Mar 19, 2014 1:50 PM
You would rather do it like "Date LE <Current date - 365 days>" using only the FROM date.
Thomas
Thanga Prakash
Mar 19, 2014 1:41 PM
How can I create a dynamic variant for date only in TO, like below.
Date <BLANK> TO <Current date - 365 days>
Sven Ringling in response to Ken Snyder on page 14
Jul 28, 2013 11:37 PM

Generated by Jive on 2016-03-28+02:00


13

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Hi Ken,
I happened upon this post only now, but maybe it's still interesting for you:
if you need any additional variables, you can define them yourself in table TVARVC.
I the popup "choose selection variables" shown above you select T rather than D to access those variables.
However, you now need to take care of them being updated yourself. Could be manually in transaction
STVARVC or SM31, but usually you'd have a custom ABAP running in Batch every night (or whatever
frequency is needed) to update the values.
In older versions (R/3 4.5, if I remember correctly, not sure about APO), it was TVARV rather than TVARVC.
The old table was not client dependant.
Samy Magdy
Jun 26, 2013 12:33 PM
Nice one.
Pawan Kesari
Jun 21, 2013 3:08 PM
Good document.
Subrahmanyam B
Jun 21, 2013 2:36 PM
Dear,
Very informative !!
Ken Snyder
Oct 18, 2012 12:06 AM
Actually its in APO. But I am asking how to create new ones in general. What if I wanted a new dynamic
variable for end of the year. I know I can use TVARV variables. But is it possible to create new dynamic date
variables.
Jeevan Sagar in response to Ken Snyder on page 14
Oct 17, 2012 11:36 PM
What version of SAP are you on?
Ken Snyder
Oct 17, 2012 9:42 PM
How do I get all the dynamic date variables. For instance, I do not have any that say "quarter". I only have
these:
Current Date
Current date +/- ??? days
current date +/- ??? work days
First day of current month
nth working day of current month
First day of next month
First day of previous month

Generated by Jive on 2016-03-28+02:00


14

Enterprise Resource Planning (SAP ERP): Dynamic date selection in Variants

Last day of previous month


Last Day of the Current Month
Anup Patil in response to Jason Duncan on page 15
Jul 28, 2012 4:38 PM
Thanks Jason for your appreciation and apologies for posting this a bit late... :-)
But still you can go-in and change/overwrite your existing variants in SAP.
Thanks again.
Jason Duncan
Jul 28, 2012 2:50 AM
Great post here. I wish I had this the first time I had to setup a variant. It would have made it much easier.
Amit Talekar in response to Anup Patil on page 15
Jul 27, 2012 2:11 PM
Good job
Anup Patil
Jul 27, 2012 12:55 PM
Forgot to mention but comments will be appreciated... Thanks.

Generated by Jive on 2016-03-28+02:00


15

Potrebbero piacerti anche