Customer exit on 0calday

Hi,
This is Madhavi. Plz help me to find out the solution for this.
Create an exit on 0CALDAY. Default this value to Be current Monday of the week and popup to user.Validate User input with the Monday of the week.If its not a Monday give an error asking to enter Monday of that week
Thanks and Regards,
Madhu

Hi,
Try the below code, this may help you.
  data:  l_curr_day     type SCAL-DATE,
         l_date         type /BI0/OICALDAY,
         l_no_day       type SCAL-indicator,
         l_day1         type P,
         l_diff         type P,
         l_daym         type /OSP/DT_DAY,
         l_day(2),
         l_month        type /BI0/OIFISCPER3,
         l_year(4),
         l_curr_month   type i,
         l_curr_year    type i,
         l_month_temp   type i,
         l_year_temp    type i,
         l_s_range      type  rsr_s_rangesid,
         l_s_var_range  type line of rrs0_t_var_range.
  if i_step = 1.  "Before Selection screen is shown
    l_curr_day    = sy-datum.
    l_curr_month  = sy-datum+4(2).
    l_curr_year   = sy-datum+0(4).
    CALL FUNCTION 'DATE_COMPUTE_DAY'
      EXPORTING
        DATE = l_curr_day
      IMPORTING
        DAY  = l_no_day.
    if l_no_day = 1.
      l_s_range-sign  = 'I'.
      l_s_range-opt   = 'EQ'.
      l_s_range-low   = l_curr_day.
      l_s_range-high  = ''.
      append l_s_range to e_t_range.
    else.
      l_day1 = sy-datum+6(2).
      l_diff = l_day1 - l_no_day + 1.
      if l_diff > 0.
        clear l_date.
        l_day = l_diff.
        l_month = l_curr_month.
        l_year = l_curr_year.
        concatenate l_year l_month+1(2) l_day into l_date.
      else.
        l_month_temp = l_curr_month - 1.
        if l_month_temp >  0.
          l_day = l_day1.
          l_month = l_month_temp.
          l_year = l_curr_year.
          concatenate l_year l_month+1(2) l_day into l_date.
          CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
            EXPORTING
              IV_DATE = l_date
            IMPORTING
              EV_DAYS = l_daym.
          l_diff = l_diff + l_daym.
          l_day = l_diff.
          concatenate l_year l_month+1(2) l_day into l_date.
        else.
          l_year = l_curr_year - 1.
          l_day = l_day1.
          concatenate l_year '12' l_day into l_date.
          CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
            EXPORTING
              IV_DATE = l_date
            IMPORTING
              EV_DAYS = l_daym.
          l_diff = l_diff + l_daym.
          l_day = l_diff.
          concatenate l_year '12' l_day into l_date.
        endif.
      endif.
      clear l_s_RANGE.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'EQ'.
      l_s_range-low = l_date.
      l_s_range-high =''.
      append l_s_range to e_t_range.
    endif.
  endif.
  if i_step = 3. " Validate user input
    read table I_T_VAR_RANGE into l_s_var_range with key vnam = 'YTSTDAY'.
    if sy-subrc = 0.
      l_curr_day    = l_s_var_range-low.
      CALL FUNCTION 'DATE_COMPUTE_DAY'
      EXPORTING
        DATE = l_curr_day
      IMPORTING
        DAY  = l_no_day.
      if l_no_day <> 1.
        raise NOT_MONDAY.
      endif.
    endif.
  endif.
endfunction.
regards
rajesh

