Code (ABAP) for the Customer Exit Variable (CMOD)

Scenario
An employee can purchase any no of policies in a day or month.each policy will have start date and expiry date.
My requirment
Count all the policies(valid) by employee on a ranges basis exception reporting
(0-10;10-20;20-30;30-40) and then able to drill down by policy start date and expiry date.
As per the requirment is to show policies that employee had with in the give date intreval  which are not yet expired (active) i need to write a condition that will count only policies whose Expiry date is > Current calender day
As Policy Expiry Date is a char i am converting it to KF using fourmala variable so that i can write a condition on it using current cal day formula variable sap exit
Requirment:
Need a code for SAP exit variable which will meet the following requirment
There are the following 2 variables in the query
1) A variable (User Input)(Date Range) on Policy Start Date and
2) Authorisation Variable which is based on Authorisation Object(Analysis Authorisations)
I need a SAP Exit variable (CMOD) that will
BAsed on the user entered Policy Start date it has to pick all the policy exiry date of the policies and display all the policies whose expiry date is greate than Sy Date (Current Date) and also if Policy Expiry Date is blank or # it has to display
Arun supplied me with the below code...but i think it doesn't include blank expiry date or #...as i am new to ABAP please update me with releavent code
Policy Start Date : ZPST_DTE
Policy Expiry Date: ZPSP_DTE
Variable (Type:Customer Exit) on Expiry Date: ZEEXP_DTE
Arun's Code:
IF I_STEP = 1.
CASE V_NAME
WHEN 'X' " X is the variable u created for the exit
l_s_range-low = SY-DATUM.
l_s_range-opt = 'I'.
l_s_range-sign = 'GT'.
APPEND l_s_range TO e_t_range.
END CASE.
Please modify above code to include Blank or # values of Expiry Date
Thanks Arun
Please ask if you need further info as this is urgent
Thanks

