Skip to Content

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 guru’s knowing this function but this blog will be helpful to new comers in SAP… 🙂

So what’s it about… It’s about creating screen variants for SAP transactions with dynamic selections as desired.

Take an example of widely used QM transaction-QA32.

1.JPG

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. I’m 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.

2.JPG

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.

3.JPG

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.

4.JPG

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

5.JPG

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”.

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, LE- Less or EQUAL: Everything <= Value in Field LOW, GT- Greater Than: Everything > Value in Field LOW, GE- Greater or Equal: Everything >= Value in Field LOW and LT-Less Than: Everything < Value in Field LOW.6.JPG7.JPG

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).

8.JPG

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

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.

10.JPG

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

Click on ‘SAVE’ & go back. Select your Variant to check.12.JPG

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.13.JPG

System will ask for date values as below.

14.JPG

Press Enter.

15.JPG

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

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

17.JPG

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

To report this post you need to login first.

45 Comments

You must be Logged on to comment or reply to a post.

    1. Andrea Fuschetto

      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

      (0) 
      1. Thomas Zloch

        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

        (0) 
        1. Andrea Fuschetto

          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

           

          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

          (0) 
          1. Thomas Zloch

            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 Z-function module that would contain the calculation logic), but enhancements there are forbidden by SAP with a hint to “central basis” component.

             

            Thomas

            (0) 
            1. Andrea Fuschetto

              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

              (0) 
    1. Anup Patil Post author

      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.

      (0) 
  1. Ken Snyder

    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

    Last day of previous month

    Last Day of the Current Month

    (0) 
  2. Ken Snyder

    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.

    (0) 
    1. Sven Ringling

      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.

      (0) 
      1. Thanga Prakash

        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.

        (0) 
        1. Thomas Zloch

          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

          (0) 
  3. Dave Thomas

    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

    (0) 
  4. Poonam Chawla

    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.

    (0) 
    1. Anup Patil Post author

      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

      (0) 
  5. Shashank Agarwal

    Hello All,

     

    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

    (0) 
    1. Anup Patil Post author

      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.

      (0) 
  6. John McKee

    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

    (0) 
  7. Ellon Alves

    Hello,

     

    Need your suggestions to understand what am I doing wrong here.

    I use a ZZ T-code which provide me a list with Purchase Orders, then I created a Variant to display only the last working day PO’s created, and it is working well as your guidance above.

     

    The problem appeared when I created a daily basis Job on SM36, to run this Variant with the dynamic date, the result list of the Job display always the same day as the Job creation date, instead of getting updated after the days past by.

     

    If someone can help me with this, it will be of great assistance.

     

    Best regards

    (0) 
  8. karan kothari

    Hi

    I am having requirement to create screen variant for a transaction that is executed based on fiscal year parameter. I want to make it dynamic.

    For eg. if I run the transaction today then it should executed for current fiscal year “-2”.

    How we can do the same? Please Guide!!

    Thanks
    Karan 

    (0) 

Leave a Reply