Similar Messages

  • Create customer exit on 0calday

    Hi ,
    My requirement is i have to create customer exit variable on 0calday(characterstic). Default this value to current Monday of the week and popup to user.Validate User input with the Monday of the week.If its not a Monday give an error asking to enter Monday of that week
    For ex: if i give date like 20.09.2007 it should display from starting of the week (i.e monday) to till that date.
    PLz give me the instructions how to create
    Thanks and Regards,
    Madhavi

    The below code will check wether the user input is monday or not. If it is not monday it will identify the monday's date in that week.
    DATA: WEEKDAY LIKE SCAL-INDICATOR.
    CALL FUNCTION 'DATE_COMPUTE_DAY'
                    EXPORTING
                    DATE   = <calday>
               IMPORTING
                    DAY    = WEEKDAY
               EXCEPTIONS
                    OTHERS = 1.
          CASE WEEKDAY.
            WHEN '1'.  "Mon
              RESULT = <calday>.
            WHEN '2'.  "Tue
              RESULT = <calday> - 1.
            WHEN '3'.  "Wed
              RESULT = <calday> - 2.
            WHEN '4'.  "Thur
              RESULT = <calday> - 3.
            WHEN '5'.  "Fri
              RESULT = <calday> - 4.
            WHEN '6'.  "Sat
              RESULT = <calday> - 5.
            WHEN '7'.  "Sun
              RESULT = <calday> - 6.
          ENDCASE.

  • Customer exits (0calday) for a query to populate dates dynamically

    Hi,
    Our user has this requirement for running a reporting in background for every previous week and month which has 34 variants.
    Please tell if the way i choose is correct and also any suggestion for the below!...
    1. wanted to use reporting agent for running the report in the background with reporting agent+ webtemplates.
    2. and also wanted to get the dates populated dynamically in the report...so thought of using CUSTOMER EXITs.
    please help me with the code to write in CMOD. for populating the dates for every previous week and month dynmically.
    - jj
    Edited by: Jpjuvvan on Jun 1, 2009 8:36 PM
    Edited by: Jpjuvvan on Jun 1, 2009 8:39 PM

    Arun,
    The report has 34 variants for which the date ( 0calday)  RANGE has to be populated dynamically when I am running the report in the background using Reporting agent( using 'Precaculating of Web templates...as reporting agent setting).
    My concern is ..
    1.  How can I dynamically populate the dates(0calday) for running the report weekly and monthly for all 34 varinats in the report in the backgrond?( since dont want to manually enter the date range for all 34 variants of the report)
    2. Since I am using precalculating web templates as reporting agent setting should I have to create webtemplate on the query  ( if so ..will it automatically run the 34 variants) or should I create web template for 34 variants using  query views  ( even then the dates has to be populated automatically/dynamically)?
    For eg.    If I am running the report on 1s t June....for Monthly the date range should be 5/1/2009 to 5/31/2009 and for weekly I run the report on sunday of every week..so if i run the report on 6/14/2009 then the date range should be 6/5/2009 to 6/13/2009.
    The date range should be populated DYNAMICALLY , since I don't want to manulally give the date range for all 34 varinats every time I run the report.
    Please suggest.
    JJP

  • Customer exit Variable for Previous 12months Rolling based on 0calday

    Hi Experts,
    I am creating a Customer exit variable to derive Rolling 12 months based on calday,
    Could you please any body correct the below code,
    Or if you any body have pseudo code based on calday, could you please pass to me
      WHEN 'zcalday'.
    * Rolling 12 months to period
        IF i_step = 2.
          CLEAR: l_s_range, loc_var_range,
          LOOP AT i_t_var_range INTO loc_var_range
            WHERE vnam = 'RYEAR'.
       MOVE sy-datum TO: lv_date_from,
                                        lv_date_to.
               zmonth = lv_date_from+4(2)
           l_s_range-high = zmonth = loc_var_range-low.
            v_fiscper = v_fiscper - 12.
            l_s_range-low = v_fiscper.
            l_s_range-sign = 'I'.
            l_s_range-opt  = 'BT'.
            APPEND l_s_range TO e_t_range.
          ENDLOOP.
        ENDIF.
    Thanks and regards
    Sree

    Hi Yasemin,
    Thanks for your help,
    I have small clarification, I have following data in base cube,After restricting the customer exit variable
    on revenue I suppose I will get one Amount, i.e 7800, But If I want month wise, Do I need to create offset? or without creation of offset is there any way that will split based customer exit variable.....
    Thanks a lot
    regards
    Sree
    Execution date
    24/06/2014
    Comp Code
    Date
    Revenue
    C100
    01/07/2013
    100
    C100
    01/08/2013
    200
    C100
    01/09/2013
    300
    C100
    01/10/2013
    400
    C100
    01/11/2013
    500
    C100
    01/12/2013
    600
    C100
    01/01/2014
    700
    C100
    01/02/2014
    800
    C100
    01/03/2014
    900
    C100
    01/04/2014
    1000
    C100
    01/05/2014
    1100
    C100
    01/06/2014
    1200
    Total
    7800

  • Error in Customer Exit

    Hi Guys,
    I hope someone would be able to quickly point me in the right direction. I have the following error message:
    "Diagnosis
    This internal error is a deliberate termination, since a program status has arisen, that is not allowed to occur.
    The error has arisen for variable ZMOVETYP1 in the customer enhancement .
    Procedure
    Please check your customer enhancement.
    Procedure for System Administration"
    ZMOVETYP1 is of Variable Type=Characteristic, Processing= Customer exit, Variable represents=Multiple single values, variable is Optional, and NOT Input ready. Basically I want to use this variable in a FILTER on movement types in order to EXCLUDE certain movement types based on calendar VALIDTO date and company code.
    TRICKY part: how to send/load into l_s_range-low more than one value. Basically I want to exclude a PAIR of movement types each time. Either 301&302 , either 351&352.
    Below is the code:
      WHEN 'ZMOVETYP1'.
         IF i_step = 2.
            DATA: zcompcode TYPE /BI0/PCOMP_CODE-comp_code,
                  zvalidto TYPE sydatum.
            loop at i_t_var_range INTO l_t_var_range where vnam = 'ZMPD002'.
            endloop.
            if sy-subrc = 0.
    * select the upper part of the 0CALDAY interval, ZMPD002 is basically VALIDTO, based on validfrom-validto interval
    * specified by the user
             zvalidto = l_t_var_range-low.
            endif.
            loop at i_t_var_range INTO l_t_var_range where vnam = '0S_COCD'.
    * select the company code based on the user input
            endloop.
            if sy-subrc = 0.
             zcompcode = l_t_var_range-low.
            endif.
             if zcompcode = '1L01'.
               if zvalidto >= '01.11.2010'.
    * if validto date is bigger or equal to 01.11.2010 exclude from the filter the values 301 and 302
                l_s_range-low = '301'.
                l_s_range-sign = '*E*'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range TO e_t_range.
                l_s_range-low = '302'.
                l_s_range-sign = '*E*'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range to e_t_range.
               else.
    * if validto is lower than 01.11.2010 exclude from the filter the values 351 and 352
                l_s_range-low = '351'.
                l_s_range-sign = '*E*'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range TO e_t_range.
                l_s_range-low = '352'.
                l_s_range-sign = '*E*'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range to e_t_range.
               endif.
             endif.
         endif.
    Edited by: Dan on Dec 27, 2010 8:46 PM
    Edited by: Dan on Dec 27, 2010 8:48 PM

    try using the below code...
      WHEN 'ZMOVETYP1'.
         IF i_step = 2.
            DATA: zcompcode TYPE /BI0/PCOMP_CODE-comp_code,
                  zvalidto TYPE sydatum.
            read table i_t_var_range INTO l_t_var_range where vnam = 'ZMPD002'.
            if sy-subrc = 0.
             zvalidto = l_t_var_range-low.
            endif.
            read table i_t_var_range INTO l_t_var_range where vnam = '0S_COCD'.
            if sy-subrc = 0.
             zcompcode = l_t_var_range-low.
            endif.
             if zcompcode = '1L01'.
               if zvalidto >= '20101101'.
                l_s_range-low = '301'.
                l_s_range-sign = 'E'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range TO e_t_range.
                l_s_range-low = '302'.
                l_s_range-sign = 'E'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range to e_t_range.
               else.
                l_s_range-low = '351'.
                l_s_range-sign = 'E'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range TO e_t_range.
                l_s_range-low = '352'.
                l_s_range-sign = 'E'.
                l_s_range-opt = 'EQ'.
                APPEND l_s_range to e_t_range.
               endif.
             endif.
         endif.
    rgds, Ghuru

  • Problem in the variable customer exit in the query jump target

    Hi developers,
    we have problem because we have created a variable time on 0CALDAY who is mapped in the cube of the stock with posting date.We launch the query for example with range 01/8/2005 31/8/2005 and the resul is OK.
    Then we jump on the other query where the users wish see the result of the posting date for the period 01/8/2005 31/8/2005 For resolved this problem we have created a variable customer exit for the characteristic 0Postingdate and have inserted the code in user exit variable:
    WHEN 'ZV_CEREG'.
        IF i_step = 2.
          LOOP AT i_t_var_range INTO loc_var_range
                 WHERE vnam = 'Z_DAT_AN'.
            CLEAR l_s_range.
            CLEAR datastock.
            l_s_range-low  = loc_var_range-low.
            l_s_range-high = loc_var_range-high.
            l_s_range-sign = loc_var_range-sign.
            l_s_range-opt  = loc_var_range-opt.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    When we effectued the jump the our objective is transfer the date inserted by user in the variable  of the query sender 'Z_DAT_AN' to the variable of the query receveir 'ZV_CEREG'.
    This step it does not work correctly, this why are different query?
    You can help me for resolved this problem!!
    Thanks Domenico

    Hi,
    I think, this approach does not work. Because customer exit will be finished before displaying the result set of 1st report. So the assignment to VAR2 from VAR1 does not execute then after.
    I hope, In RSBBS,after assigning receiver, in the assignment details,select 'Variable' for 'Type' of 'infoobject' 0calday.And select '0Postingdate' for 'fieldname' and select 'selection options' for selection type.
    Take help.sap.com help for further information.
    With rgds,
    Anil Kumar Sharma. P
    Message was edited by: Anil Kumar Sharma

  • Why customer exit variable to grab the current month value doesn't work?

    In CMOD, input the following code to grab the current month value from the system date:
    Grab the month value with System Date
    WHEN 'CURMONTH'.
        CLEAR l_s_range.
        l_s_range-low = SY-DATUM+4(2).
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO e_t_range.
    In Query Designer, create a formula variable CURMONTH processed by customer exit and the dimension under the Currency/Unit tab is "Number".  Put the formular variable in the column as a KF.  When running the query, the column with the formular variable shows values of "2,0000000" other than just "2" I want for the current month.  If  the dimension under the Currency/Unit tab is "date", the column with the formular variable shows values of "00/00/0000".  Any idea?  How to grab the correct current month value which is 2 from the system date.
    Thanks!

    Oh ok , try the below options, As such I dont see any errors in our code .
    Not sure if you have ABAPER's in your team, just check with them once on the FM we are trying to see .
    Next , do you hvae 0CALDAY available in your report ? If so try to restrict that field with variable "0DAT" and write the same code you have written for your formula variable , but instead change the variable name to "0DAT" and try if this gets the month . let me know if I'm not clear .

  • Error while executing customer Exit Variable (No value could be determined for variable.  BRAIN 632)

    Hello,
    I created a customer exit variable which has to show the range between the first and last day of the previous month. The query will be executed every first of the month.
    Variable is declared as: Customer exit, based on 0CALDAY, Interval, Mandatory and NOT input.
    When i debug the query, it is making the calculation but its not populating my variable; when I execute the query from RSRT, the output test shows a message:
    ENo value could be determined for variable ZRANGE_PREVMONTH.                            BRAIN               632ZRANGE_PREVMONTH
    Below the code i'm using (SAP 7.4)
    ***Customer Exit to calculate previous month.
    IF i_step = 2.
         CASE i_vnam.
              WHEN 'ZRANGE_PREVMONTH'.
    DATA:  LS_RA_SID  TYPE   RSR_S_RANGESID.
    DATA:  yyyy(4) TYPE n.
    DATA:  mm(2) TYPE n.
    DATA:  dd(2) TYPE n.
    DATA:  fst_date LIKE sy-datum.
    DATA:  fst_date2 LIKE sy-datum.
    LOOP AT i_t_var_range_c INTO loc_var_range
        WHERE vnam = '0DAT'.
          dd = sy-datum+6(2).
          mm = sy-datum+4(2).
          yyyy = sy-datum+0(4).
          fst_date2 = sy-datum.
          IF dd = '01' AND mm = '01'.
            mm = '12'.
            yyyy = yyyy - 1.
          ELSEIF dd = '01' AND mm <> '01'.
            mm = mm - 1.
          ELSEIF dd <> '01'.
            mm = mm - 1.
          ENDIF.
          CLEAR: fst_date.
          CONCATENATE yyyy mm '01' INTO fst_date.
          fst_date2 = fst_date2 - 1.
          CLEAR: ls_ra_sid.
          ls_ra_sid-sign = 'I'.
          ls_ra_sid-opt = 'BT'.
          ls_ra_sid-high = fst_date2.
          ls_ra_sid-low = fst_date.
          APPEND ls_ra_sid TO e_t_range.
    ENDLOOP.
    ENDCASE.
       ENDIF.

    Hi Fernanda,
    Try this:
    DATA:  LS_RA_SID  TYPE   RSR_S_RANGESID.
    DATA:  fst_date LIKE sy-datum.
       CASE i_vnam.
              WHEN 'ZRANGE_PREVMONTH'.
    fst_date = sy-datum - 1.
    concatenate fst_date(6) '01' into ls_ra_sid-low.
          ls_ra_sid-sign = 'I'.
          ls_ra_sid-opt = 'BT'.
          ls_ra_sid-high = fst_date.
          APPEND ls_ra_sid TO e_t_range.
    ENDLOOP.
    ENDCASE.
       ENDIF.
    Just post here for any queries..
    Regards,
    Loed

  • Query - customer exit help

    I asked this question previously, but did not clear answers. Just for clarification - in my DSO there is just one date field (0calday), one characteristic (ZTYPE) and one key figure (ZRATE)
    User will enter one date : September 03, 2008 , the query must display all values till the beginning of the month
    September 03, 2008 --- Type 1 - 1.5
    September 02, 2008 --- Type 1 - 2.0
    September 01, 2008 --- Type 1 - 3.0
    September 03, 2008 --- Type 2 - 6.0
    September 02, 2008 --- Type 2 - 3.6
    September 01, 2008 --- Type 2 - 2.8
    Solution : This is how I'm planning to do it:
    Create one variable based on 0calday for user input (Zuserdate). Create another variable (Zdatrange) on 0calday for processing by customer exit. The "to date" is same as the user-entered date and the "from date" DD is hardcoded to "01" and MM/YYYY is derived from user entered date? Is this the approach? I'm not very well aware of ABAP coding so would appreciate your help.
    Thanks.
    Anita. K.S.
    Edited by: Anita Savant on Apr 12, 2009 10:14 PM

    Dear Anita,
    Your approach right. Try the following code in the customer exit.
    CASE I_STEP.
       WHEN '2'.
         CASE  I_VNAM.  " Name of your customer exit variable
            WHEN 'ZDATRANGE'
            READ TABLE I_T_VAR_RANGE INTO LOC_VAR_RANGE WITH KEY
                                                                    VNAM = 'ZUSERDATE'
                                                                  IOBJNM = u20180CALDAYu2019.  " Get user input date
            IF SY-SUBRC = 0.
              L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.      " high value = input
              L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(6).  " low value, e.g.200701
              L_S_RANGE-LOW+6(2) = '01'.                               " for 1st day
              L_S_RANGE-SIGN = 'I'.
              L_S_RANGE-OPT = 'BT'.
              APPEND L_S_RANGE TO E_T_RANGE.
            ENDIF.
         ENDCASE.
    ENDCASE.
    B.R
    Charlie
    Edited by: Charlie on Apr 13, 2009 3:33 AM
    Edited by: Charlie on Apr 13, 2009 3:34 AM

  • Variable with Customer Exit  on BEX

    Hi Experts,
    I have a query with a key figure 0CALDAY, restricted by the variable ZSCAL7 (Acumulated Period). This variable is defined as 'customer exit'.
    How can I see with is the exit that apply?

    Go to CMOD tcode and select project for enhancement RSR00001.
    In the Function module EXIT_SAPLRRS0_001 create click oninclude ZXRSRU01  and there find your variable.
    Hope it helps.
    Regards

  • Wrting customer exit in variables

    Hi Guys,
    I have to change the code in customer exit for variables in reporting.i have to give inputrange in 0calmonth(01/06-07/06)and i have to get the output as 0calday(multiplevalues),can any body help me out.
    Thanks
    Kiran

    Kiran,
       check this... i wrote the code as mentioed in my last post...
    data:w_date(8).
    CASE I_VNAM.
      WHEN '0CALDAY Variable Name'
        if i_step = 1.        clear l_s_range.
          read table I_T_VAR_RANGE where vnam = '0CALMONTH Varibale'.
          l_s_range-low = concatenate i_t_var_range-low+'01'.
          l_s_range-sign = 'I'.
          l_s_range-opt  = 'EQ'.
    w_date = concatenate i_t_var_range-high '01' into w_date.
    call function 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
        exporting
             DAY_IN = w_date
        importing
             LAST_DAY_OF_MONTH = l_s_range-high.
          append l_s_range to e_t_range.
        endif.
    endcase.
    check this code and let me know...change the Variable Names and keep capital letters.
    i'm telling you again... if the 0CALMONTH variable range 200605 to 200608. code will populate the values for 0CALDAY like this...20060501 to 20060831.
    all thes best.
    Regards,
    Nagesh Ganisetti.

  • Customer exit week to date

    Hi,
    i have follwoing reqt where period in format 200804/W1 is passed and i have to find the date. Like W1 will be 07.04.2008 for period 200804/W1.
    I have defined normal variable on period characteristics say 'ZZPERIOD_WEEK_TO_DATE' and a customer exit variable on 0calday 'ZDATELATEST_REP' and written following code to get
    period                  Date
    200804/W1          07.04.2008
    But i am not getting the value...where i am having a mistake
    Plz suggest
    Thanks
    Prashant
    WHEN 'ZDATELATEST_REP'.
        IF i_step = '2'.
          CLEAR l_t_var_range.
          i_t_range-sign = 'I'.
          i_t_range-opt =  'EQ'.
          LOOP AT i_t_var_range INTO l_t_var_range  WHERE vnam = 'ZZPERIOD_WEEK_TO_DATE'.
            date_in = l_t_var_range-low.
            IF date_in+7(2) EQ 'W1'.
              CONCATENATE date_in0(4) date_in4(2) '07'  INTO date_out.
            ELSEIF date_in+7(2) EQ 'W2'.
              CONCATENATE date_in0(4) date_in4(2) '14'  INTO date_out.
            ELSEIF date_in+7(2) EQ 'W3'.
              CONCATENATE date_in0(4) date_in4(2) '21'  INTO date_out.
            ELSEIF date_in+7(2) EQ 'W4'.
              CONCATENATE date_in0(4) date_in4(2) '28'  INTO date_out.
            ELSEIF date_in+7(2) EQ 'W5'.
              IF date_in4(2) EQ '04' OR date_in4(2) EQ '06' OR
                 date_in4(2) EQ '09' OR date_in4(2) EQ '11'.
                CONCATENATE date_in0(4) date_in4(2) '30'  INTO date_out.
              ELSEIF date_in+4(2) EQ '02' .
                CONCATENATE date_in0(4) date_in4(2) '29'  INTO date_out.
              ELSE.
                CONCATENATE date_in0(4) date_in4(2) '31'  INTO date_out.
              ENDIF.
            ENDIF.
            i_t_range-low = date_out.
            i_t_range-sign = 'I'.
            i_t_range-opt  = 'EQ'.
            APPEND i_t_range TO e_t_range.
          ENDLOOP.
        ENDIF.

    Hi Prashant,
      Code looks correct.
    Try putting an exit statement as shown below and check.
    APPEND i_t_range TO e_t_range.
    EXIT.
    ENDLOOP.
    ENDIF.
    Regards,
    Senoy Laxman

  • Help me writing a Customer Exit!!

    Hi Guys
      Help me how to write a customer for calculating the next quarter forecast based on the user enter the input..
    to write a code from the fiscal period they enter....
    *********START OF FIRST PROG
    WHEN 'ZVAR_**** type as interval or selection*
    CLEAR l_s_range.
    IF i_step = 2. "after the popup
    LOOP AT i_t_var_range INTO loc_var_range
    WHERE vnam = ZPxxXXXX.
    ENDLOOP.
    IF loc_var_range-low = '001'
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    l_s_range-low = "01"
    l_s_range-low = "03"
    ENDIF.
    IF loc_var_range-low = '004'
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    l_s_range-low = "04"
    l_s_range-low = "06"
    ENDIF.
    IF loc_var_range-low = '007'
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    l_s_range-low = "07"
    l_s_range-low = "09"
    ENDIF.
    IF loc_var_range-low = '010'
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    l_s_range-low = "10"
    l_s_range-low = "12"
    ENDIF.
    *****Until here I calculated the Quarterly months...if I am wrong correct me...
    ******then from here I need to caculate Next Quarter as mentioned below. which is requirement logic...
    if they enter period
    01 --- Quarter1
    02---Q1
    03--- Q2
    04--Q2
    05---Q2
    06---Q3
    07---Q3
    08---Q3
    09---Q4
    10---Q4
    11-Q4
    12-Q4
    This is how i need
    Is it again I need to enter for each period as they enter????
    pls help me with next part of coding???
    APPEND l_s_range TO e_t_range.
    Thanks a lot...
    BI Learner

    Hi,
    Here I'm giving simple code this will give First Day of the Fy Period and Last Day of the Fy Period entered by the user, so you can change as per your requirement, please ask ABAPer in your project to chenge the code, because I don't know what exactly you want to.
    it will give first date of the FY Period based on user entry on ZFYP variable
    ZFDAY_FI is Customer Exit Variable on 0CALDAY and ZFYP is User Entry Variable on Fiscal year/Perod
        WHEN 'ZFDAY_FI'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZFYP'.
            zbdatj = loc_var_range-low+0(4).
            zbuper = loc_var_range-low+4(3).
            CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
              EXPORTING
                i_gjahr = zbdatj
                i_periv = 'V3'
                i_poper = zbuper
              IMPORTING
                e_date  = zzdate.
            CLEAR: l_s_range.
            l_s_range-low = zzdate.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
          ENDLOOP.
    it will give last date of the FY Period based on user entry on ZFYP variable
    ZLDAY_FI is Customer Exit Variable on 0CALDAY and ZFYP is User Entry Variable on Fiscal year/Perod
        WHEN 'ZLDAY_FI'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZFYP'.
            zbdatj = loc_var_range-low+0(4).
            zbuper = loc_var_range-low+4(3).
            CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
              EXPORTING
                i_gjahr = zbdatj
                i_periv = 'V3'
                i_poper = zbuper
              IMPORTING
                e_date  = zzdate.
            CLEAR: l_s_range.
            l_s_range-low = zzdate.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
          ENDLOOP.
    In Report Create new Selection and drag the Keyfigure and 0CALDAY and restrict the 0CALDAY with *Intervales i.e. with ZFDAY_FI ; ZLDAY_FI *
    Thanks
    Reddy

  • How to display text variable of type customer exit

    Hi to all,
    I have created a query in query designer which display sales value according to plant.
    There i have also used a variable which will take input from user and restricted on 0CALDAY.
    I have also created 2 text variable to display the text for sales based on input in variable.
    I need when user enter the 01.02.2010 - 31.12.2010 value in variable , text variable should display SALES FROM 01.02.2010 TO 31.12.2010
    i knew how to do that by using text variable of processing type customer exit.
    But display of text variable is like SALES FROM 01022010 TO  31122010  ,
    But i need that SALES  01.02.2010 TO 31.12.2010
    i shall be thankfull to you for this.
    Regards
    Pavneet Rana
    Edited by: pavneet rana on Dec 22, 2010 7:46 AM
    Edited by: pavneet rana on Dec 22, 2010 8:03 AM

    Hi,
    Give Description on Sales Amount  as SALES FROM &ZVAR_YEAR1& TO &ZVAR_YEAR2&.
    ZVAR_YEAR1 & ZVAR_YEAR2 are the two text variables. These two variables should NOT be input enabled.
    In the Exit - under I_STEP = 2, write the below code.
    WHEN 'ZVAR_YEAR1'.
      DATA:   l_s_range       TYPE rs_s_range,
                   loc_var_range TYPE rrs0_s_var_range.
      READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_INPUT_CALDAY'.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'EQ'.
      l_s_range-low  = loc_var_range-low.
      APPEND l_s_range to e_t_range.
    WHEN 'ZVAR_YEAR2'.
      DATA:   l_s_range       TYPE rs_s_range,
                   loc_var_range TYPE rrs0_s_var_range.
      READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_INPUT_CALDAY'.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'EQ'.
      l_s_range-low  = loc_var_range-high.
      APPEND l_s_range to e_t_range.

  • Customer Exit for MTD

    Hi,
    My requirement is to create Customer exit variable to calculate the Month to date (MTD) value (Quantity) in a query. I created a Customer exit variable for MTD (0CALDAY) in Query & wrote code in CMOD for the same as follows.
    DATA: ZYEAR(4) TYPE N,
    ZMON(2) TYPE N,
    ZDAY(2) TYPE N.
    CASE I_VNAM.
    WHEN 'ZVCE_MTD'.
    IF I_STEP = 2.
    REFRESH E_T_RANGE.
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE.
    ZYEAR = LOC_VAR_RANGE-LOW+0(4).
    ZMON = LOC_VAR_RANGE-LOW+4(2).
    ZDAY = LOC_VAR_RANGE-LOW+6(2).
    CLEAR L_S_RANGE.
    CONCATENATE ZYEAR ZMON '01' INTO L_S_RANGE-LOW.
    CONCATENATE ZYEAR ZMON ZDAY INTO L_S_RANGE-HIGH.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    EXIT.
    ENDLOOP.
    ENDIF.
    ENDCASE.
    I debugged this code by putting a break point & running the query in RSRT, the code is getting executed & i am getting the From & To dates in E_T_RANGE output.
    But when I execute the Query, I am getting the output Quantity for FTD only, not MTD.
    For example, if i give 05-12-2009 as variable input for 0CALDAY when i execute the query, i should get the summed up quantity for 01 Dec to 05 Dec in a single cell. But now, i am getting the summed up quantity for 05 Dec only.
    Help me in resolving this.
    Regards,
    Murali

    Hi,
    It seems like you are reading some input value of existing variable from selection screen then based on the input you are calculating your MTD range.
    Now the variable i.e. time characteristic you are using on selection screen should not be restricted at global filter level, other wise your other variable in the query will not work.
    So keep the selection screen variable in some RKF and then use the new RKF for further restriction.
    Regards,
    Durgesh.

Maybe you are looking for

  • Lync in combination with voip

    We are using Lync but just installed a new VOIP system called SWYX Everything is working fine except if a user picks up his phone (usb Phone) Lync is also popping up behind the screen of the SWYX software client. Problem is that when Lync is also pop

  • Error in Travel Management " Trip has no postable amounts "

    Hi experts, i am working in Travel Menegement. i have done all the configurations when i try to post the Advance it returns an error: " Trip has no postable amounts". while i post the other expense it successfully run. Can anyone help me to resolve t

  • Document created in 2011 in Pages.

    I have a document created in 2011 in Pages.  When trying to open it now I get the message "This document can't be opened because it's too old.  To open it, save it with Pages '09 first."      How on earth do I do that? Any help would be appreciated. 

  • Why is my report causing the server to crash?

    When I run the report in developer it runs fine but when the webserver runs the report the webserver crashes. I've checked all my fonts to make sure I'm not using a font the server doesn't have. I'm using Arial so I know that's not the problem. Can s

  • PS CC 2014 isn't updating Camera Raw

    I just updated PS CC 2014 this morning and Camera Raw isn't updating.  The version I have is still 8.3.  How can I update to the new 8.7? Thanks!!!