Variable default period should be currenct fiscal period

Expert's,
Here is a requirement from ousite folks.where in the variable default should be current fiscal period.
I have to write  a code in CMOD.Please any one give the code so, that I can pasted and modify based on my requirment.
Points will definitely assigned .
Thanks in advance.
vasu.

Hi Vasu,
<u><b>Sample Code.</b></u>
When <Variable Name>
Data : l_p_range_test   TYPE rrrangesid.
data: l_peri like T009B-POPER,
        l_year like T009B-BDATJ.
IF I_STEP = 1.(This is for default value) before query execution.
--> use following function module to derive period from system date(sy-datum)
  CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
  EXPORTING
    I_DATE               = sy-datum
    I_PERIV              = <Fiscal variant>
IMPORTING
   E_BUPER              = l_peri
   E_GJAHR              = l_year
EXCEPTIONS
   INPUT_FALSE          = 1
   T009_NOTFOUND        = 2
   T009B_NOTFOUND       = 3
   OTHERS               = 4
  Concatenate l_peri l_year into  l_p_range_SSS-low.
  l_p_range_test-sign = 'I'.
  l_p_range_test-opt  = 'EQ'.
  APPEND l_p_range_test TO e_t_range.
endif.
Just written code, check datatypes and systax check.
Hope it Helps
Srini

