Tricky dynamic date variant in ABAP query

Hello All,
In an abap query there is a date field in the selection screen with from & to values.
I am trying to create a dynamic variant that will fill the following data into those fields:
From date: will be left blank
To date: will show today's date - 90 days
For example, if today's date is 01/12/2006 the variant should fill the following data into the fields:
From date: <blank>
To date: 01/09/2006
I have tried all the methods I know with dynamic dates calculation in the variant definition but did not manage to create such variant.
Any help will be very appreciated and points would be rewarded generously !
Thank you very much,
Ronen

If the "from" date is meant to be left blank (beginning of time) and the "to" date is some date plus or minus number of days from today, you use the "current +/- days" dynamic date calculation format as was mentioned earlier.  Likewise if the "from" date is some date plus or minus today's date, and the "to" date is infinity -- you only need the one Dynamic Date calculation.
To do this, first don't think about this as a date range, think of your Dynamic Date calculation as if this were a single parameter and not a select-option.  You are really saying "my date is anything LT/LE this date" or "my date is anything GT/GE this date" -- not a range
In the Save Variant screen, find the desired date select-option and:
1. Choose in column "Selection Variable", a "D" (Dynamic date calculation)
2. Use F4 in the "Name of Variable" column
3. Find "Current date +/- ??? days" or "Current date +/- ??? work days" in the popup, as appropriate
4. For "I/E" (include/exclude) column select as appropriate
5. For "Option" column, choose "LE", "LT", "GE", "GT", "NE" as appropriate
6. After clicking green check mark, enter your plus or minus days (and factory calendar if using work days).
7. Finish saving your variant.
8. You may not see your changes in your variant until you back all the way out of the variant and then redisplay it.  You'll see a greyed out date along with the symbol matching your choice (LT, LE, etc.)
Unfortunately if you don't have infinity on either end of the date you are limited to 999 days differences as far as I am aware.  If that is the case you can populate TVARVC table with parameter or selection variables, maintain them with STVARV transaction by hand, or use an ABAP program in batch to regularly calculate the values.  Then you can reference the TVARVC values in your variant instead of the Dynamic Date calculation.
If someone knows a way to bypass the use of TVARVC for date ranges that are more than 999 days apart please let me know.  TVARVC works well but it is extra effort whereas Dynamic Date calculation would be much easier to maintain if the date range could be made larger than 999 days.