Hi Arun,
Thanks for the help...will definetly assign points
(Closed the previous thread)
Please spare bit of ur time as this is my first ABAP Code
Can i include 2 restrictions..# and Variable (Customer Exit)...But how can i include Records with Blank Values
As the data from Source system the expiry date is filled up with either Date or # or Blank...my requiorment is to include all 3 and
Question:
As there are 2 other variables defined ..one on Policy Start Date (User input date intreval) and Location (Authorization Variable..Analysis Authorisations)...Do i need to change I_STEP in the code
(Req: Reports shows all the(still valid) policies emp has purchased between  2 give date (Variable on Policy Start date)
IF I_STEP = 1.
CASE V_NAME
WHEN 'X' " X is the variable u created for the exit
l_s_range-low = SY-DATUM.
l_s_range-opt = 'I'.
l_s_range-sign = 'GT'.
APPEND l_s_range TO e_t_range.
END CASE.

Similar Messages

  • Looking for an ABAP-code for the customer-Exit Variable

    Hello,
    I have defined a Variable (Interval) which should be processed through Customer-Exit on characteristic Supplier-Date (date format). This Customer-Exit Variable is called ZDATE.
    We have another time characteristic Fiscal year / period (0FISCPER) which has single mandatory input variable for ex.  003.2011. This input variable is called ZFISCPER.
    Now I have to write an ABAP-Code where the customer exit variable ZDATE is derived (fiscal last year to last period) from input variable ZFISCPER in INCLUDE ZXRSRU01.
    Means when the input variable (ZFISCPER) is 003.2011 then the customer exit variable ZDATE should be calculated in INCLUDE ZXRSRU01 as 01.01.2010 u2013 28.02.2011 (fiscal last year to last period).
    Since I am quite new in ABAP, I will be grateful if you could write me sample ABAP for this.
    Many thanks.

    Hi,
    should be something like:
    DATA: l_s_range TYPE rsr_s_rangesid,
    input LIKE sy-datum.
    When 'ZDATE'
    CONCATENATE '0101' 0FISCPER+3(4)-1 into l_s_range-low. "You get 01012010
    CONCATENATE '01' Fiscper+1(6) into input.                            "You get 01032011
    l_s_range-high = input-1.                                                     "You get 28022011
    APPEND l_s_range TO e_t_range.
    Greetings
    Roman

  • How to get the current month value for a customer exit variable?

    How to get the current month value for a customer exit variable? 
    And also if we have an InfoObject with date value (including date, month, year), then how to derive the month value from this date type of Char.?
    Thanks!

    Hi Kevin,
    Check here........
    Re: Customer Exist for "From Current Date To Month End"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    Cal month
    Regards,
    Vijay.

  • Problem in transporting the Customer exit variable

    Hi all,
    i have careated a variable to capture the current date in my report, with the processing type, Customer Exit. and, its getting populated fine in my DEV environment. basically, i have to compute the number of days, in which net due date is being compared to the current date.  when i transport this to the QA environment, the values for number of days is gettting some junk value, wherein in DEV its showing the exact values. It seems i have to take cetain measures in transportation of the Customer Exit.
    please advice.
    Thanks in advance
    Sneel

    Hello ,
               In the Quality after you run the report check in the layout option>display text elements> variables and check what value is displayed for the use exit variable , if it is correct then problem may be in the selection you gave when you run the report if the user exit variable value is wrong , then set a break point in the code and run the report from rsrt and check where the error is.
    hope it is clear
    assign points if useful

  • Query - Replacement Path for a Customer Exit Variable

    Hi
    New to the field and the board.  Any and All help is greatly appreciated.
    I have created a query which runs based on a date selection. The query have few customer exit variables whose values are set in ABAP. All Key Figures in the query are brought depending on the date ranges that each of the CE returns. Ex - one column is sales for first 10 days, 2nd for second 10 days, 3rd for first quarter, 4th for 2nd quarter and such.  There are about 20 - 25 columns with KF in the query and all are Customer Exit date driven.
    The challenge:- Each column heading should have the name of the month. I tried using Replacement Path. But it works when the selection is based on a constant value but not on value based on variable which is a customer exit. Ex - If I say restrict Cal/Month for July 2013, the replacement path for the Col Heading works fine. But if I say restrict Cal/Month for "ZVAR_SecondQtr_First_Month" the replacement path doesn't work.
    Help Please
    Thanks
    Vidya

    In the text variable that you are using , i guess you have a replacement path. In this instead of using your characteristic for specifying how the value has to replace, use the variable option and give the variable name there
    http://help.sap.com/saphelp_nw70/helpdata/EN/43/565cd22fc95f6ce10000000a1553f6/content.htm
    Hope it helps
    Regards,
    Rathy

  • Logic of the  Customer Exit Variable

    Hi Experts,
    Could you please explain me the logic (Functionality) of the below  Customer Exit Variable .....
    WHEN 'AKFR05'. "M-5 monthly forecast version
            CALL FUNCTION 'END_TIME_DETERMINE'
              EXPORTING
                duration         = -5
                unit             = 'MON'
                factory_calendar = l_LACID
              IMPORTING
                end_date         = l_fn_dte
              CHANGING
                start_date       = sy-datum
                start_time       = sy-uzeit.
            CHECK sy-subrc = 0.
            CLEAR l_s_range.
            l_s_range-low(4) = 'LGMN'.
            l_s_range-low+4(6) = l_fn_dte(6).
            l_s_range-sign = k_sign_inclusive.
            l_s_range-opt = k_option_equals.
            APPEND l_s_range TO e_t_range.
    Thanks in Advance

    Thanks for the update...
    The First Part
            CALL FUNCTION 'END_TIME_DETERMINE'
              EXPORTING
                duration         = -5
                unit             = 'MON'
                factory_calendar = l_fcalid
              IMPORTING
                end_date         = l_fn_date
              CHANGING
                start_date       = sy-datum
                start_time       = sy-uzeit.
    For Example:
        Current Date : 27.04.2009
    By using the FM END_TIME_DETERMINE the END_DATE (27.11.2008) is exported to l_fn_date
    Could you please explain me the logic after exporting the end date
    l_s_range-low(4) = 'LGMN'.
            l_s_range-low+4(6) = l_fn_date(6).
            l_s_range-sign = k_sign_inclusive.
            l_s_range-opt = k_option_equals.
            APPEND l_s_range TO e_t_range.
    Thanks in Advance

  • Scenerios for using I_STEP parameter for creating customer exit variables.

    Hi All,
    I need to create a customer exit variable.
    Please explain the different scenerios for using each i_step parameters.
    For eg. in which practical scenerio i_step 3 is used?

    Hi Shobhit,
    You can find plenty of info on this in the forums, So i suggest you to do a small search with imp Key words. Anyways below is the std usage of I_STEP
    I_STEP = 1
    Call takes place directly before variable entry. Can be used to pre populate selection variables
    I_STEP = 2
    Call takes place directly after variable entry. This step is only started up when the same variable is not input ready and could not be filled at I_STEP=1.
    I_STEP = 3 In this call, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called again.
    I_STEP = 0
    The enhancement is not called from the variable screen. The call can come from the authorization check or from the Monitor. This is where you want to put the mod for populating the authorization object.
    This is basic info from help.sap.com.
    regards,
    Gaurav
    Edited by: Gaurav Kothari on Aug 4, 2011 2:18 PM

  • ABAP code Help for Customer Exit variable

    Hello All,
    Can anyone provide ABAP code for a customer exit variable please?
    Requirement:
    0CALYEAR(InfoObject) - ZCALCYR (Variable) <b>Calender year with default value actual year</b>.
    Proiperties of variable: single value,mandatory,ready for input,can'be changed in query navigation.
    i have read some docs on customet exit variables which i got from SDN but i found it's difficult for me to get this as i am not that good in ABAP.
    Thanks,
    Rakesh.

    Hi,
       Just check the below code. You just need to make slight changes I believe. Hope this helps you.
    In CMOD………..
    Sample code
      INCLUDE LXRSRF01                                                   *
    data: l_s_range type rsr_s_rangesid.
    case i_vnam.
      when 'ZCALCYR'.
        if i_step = 1.
         l_s_range-low = sy-datum+0(4).
            append l_s_range to e_t_range.
        Endif.
    Endcase.

  • How to insert a code for a function module into a Customer Exit Variable?

    I have two Key Figures viz., Net Prchs Rtl, and Net Prchs Unt. Both these Key figures have This Week (TW) and Last Week (LW). There is a variable for This week but there is no variable defined for Last week.
    I need to get data in the column LW (Last Week) for both the key figures.
    In function module EXIT_SAPLRRS0_001 one of the functions I have is:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    I need to create a new variable to get values in the Last week column for different key figures and use function “'DATE_TO_PERIOD_CONVERT'” in that variable.
    Can anyone please explain me the steps as to how to use a function module in a variable so that when the variable is used in a key figure it shows the output.
    In other words what I want to know is after creating a Customer exit variable of type Characteristic value how do I refer the above mentioned function moduel and insert the code for the function module into the Customer exit variable that I created.
    Thank you.
    TR.

    Hi Wond,
    Thanks a lot for your reply. I understand what you mean but I have never done this before so can you please explain it in a detailed manner. I have the following code:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                EXPORTING
                  i_date         = ld_date
                  i_periv        = lc_periv
                IMPORTING
                  e_buper        = ln_poper
                  e_gjahr        = ln_bdatj
                EXCEPTIONS
                  input_false    = 1
                  t009_notfound  = 2
                  t009b_notfound = 3
                  OTHERS         = 4.
              IF sy-subrc <> 0.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ELSE.
                lc_poper = ln_poper.
                CONCATENATE ln_bdatj lc_poper+1(2) INTO wa_e_t_range-low.
                wa_e_t_range-sign = 'I'.
                wa_e_t_range-opt = 'EQ'.
                APPEND wa_e_t_range TO e_t_range.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
    I believe I should now use the above code in my customer exit variable. If that's right can you please explain me the steps as to how should I do this so that the variable gets populated.
    Thank you.
    Regards,
    TR.

  • How to use Multiple Single Option for selection in the Customer Exit

    Hi,
    How can we handle the multiple single values in the customer exit variable.
    I have a requirement which is as follows -
    Table A fiields -> Field Coach, Partner 2, Relation between PArtner 1 & Partner 2, Valid from, valid to date.
    Table B ->  Service Month, Start Date, End Date.
    Table C -> Billing Date, Execution Partner,cal month /year.
    For the Field coach in TABLE A, multiple Partner 2 are present.
    Report has to be built on Table C.
    User inputs the Service month and Field Coach . User can enter multiple field coach values.
    For the All the Field Coach values entered, corresponding Partner2's have to be found from Table A and to be passed to the Execution Partner in Table C.
    Now if we want to use customer exit variable on the field Execution Partner, how can we handle the Multiple Single selections in the customer exit.
    Thanks,
    Shubham

    Hi,
    While creating the variable you must have to specify multiple value.
    In customer exit
    write code multiple times and append the values.
    For example:
    when 'variable'.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 1.
    APPEND L_S_RANGE TO E_T_RANGE.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 2.
    APPEND L_S_RANGE TO E_T_RANGE.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 3.
    APPEND L_S_RANGE TO E_T_RANGE.
    Regards,
    Ranganath.

  • Function module needed for customer exit variable need to use in Bex report

    Hi Experts,
    I have a requirement where i need to get Cummulative result between two interval periods.
    If user gives single mandatory input value - 002-2009
    for one Scenario:-
    Project start Date   untill Pervious year i.e  December 2008
    Where project start date will get from one of the field in my BW CUBE
    can anyone help for the customer exit function code for this scenario. As i am into BI i dont have idea in ABAP.
    Please help sample cod for this .
    Thanks,
    Anil.

    I had created one customer exit which had fullfill my requirement.

  • 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

  • Customer Exit Variable to fetch the data from the cube..

    Hello Gurus,
    I am having a requirement to select the latest changed record from the cube while executing the query.  where we are having the Calday as the date with a variable .
    I suggested my client we can filter it at the DSO leve or Data loading level but my client dont want to distrurb the existing design so he want to perfrom the changes at the Query level only.
    For Example we are having below records in the cube.
    PO             Material     Calday       Qty         Price
    101            ABC          1/12           100         10
    101            ABC          2/12            100         10
    101            ABC          3/12            100         11
    I am having Calday in the selection screen as the variable.
    Now from the above example i need to show the record which has been changed on 3/12.
    For this i am planning to write the customer exit variable on the calday , when the user enter the range of Calday then i will fetch the whole records which fall in between the range and i will sort each PO with respect to the date and i will pick those which are the latest records.
    My Concerns:
    !. Kindly let me know if it is possible and what are the other things that i need to consider.
    2. Did it will impact the performance.
    Waiting for your quick replies
    Thanks & Regards
    KK

    Hi Mate,
    Sorry for late reply.
    By d way in your word.
    initially when the user enter the date range as the vairable input. suppose 1/12 to 31/12 then i will pick all those records which fall in this range.
    suppose the records are
    PO Date
    P1 01/12
    P1 02/12
    P2 02/12
    P2 03/12
    P3 03/12
    P3 04/12
    In the customer exit variable Now for each PO i will sort the date in ascending order and i will pick the last record to display it in the Report.
    The ouput will be
    PO Date
    P1 02/12
    P2 03/12
    P3 04/12
    Now hope you are aware about exit variable concept.
    so what value will pass in the calday filter.
    here after sorting on each PO , you will get 3 different dates, 02/12 for P1
    03/12 for P2
    and 04/12 for P3
    Now if you are aware about exit variable concept, then you will pass this three date to CALDAY(I_t_VAR_Range-low = ...)
    but how query will understand that for P1 calday filter value is 02/12, for P2 calday filter value is 03/12.... and so on...
    actually i have also experienced this kind of issue 1-2 years before, i have tried same thing at that time without thinking and stuck with this problem..
    By d way you can also learn from your mistake.. so just try ur logic and then you will understand what is the problem?
    By d way this will not work, parallel you can work on other solution.

  • Executing customer exit variable in dropdown box. in WAD

    hi Experts,
    i have implemented two customer exit variables for current month and next síx months in a query and it is working well, and the code for customer exit variable is correct.
    we have a requirement to use the customer exit variables in dropdown box in web application designer. in the dropdown box in web application designer i used command SET_SELECTION_STATE_SIMPLE in that 'command specific Parameters' i had given the exit variables current month and next six months.but after executing the web application designer and if i drill down the report with current month and next six months it's giving error message .
    can anyone please tell me how to implement customer exit variables in web application designer through drop down box. i am using this in bi7 reports.
    Regards
    Sruthi Reddy

    Hi,
    Customer Exit Variable in SAP BI : is used to calculata MTD,YTD, and some other calculations.
    You can define variables with Customer Exits and then write code in CMOD. See the Article/Blogs in the same
    https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    CHeck the Following Articles.
    Customer Exit Variables in BW/BI Reports
    Using Customer Exit Variables in BW or BI Reports Part - 1
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/using%20customer%20exit%20variables%20in%20bw%20or%20bi%20reports%20part%20-%201.pdf
    How to use Customer Exit Variables in BW Reports: Part - 2
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/how%20to%20use%20customer%20exit%20variables%20in%20bw%20reports%3a%20part%202.pdf
    Using Customer Exit Variables in BW/BI Reports Part - 3
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10fc4382-afa6-2c10-1380-fa224fe4324f&overridelayout=true
    Using Customer Exit Variables in BW/BI Reports: Part - 4
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387?quicklink=index&overridelayout=true 
    Calculating the Ageing of the Materials
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/a-c/calculating%20the%20ageing%20of%20the%20materials.pdf
    Thanks
    Reddy

  • Customer exit variables

    Hello,
    I have created two customer exit variables, although I'm not an ABAP expert. Both are calculated based on two optional variables selected by the user.
    When running my query I get the message "Warning Value '' is too long for variable ZPERSTRT". I suppose that really means the value is empty while a value was expected. The type of this variable is 0DATE.
    I try checking the code to examine how the value can be empty, and that results in a few questions some of you probably can answer.
    Unfortunately, for complex reasons I have to program the customer exit variables in the development system, while testing them in the test system where I don't have access to the ABAP editor.
    QUESTION 1
    When finding the values of the other variables, I must be prepared to find them without a value. How can I know if they have a value or not? I've tried with the following code, which I suspect is not working quite as expected:
          LOOP AT i_t_var_range INTO loc_var_range
            WHERE vnam = 'ZCALWINT'.
            IF loc_var_range-low <> ''.
              l_week0 = loc_var_range-low.
              l_flag = 1.
            ENDIF.
          ENDLOOP.
    I later use l_flag to check if a value was found or not.
    QUESTION 2
    How is type conversion done in a statement like
    date = string + 1
    If string has the value "20071031", will 1 be added as a string (resulting in "200710311" which is then somehow converted to a date), like a number (resulting in "20071032" which is then somehow converted to a date) or like a date (resulting in "20071101")?
    QUESTION 3
    More type conversion. Would it be ok to concatenate year, month and day into a date variable, or should I always concatenate into a string which can then be converted to a date afterwards?
    QUESTION 4
    If the variable I want to read has an interval and not only a single value, is the only way to see this by checking the -high value? If this one has a value it is an interval, if not it is a single value? Or can I be sure the -opt value will be 'BT' if it's an interval?
    Thanks and regards,
    Christoffer

    Anyone?
    I'll award 10 points to the best overall answer and 6 points to answers which are first or best on one of the four questions.
    Regards,
    Christoffer

Maybe you are looking for

  • Windows Easy Transfer - Merging 2 Computers into 1

    I'm using WET for my XP-to-7 upgrades. In one case, there are 2 computers in an office and we are phasing one of the computers out, thus removing 2 Win XP computers and replacing with only one Win 7 computer. Can I run WET on both XP computers as the

  • Swapping A Hardrive For SSD?

    Am looking to buy a Samsung 850 pro SSD. What is the procedure for swapping all my data/drivers etc from the old drive to a new SSD? Is there a sticky somewhere?...will there be any issue with the Windows 7 licence key?

  • ERS checkbox invisible in the contract ME33K

    Dear Friends Please see as below description to understand my problem. In the Customizing choose Material Management/ Purchasing / Contract choose Define Screen Layout at Document Level choose Field Selection Key -> PT8K choose GR/ IR Control right h

  • Disappearing text in Captivate 7

    Help!  I am using Captivate 7 and have recorded a module in which I am using a mix of standard Text Captions and Smart Shapes.  All is fine until I save and close the file, then re-open it.  On reopening, all the text in all the Text Captions and Sma

  • Serialized Material in Good Issue

    Dear all,      Let say i have a serialized Material in GI. Do i need to key in the serial number one by one or can i just key in the ranges and qty and it will auto populate all the serial numbers for me? Please advice, thank you