Similar Messages

  • Error while running a query-Input for variable 'Posting Period is invalid

    Hi All,
    NOTE: This error is only cropping up when I input 12 in the posting period variable selection. If I put in any other value from 1-11 I am not getting any errors. Any ideas why this might be happening?
    I am getting the following error when I try and run a query - "Input for variable 'Posting Period (Single entry, mandatory)' is invalid" - On further clicking on this error the message displayed is as follows -
    Diagnosis
    Variable Posting Period (Single Value Entry, Mandatory) is used as a lower limit (X) and an upper limit () in an interval selection. This limit has the value #.
    System Response
    Procedure
    Enter a different value for variable Posting Period (Single Value Entry, Mandatory). If the value of the other limit is determined by another variable, you can change its value also.
    Procedure for System Administration

    OK.
    Well, if the variable is not used in any interval selection, then I would say "something happened to it".
    I would make a copy of the query and run it to check if I get the same problem with period 12.
       -> If not, something is wrong in the original query (you can proceed as below, if changes to original are permitted).
    If so, then try removing the variable completely from the query and hardcode restriction to 12.
       -> If problem still persists, I would have to do some thinking.
    If problem is gone, then add the variable again. Check.
       -> If problem is back, then the variable "is sick". Only quick thing to do, is to build an identical variable and use that one.
    If problem also happens with the new variable, then it's time to share this experience with someone else and consider raising an OSS.
    Good luck!
    Jacob
    P.S: what fisc year variant are you using?
    Edited by: Jacob Jansen on Jan 25, 2010 8:36 PM

  • Error that "specify a value for variable posting period (single value entry

    hi
    My query is running testing fine in RSECADMIN under some username..but when i try and open it using analyzer (under same username) it gives me error that "specify a value for variable posting period (single value entry, mandatry)" it does'nt even asks to enter variable values and gives this error message.
    However the same query appears to be working fine under different username.
    plz advise.

    Hi Abhinav,
    Just do one thing compare the Roles of two different users for which Query is getting executed and not.
    Check the Object S_RFC.
    Compare the Objects detail for Both the Users.
    Please Assign points if useful.
    Regards,
    Rajdeep.

  • BW Query variable default value put in Crystal report variable question

    Why BW Query variable default value put in Crystal report variable for BO InfoView to open crystal report.
    I using Analyzer to open bw query,variables had default value ,but crystal report can't had variable default value ,and can't search variable  value.
    pho:
    [http://file.itpub.net/f/e38876ad4f6efb7e73980488e7d71f8d/4ae940e9/day_091029/20091029_2b04da1232144feba180OrB23SNvXtoT.gif/p/1.gif]
    [http://file.itpub.net/f/d93ddfe61e0eaf80429726c61f1a02ff/4ae940e9/day_091029/20091029_3211ffe04bf0302fbab5FRKnbwmH80p7.gif/p/BW_QUERY_Crystal.gif]
    Edited by: flying on Oct 29, 2009 8:20 AM

    I Know what to do .
    but Crystal report date variable value are Garbage characters "###".
    PHO:
    [http://file.itpub.net/f/39a8510104476707ae21c945db93ecba/4ae97949/day_091029/20091029_32dcbb7e7d99141483aesJ9KBJHXN0Kj.gif/p/2.gif]

  • When should I use static variable and when should not? Java essential

    When should I use static variable and when should not? Java essential

    Static => same value for all instances of the class.
    Non-static => each instance can have its own value.
    Which you need in which circumstances is completely up to you.

  • What is a Transient Variable and when should it be used

    Hello everyone,
    I just want to know the details regarding the transient variable and when should we use it. what is the significance of this variable?

    Transient variables are not written out when the class is serialized.
    http://java.sun.com/docs/books/tutorial/essential/io/providing.html

  • How to set variable default value by program?

    Dear all,
    We would like to set a BW variable default value by program (not using query designer).
    Do you have any ABAP sample code for this? I'm really new in ABAP programming.
    we are using BI 7.0
    Thank you for your help!
    Olivier DESFOUR

    Hi Olivier,
    FOllowing is the code which defaults calmonth to first month of the year to current month - 1.
    Data : input1(4) TYPE n,
           input3(2) TYPE n.
    WHEN 'YQV_FD'.
      if i_step = 1.
      input1 = sy-datum+0(4).
      concatenate input1 '01' into l_s_range-low.
      input3 = sy-datum+4(2) - 1.
      concatenate input1 input3 into l_s_range-high.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'BT'.
      APPEND l_s_range TO e_t_range.
      endif.

  • Authorization variable defaults to "Exclude"

    Dear Experts,
    We are encountering a user request to have the authorization variable with multiple single values default to "Exclude" instead of "Include" when showing in Portal.
    We have set the plant with Authorization variable representing Multiple Single Values, when we integrated the query to EP, the variable is default to "Include" the authorized plant.
    e.g. UserA is authorized to view the data of PlantAA, PlantBB, PlantCC
    While logon to portal,
    the Vairable is displayed as:
    Plant: PlantAA - Include
             PlantBB - Include
             PlantCC - Include
    How is possible to change the default include to "Exclude'
    like,
    Plant: PlantAA - Exclude
             PlantBB - Exclude
             PlantCC - Exclude
    Thanks for all the inputs!

    Thanks for the reply,
    you kinda misunderstand my question.
    I want to achieve a default "Exclucde" instead of "Include" when calling Authorization variable plant.
    For instance, a particular user is authorized to view 20 plants, he wants the report to display all authorized plant, yet instead of default to including all 20 plants, he wants the report default to Excluding all 20 plants, therefore, he could simply include the plants he is interested in.
    Yet, sadly, I couldn't find a place to change the authorization variable defaults to EXCLUDE.

  • Variable to load data upto a fiscal period

    Hi gurus ,
       i had created a customer exit variable Such that it gives the data from first month of the fiscal year to the period which is feed by the user in  a user entry variable 0P_FPER.
    our fiscal year start from october  (2009001).
    let user feed  the value in  a user entry variable 0P_FPER = 2009003  (dec 2008).
    so According to my code it should pickup the data from 2009001 to  2009003.
    but my code is giving data from 2009001 to current month (2009004).
    i am not good at Abap, so there may be some error in my code.
    plz check my  code  shown below, and plz throw some light.
    WHEN 'ZCE_YTFP'.
            clear l_p_range_SS1.
        DATA:  V_YEAR9(4) TYPE n,
               v_fsyear10(7) TYPE n,
               V_fsyear11(7) TYPE n.
      CLEAR loc_var_range .
      IF i_step = 2.
      LOOP AT i_t_var_range INTO loc_var_range.
        IF loc_var_range-vnam = '0P_FPER'.
    V_fsyear11 = loc_var_range-low.
    V_YEAR9 = loc_var_range-low+0(4).
    Concatenate V_YEAR9 '001' into v_fsyear10.
    l_p_range_SS1-Low =  v_fsyear10.
    l_p_range_SS1-high = V_fsyear11 .
    l_p_range_SS1-Sign = 'I'.
    l_p_range_SS1-Opt = 'BT'.
    APPEND l_p_range_SS1 TO e_t_range.
    endif.
    endloop.
    Endif.
    Thanks.

    Hi Surabh,
    try rhis
    WHEN  u2018ZCE_YTFP' '.
        IF I_STEP = 2.
          LOOP AT I_T_VAR_RANGE INTO loc_var_range  WHERE VNAM = '0P_FPER'.
           V_fsyear11 = loc_var_range-low.
            CONCATENATE V_YEAR9 -LOW+0(4) '001' INTO  v_fsyear10-LOW.
                         l_p_range_SS1-Low = v_fsyear10-LOW.
                         l_p_range_SS1-high = V_fsyear11-SIGN .
                         l_p_range_SS1-Opt = 'BT'.
    APPEND l_p_range_SS1 TO e_t_range.
    endif.
    Rgds
    SVU123
    Edited by: svu123 on Jan 24, 2009 9:13 PM
    Edited by: svu123 on Jan 24, 2009 9:16 PM

  • Variable - Default to current period but allow input fomr user??

    Hello All,
    This may be a simple question.... I am not sure....
    I'd like to have a variable for a report where the user can select the fiscal period.  Creating this variable is not a problem.  The problem is that I would like for the variable to default with the current period.
    The best solution is for the variable to be displayed with the current period as the default selection but give the user the ability to overwrite this default value on the variable selection screen.  Can this be created as a customer exit variable?  We have tried this but can't get the variable to prompt the user and give them the option to overwrite when it is customer exit.
    thanks
    rodney
    Edited by: Rodney on Feb 26, 2008 10:14 PM

    Hi Rodney,
    Yes, I think you can use a customer exit variable for this. However, you need to set the code to I_STEP = 1 when you set the date to sy-datum. What happens is that at I_STEP = 1, the default value pops up in the variable screen. Then, your user can opt to change this value or just use the default value. If your user wants to change the value in the selection screen, it automatically overwrites the default value.
    Hope this helps,
    Juice

  • IH08 default period values

    Hi Gurus!
    How do i set the specific value of the start (and end dates) of the IH08 transaction to the current system date? is there something needed to be done in SU3 or SPRO?
    Thanks in advance!
    Hans

    Hiii
    You can set the transaction variant using the specific value of the start (and end dates) for the period field. Try with the transaction SHD0 to create the transaction variant for IH08.
    I think this will solve your problems.
    Regards
    Makarand Gurjar

  • Infopackage:Determine the variables for periodic data loading

    Hi,
    we have an infopackage for full update and we have set in "Data selection" tab as selection , an OLAP variable.
    If I do the load using the  OLAP variable selection, 12 last months , I need to delete data can be duplicated. But for example, If I do mensually load ,  I can't delete the request has been load just before , because I delete one month that can't be deleted. I have looking for a possible solution , but I don't how I can solve this.
    Please, can anybody help me?
    Carolina

    Carolina.
       I think your existing data flow is : Source --> Cube.
    Now change this one to : Source --> ODS(load monthly last 12 months) --> Delta(Cube).
    No need to delete any data selectively if you load data in overwrite mode. ODS will generate change log if any changes occur or creates new records for new records. Just push delta from this ODS to CUBE monthly.
    Srini

  • Variable default values

    Hi Experts,
    I am using a variable for Date From to Date to in my Query.  I had used the variable 0I_SPL_D which supplies two date Period from / Period To. My requirement is to give default values at run time from beginning of the month to current date of execution.
    So that I can schedule the Query and Broadcast it.
    eg If the report is run today ie on 22.0ct.2009 then both the ends must have the values
    from date 01.10.2009 and
    to date     22.10.2009
    If the report is executed tomorrow the parameters should be
    from date 01.10.2009 and
    to date     23.10.2009
    can any one give any idea
    Thanks
    Shivani

    Hi,
    Try this code.
    WHEN 'Zvariable'
    DATA: from_dy(2) type n,
               from_mo(2) type n,
               from_yr(4) type n,
               from_d(8) type n,
               Date_to TYPE sy-datum.
        IF i_step = 1.
          from_dy(2) ='01'.
          from_mo = sy-datum+4(2).
          from_yr = sy-datum+0(4).
          concatenate from_yr from_mo from_dy into from_d.
          Date_to = sy-datum.
          CLEAR l_s_range.
          MOVE from_d TO l_s_range-low.
          MOVE Date_to TO l_s_range-high.
          MOVE 'I' TO l_s_range-sign.
          MOVE 'BT' TO l_s_range-opt.
          APPEND l_s_range TO e_t_range.
        ENDIF.
    Regards,
    Rk.

  • For selection parameter the default date should be of the previous month.

    Hi all,
    In my selection-screen what i want is  for the selection parameter "Selection period month" the default value to be the previous month.
    For example today is 24.09.2008 so the default value of this field has to be 200808 instead of 200809 today.
    please tell me how should i do this.
    thanks in advance.

    Hi,
    Check the following code:
    data: f_date type sy-datum,
          f_dd(2) type c,
          f_mm(2) type c,
          f_yyyy(4) type c,
          f_pdt type sy-datum.
    parameters: p_date like sy-datum.
    initialization.
    f_date = sy-datum.
    f_dd = sy-datum+6(2).
    f_mm = sy-datum+4(2) - 1.
    f_yyyy = sy-datum+0(4).
    if f_mm eq 0.
    concatenate f_yyyy '12' f_dd  into f_pdt.
    elseif f_mm eq 1 or
       f_mm eq 2 or
       f_mm eq 3 or
       f_mm eq 4 or
       f_mm eq 5 or
       f_mm eq 6 or
       f_mm eq 7 or
       f_mm eq 8 or
       f_mm eq 9.
    concatenate f_yyyy '0' f_mm f_dd  into f_pdt.
    else.
    concatenate f_yyyy f_mm f_dd  into f_pdt.
    endif.
    p_date = f_pdt.
    start-of-selection.
    write : / f_date,
             / f_pdt.
    Regards,
    Bhaskar
    Edited by: Bhaskar Chikine on Sep 24, 2008 12:49 PM

  • Variable to display data from Current Fiscal Year to the MONTH entered

    Hi Friends,
    In the Quey Designer I require a CHARACTERISTIC VARIABLE for the 0CALMONTH which should have the following features:-
    1.Input Month(e.g JUN 2008)
    2.Mandatory
    3.Ready for Input
    The query should show the following OUTPUT:-
    The data should be displayed from the CURRENT FISCAL YEAR to the value of the Input MONTH entered.
         e.g For Input  =  DEC2008
               Output = from APRIL 2008 to DEC2008.
    Do we have a standard variable for this or we have to go for a Customer Exit??
    Thanks in Advance!!!
    Vivek

    Hi,
    Create a customer exit as follows.
    WHEN 'ZCMTD'.
    you variable name
    data: ZCMTD_LOW like sy-datum.
    ZCMTD_LOW = sy-datum.
    ZCMTD_LOW+4(2) = '04'.
    *replacing last two symbols (month) in the current month with '04'
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW = ZCMTD_LOW.
    *initializing low interval limit
    L_S_RANGE-HIGH = SY-DATUM.
    *initializing high interval limit
    L_S_RANGE-SIGN = 'I'.
    *defining interval as inclusive
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDCASE.
    Thanks,
    Ashok

Maybe you are looking for