Similar Messages

  • Dynamic Date Variant in SAP ver 3.1

    How to create a dynamic date variant in SAP ver 3.1 ?

    Hi,
    I guess that you know how manage dynamic dates in a variant. (Please, tell me if you need help about it)
    You can try with two DATUM type fields in the ABAP program. Fix the first one with a fixed date u201901.01.2009u2019 and the second one will be fixed with the dynamic date u2018Current Dateu2019
    Regards,
    OLA

  • Dynamic date variant

    Hi Gurus,
    I've a dynamic system date variant for my program, which runs in background. I have no issue with variant, it works fine. But when I went to job log to check the old jobs that has dynamic date variant, it always refer to current system date. Anybody can suggest me how to fix it to show the actual variant at the time of job run?
    Regards, Raju.

    The dynamic date overwrites the value that it was saved with at the time of processing.  What you see when you display it is the value at the time it was saved (the non-dynamic value).  There is no way to see the value at the time it was run.  At least not that I know.
    You can however compute it if you know that the variant hasn't been changed since it was run.
    Neal

  • Dynamic Date Variant for SAP Job

    Hi Guru
    We have a program to be ran in the Background .
    I am unable to create a Variant for Date ( Current year Jan 01st to  Current Date).
    Could you please advice how to create a Variant with Dynamic Date Calculation for above date range.
    Thanks in Advance.
    Thanks
    Ravi

    Hi,
    I guess that you know how manage dynamic dates in a variant. (Please, tell me if you need help about it)
    You can try with two DATUM type fields in the ABAP program. Fix the first one with a fixed date u201901.01.2009u2019 and the second one will be fixed with the dynamic date u2018Current Dateu2019
    Regards,
    OLA

  • Short Dump While selecting Variant for ABAP query

    Hi,
    ABAP query is going to short dump (CONNE_IMPORT_WRONG_COMP_LENG) while selecting a Variant. If i create and use variant then i am able to see Output of Variant.But not able to use Earlier created variants .
    I think some mismatch between variant values and selection screen fields.Can anyone tell me how to rectify this ?
    I am not able to debug the code as dump is coming in a System program(RSDBSPVD).Can anyone tell me which database table i can use to get values of the Variant.
    Thanks in Advance.
    Nirmala K

    Hi nirmala,
    chk the links:
    http://help.sap.com/saphelp_webas620/helpdata/en/c0/980398e58611d194cc00a0c94260a5/content.htm
    http://help.sap.com/saphelp_webas620/helpdata/en/c0/9803a7e58611d194cc00a0c94260a5/content.htm
    regards,
    keerthi.

  • Unable to access Archived data with an ABAP Query

    I have an ABAP Query that uses Logical Database KDF (Vendor) for reporting.
    KDF is Archive Enabled and I can access archived document via SAP standard programs that used the KDF Logical Database.
    the query appears accessing the data but nothing shows on the report.
    Has anyone successfully written and ABAP query and included access to the Archived data?
    Any help is appreciated.

    Hi Gena,
    I'm facing exactly the same problem as you...
    Since this post is an old one, I imagine that you may not remember, but I have to try...
    Have you solved it? If yes, could you please tell me how?
    I've tried to use CL_ABAP_GZIP and CL_ABAP_UNGZIP_BINARY_STREAM and I'm getting the same error 30 at the  IctDecompressStream function.
    Tks in advance,
    Flavio.

  • Dynamic date variant in selection screen

    I have a selection option s_date in my program where I want to use the dyanmic variant with.
    it is a date range and for the lower range, I would like to have a static value of 04/01/2010 and for the higher range I want to have last date of the prev month.
    I see last date of the prev month in the drop down (F4) Dynamic table, but selecting that is overwriting the s-date-low instead of s_date-high. How can I use the dynamic variant for this ? Can i create my own custom drop downs for these dates?
    S_DATE      FROM  (_04/01/2010_)  TO (LAST DATE OF PREV MONTH)
    Thanks in advance..

    In variant you can specify dates dynamically.
    When you save a variant, system ask you enter variant name and Meaning. On the same screen you can specify these dynamic values.
    For the parameter/select-option where you want to specify dynamic value, press F4 on 'Selection Variable' column.
    Choose type of variable as 'D' (Dynamic date calculation).
    Press F4 on 'Name of Variable(Input only using F4) column and select 'Current date +/- ??? days' on next screen.
    On input screen enter -1.
    Repeat same for To Date' field.
    Prabhudas

  • Picking Month from Date in ABAP query

    Dear All,
    I want to pick month from date in a abap query but it is giving error "BDTER" is not a valid comparison operator. comparison operator.
    Where i am wrong my query is below.
    SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP
    WHERE MONTH( BDTER ) = '12'.
    With Regards
    Ashwani K Mathur

    Dear Deepankar,
    Thanks for reply.
    Date fomat is yy/mm/dd (like 20071231) after your suggestion i have modified query.
    SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP
    WHERE  BDTER+4(2)  = 12.
    but while compiling it is giving error Field "BDTER+4(2)" unknown.
    Please suggest.
    Ashwani K Maathur

  • ABAP-query going in infinite loop

    Hello all,
    I have one on abap-query in which i am displaying data for delivery details that is table LIKP and LIPS.
    In this query i also have some code to get the sale order details from the  the delivery details.
    I have also used one FM module in this query as well as select endselet  stamt.
    When i run my quey it i going in infinite loop.  I am not getting any thing . Each time i have to exit the screen.
    Can anyone please tell me wat is the problem, why it is going in infinite  loop.
    Thanks and regards
    Sachin yadav

    thanks for your help,
    But may i know how to display my internal table data to out put screen.
    As i am new to the query i do not know how to display internal table data to report along with my data coming from ABAp-query.
    for eg i have three field to display suppose A , B and C.
    Field A and B are coming from query and i have to display field C from internal table.
    How to do that
    thanks in advance

  • F4 Help in ABAP QUERY

    Hi,
    Can we provide F4 help to  fields in Dynamic selections in an ABAP Query?
    Thanks
    Chandra

    Hi,
    Can we provide F4 help to  fields in Dynamic selections in an ABAP Query?
    Thanks
    Chandra

  • BEX to allow for the dynamic date on a variant as is the case with ABAP

    Hi All,
    I have doubt that where we are able to use dynamic date for BEX date variable?
    In normal ABAP program,We have option to get dynamic date for date field parameters.Like that can we have dynamic date for BEX date variable.
    Please let me know.
    Thanks in advance for your help,
    Bandana.
    Edited by: Bandana Baghel on Jul 3, 2009 10:44 AM

    Hi Bandana,
    When you say dynamic date, are you refering to the system date on which the BEx query run?
    If so, there are SAP Exit variable available which can be used to retrieve system date at run time.
    Try using 0DAT variable which will return the system date at run time.
    Regards
    Amit Roy

  • Query with variant from ABAP

    Hello!
    I need to execute a BW-query from an Abap-report.
    I tried it already with function module 'RRW3_GET_QUERY_VIEW_DATA' and with classes / objects 'CL_RSR_REQUEST' resp. 'CL_RSR_DATA', but:
    I want to use the query with a variant, which could be found in table RSRPARAMETRIZA.
    (Btw: even with a variant in table RSRVARIANTDIR  I don't get the results wanted...)
    Is there a direct way to call a BW-query with a variant from Abap?
    Alternatively: How do I get the variant-contents? Is there a 'universal' way to work with both kinds of variants? (RSRVARIANTDIR / RSRPARAMETRIZA) 
    Thanks in advance.

    Thanks for the link.
    Well, I already read that document and I followed the links to the former blogs on this subject.
    But this solution doesn't work for me: CL_RSR_QUERY_VARIABLES is unknown.
    I read the pdf and the function-module-code, but I still don't have an idea how to work with query- variants . The example-coding includes a line
    DATA: wf_variant TYPE variant .
    but that's not used, or is it?
    (I don't have a set of variables and conditions, but just a variant-name. The variant will be created by other people, who would start my report.)
    Greetings

  • Defining variant for report for job with dynamic date Gui 6.40 patch 21

    The system does not take over my choice for the dynamic date.
    I choose in the variant-attirubute-screen for a certain parameter: "type selection variable": D and then in the column "name of the variable" > I choose via F4: current date +/- days. OK and then I fill in 1 or 1- or whatever.  The system however does only react with the message "Upper date of the interval is > than upper date". It does not matteer what I choose.
    In the initialization I do not have any initialization of that parameter.
    I connot save the variant.

    Go through this link...
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/802cfc454211d189710000e8322d00/frameset.htm
    In this page
    ABAP Workbench tools -->
                      VARIANTS  -->
                            VARIABLE VALUES IN VARIANTS.
    Hope this helps u a lot...
    reward if it helps u...
    sai ramesh.

  • Error in abap query sq03,02,01(to get data from structure) it is possible?

    hi
    experts,
    i am developing a report using abap query .(stand t code is s_alr_87012277 it contain more fields but i want only 4 fields , i found 2 but remaining 2 are from structure)
    my problem is that debit and credit amount is in structure
    how  i can get data from structure(FAGL_S_RFSSLD00_LIST )
    solbm = debit.
    habbm  = credit.
    report is like
    op.
    gl acc no, discription, credit amount,debit amount.

    Hi ajay,
    try to use with  logical database  SDF.
    assign the logical database name in info set.
    gl acc no    -               SKA1-SAKNR
    debit.         -     Field: um02h
    credit.        -     field:  um02s 
    discription  -               SKAT-TXT20
    regards,
    sateesh.

  • ABAP Query variant - Error during SE93

    Team,
    I am creating ztransaction codes for abap queries via SE93. Sometimes in SE93 error comes stating that Variant is required. I want to know the table name where this info/indicator/flag is maintained.
    I need this info to automate my BDC.
    Thanks
    Error Msg:
    Report AQ10CR==========35============ can only be started with a variant
    Message no. DB623

    Hi,
    Check in SQ01, there are options to set the ABAP query to be executed with varaint. If this check box is enabled then you can execute the query only with a varaint. So i believe its the setting in the query definition and not in Se93.
    Btw you can define or create a transaction code  in SE93 to run a query with the varaint as well.
    Let me know if you need more info.
    cheers
    VJ

Maybe you are looking for

  • Could not see loaded data in the Cube

    Hi Gurus, Pl. help me in this: I am not able to get teh data loaded into the cube. In PSA it is loaded right. after that I created Transformation on InfoCube and I got Proposal Generated. Then I created DTP and executed, and monitor shows green. but

  • Shipments/ Delivery Document tracking with Purchase Order

    Dear all, Please help me in finding all the shipments accessed against Purchase order or Delivery document information with the help of Purchase order. Is it possible to track either of them using PO? Please help.... Thanks & Regards, Deepthi.

  • Moving Music folder

    Hello, my problem is that I have multiple harddrives and since I was running out of room on one, I decided to move my music folder onto a different harddrive. Now whenever I try playing a song iTunes cannot find it, I was wondering if there was any w

  • Best way to add external hard drives

    Hi all! I have a fairly old iMac (2008). It only has 3 USB ports on the back. One is being used by my keyboard/mouse. One is plugged directly into an external hard drive. And the third is everything else... my digital camera cable, my printer, etc. I

  • NetBeans and Gimp don't launch

    I've reported that NetBeans works only command-line[1]. I've now noticed that also GIMP has problems on my machine, that's clicking on the icon twice will show it for a sec but then close. I therefore suspect there's something wrong with my mac, and