Code in cmod

Dear experts,
We have a code to display error messages. If count > 1 then it should display error message in both the cases.We have written a code as follows:
===========================
  IF I_STEP = 3.
WHEN 'CT_GRP' or 'CT_GRP1'.
      IF I_STEP = 3.
        data: count type n.
        count = 0.
        LOOP at i_t_var_range INTO loc_var_range where vnam = 'CT_GRP' OR vnam = 'CT_GRP1' .
          count = count + 1.
        ENDLOOP.
        IF count > 1.
          CALL FUNCTION 'RRMS_MESSAGE_HANDLING'
            EXPORTING
              I_CLASS  = 'RSBBS'
              I_TYPE   = 'E'
              I_NUMBER = '000'
              I_MSGV1  = 'Please enter either of Cost center group or Center Center Value'.
          raise again.
        ENDIF.
      ENDIF.
**=========For Cost center Hierarchy and Cost center================================
**=========For Cost Element Hierarchy and Cost Element================================
    WHEN 'ZCE_GRP' or 'CT_RG'.
      IF I_STEP = 3.
        count = 0.
        LOOP at i_t_var_range INTO loc_var_range where vnam = 'ZCE_GRP' OR vnam = 'CT_RG'.
          count = count + 1.
        ENDLOOP.
        IF count > 1.
          CALL FUNCTION 'RRMS_MESSAGE_HANDLING'
            EXPORTING
              I_CLASS  = 'RSBBS'
              I_TYPE   = 'E'
              I_NUMBER = '000'
              I_MSGV1  = 'Please enter either of Cost Element group or Cost Element Value'.
          raise again.
        ENDIF.
      ENDIF.
**=========For Cost Element Hierarchy and Cost Element================================
  ENDCASE.
==============================================
But it is not working. Please check and let me know the errors in this.
Regards,
Bhadri M.

Hi Frank and Arun,
I am running the query in BEx. There are no errors displayed in the code.
But still the error message is not getting populated.
Is there anything wrong in the code ?
Regards,
Bhadri M.

Similar Messages

  • Why do we use BADI (CRM_BWA_MFLOW) when we can write code in CMOD?

    Hello Gurus,
        I'm working on CRM, BW extraction. I made enhacement for Service Order Header DataSource and written code in MFLOW BADi. Its working good.
    Now my question is we can write code in CMOD user exit too for this enhcenement (am I right?).
    Then what is the difference? Which one should we have to do??? Any idea or documents? please respond....
    Thanks
    RKR
    Message was edited by:
            RKR M

    Hi,
    Go thru this link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/a-c/customer%20enhancements%20and%20userexits%20in%20bw%20-%20sap%20netweaver%20%20know-how%20network%20webinar.pdf
    Hope this helps you.
    PB

  • Help with ABAP code in CMOD.

    dear all,
    can you help me solve the below abap coding problem? thanks.
    somewhere at the top
    DATA: L_S_RANGE LIKE LINE OF E_T_RANGE.
    DATA: L_S_VAR_RANGE LIKE E_T_RANGE.
          LOOP AT I_T_VAR_RANGE INTO L_S_VAR_RANGE. <-- error msg stops here.
            FIND l_s_var_range-vnam IN TABLE it_vnam.
            IF sy-subrc = 0.
              l_check = 'X'.
              EXIT.
            ENDIF.
          ENDLOOP.
    Error message...
    "L_S_VAR_RANGE" cannot be converted to the line type of "I_T_VAR_RANGE".
    Thanks all.

    Hi Try this,
    DATA: L_S_RANGE LIKE LINE OF E_T_RANGE.
    DATA: L_S_VAR_RANGE LIKE LINE OF  I_T_VAR_RANGE .
    LOOP AT I_T_VAR_RANGE INTO L_S_VAR_RANGE. <-- error msg stops here.
            FIND l_s_var_range-vnam IN TABLE it_vnam.
            IF sy-subrc = 0.
              l_check = 'X'.
              EXIT.
            ENDIF.
          ENDLOOP.
    Regards,
    Ravi

  • How to find Query name using Variable name (by Customer exit code in CMOD).

    Dear SDN,
    Enhancement name RSR00001.....Function Module name.....EXIT_SAPLRRSO_001...Include ZXRSRU01...
    Some x variable coding in done here.
    How can I find out the Query name for the X variable?
    Wating for reply...
    Thanks & Regards,
    Praveen.K

    Dear,
    I have got answer..
    Method 1 :Right click on variable in Query Designer and find the where used list.
    Method 2 : SE16--> RSZGLOBV -->Enter the variable VNAM as 'Variable Name' ->Get the VARUNIID> Go to table RSZELTXREF --> Enter the values of VARUNIID in TELTUID --> Get the list of SELTUID --> Go to table RSZCOMPDIR --> Enter the values of SELTUID in COMPUID --> Get the list of COMPID -->COMPID is the list of queries
    Thanks & Regards,
    Praveen.K

  • CMOD exit_rsap_saplr_001 for transactional data ABAP CODE

    Hi please confirm that you want to convey that i can write the actual code in CMOD exit_rsap_saplr_001 for transactional data?? if i put 20 data sources enhancement code in there is'nt that too bulky and will cause the failing all extractor if one code is wrong if you still suggest that i can go ahead with 20 similar codes as below . please see my code below which i have used for all 20 datasources with little modification
    if you can recommend some changes in code to improve performance would be great
    case i_datasource.
    WHEN '0CUSTOMER_ATTR'.
    loop at i_t_data into l_s_BIW_KNA1_S.
    l_tabix = sy-tabix.
    clear i_knvp.
    select single * from KNVP into i_knvp where KUNNR = l_s_BIW_KNA1_S-KUNNR.
    if sy-subrc = 0.
    l_s_BIW_KNA1_S-ZZPARFN = i_knvp-PARVW.
    l_s_BIW_KNA1_S-ZZCUSNOBP = i_knvp-KUNN2.
    modify i_t_data from l_s_BIW_KNA1_S index l_tabix.
    endif.
    endloop.
    endcase.
    Thanks
    Poonam

    Check this simple code for Z...include into the FM EXIT_SAPLRSAP_001 where zcomp is new field added into the datasource 8zsales2.
    data : l_s_/BIC/CE8ZSALES2 like /BIC/CE8ZSALES2,
    l_tabix like sy-tabix.
    case i_datasource.
    when '8ZSALES2'.
    loop at c_T_DATA into l_s_/BIC/CE8ZSALES2.
    l_tabix = sy-tabix.
    fill the new field
    select comp_code from /BI0/MCOMP_CODE into l_s_/BIC/CE8ZSALES2-zcomp
    where comp_code = '1000'.
    if sy-subrc = 0.
    *l_s_ZFIAA_IS001_TXT50 = ANLA_TXT50.
    modify c_t_data from l_s_/BIC/CE8ZSALES2 index l_tabix.
    endif.
    endselect.
    endloop.
    endcase.
    Edited by: Rohan Kumar on Jan 16, 2008 8:21 AM

  • How to read variable in CMOD code !

    Experts,
    in my one of the query, there is a variable, which takes 2 dates. so the variable is type "interval"
    so, when you run the report, user needs to enter value something like this.."mm/dd/yyyy  - mm/dd/yyyy"
    Now, i have writtn a code in CMOD, by reading this variable.
    But i dont know how to read 2nd date from the variable.
    READ TABLE   i_t_var_range
                 WITH KEY   vnam = 'VARIABLE'
                 INTO       l_var_range.
              First Date = l_var_range-low.
              Second Date = l_var_range-high.
    Does this low and high thing is correct?
    if i do debug, i could see the low values. but i coud see the same low values in High too.
    whats the problem ?
    please help

    Hi ,
    There are some scenarios for using CMOD, for variables in report.
    And as per I understand for you issue, please find my comments
    Scenario : You want to use the values enter by user in some other variable in the same report.
    Please make sure that properties of both the variables are same.
    Use below code:
    DATA: l_s_range TYPE rsr_s_rangesid.
    DATA: loc_var_range LIKE rrrangeexit.
       WHEN 'New Variale'.
            IF i_step = 2.
              LOOP AT i_t_var_range INTO loc_var_range
                      WHERE vnam = 'Varaible in which user has entered value'.
                CLEAR l_s_range.
                l_s_range-low  =   loc_var_range-low  .
                l_s_range-high =   loc_var_range-high .
                APPEND l_s_range TO e_t_range.
              ENDLOOP.
            ENDIF.
    Thanks
    Mayank
    Edited by: Mayank Chauhan on Feb 8, 2011 11:45 AM
    Edited by: Mayank Chauhan on Feb 8, 2011 11:46 AM
    Edited by: Mayank Chauhan on Feb 8, 2011 11:47 AM

  • How to use same CMOD code for 2 Diff. variableS?

    Experts,
    I have written some code under CMOD. Now, i have another query which i could use the same CODE, but diff. variable
    ( In the CMOD code, i am passing one User input variable ). For the 2nd query i have to pass different User Input variable.
    How OR what should i wright to tell CMOD, that IF its Query # 1 then use ABC variable and if Query # 2 then use XYZ .
    thanx

    Dear Hon Bon,
    Let us have a small example on ur scenario.
    Lets take the requirement as to calculate Month from Date. (In both the queries).
    Query 1: Input variable for Date is say  'ZDATE1'.
    Query 2: Input variable for Date is say  'ZDATE2'.
    Now let the CMOD variable be ZVAR_CALMONTH.
    when 'ZVAR_CALMONTH'.
        clear: lwa_var_rng,
               lwa_range.
        loop at i_t_var_range into lwa_var_rng where vnam = 'ZDATE1' or vnam = 'ZDATE2'.
          concatenate lwa_var_rng-low+0(4)
                      lwa_var_rng-low+4(2)
                 into lwa_range-low.
          lwa_range-sign = 'I'.
          lwa_range-opt  = 'EQ'.
          append lwa_range to e_t_range.
          clear lwa_range.
        endloop.
    Now when you execute the Query1,  the above code will work for 'ZDATE1' variable,
    if you execute the Query2,  the above code will work for 'ZDATE2' variable.
    So, the key point is,
    1. You need not worry about which query is getting executed. Whatever the query, the particular user entry variable of that query will be taken care.
    2. This method works only if the cmod variable (ZVAR_CALMONTH) is used in both the queries (Ofcourse its ur requirement).
    3. If queries have both the user entry variables then the cmod will work differently(it ll get data from both the user variables).
    You shall try ur code in the above example by replacing the code and the variable names and try playing around it.
    Hope this helps.
    Regards,
    Guru

  • How to Debugg the Cmod code in R3

    Hi All,
    I have written a code in CMOD to populate new fields for 2LIS_11_VASCL.
    How do I debugg the code it in R3?
    When I run the check for datasource in RSA3, it is not returning any records?
    Simmi

    you can set a break point in the code..or even in the extractor you have the option to enable the Debug..check box..
    Go to the code..of include..double click on the line you want to place a break -point.

  • CX_SY_NO_HANDLER Error While executing query in RSRT T-Code

    Hi Experts,
    I have created a data source extraction using function module.
    Then i have created customer exit variable, dso, infocube and all....
    my variable name is ZWBS_VAR and
            query name is WBS_VAR.
    while executing this query name I'm getting the exception CX_SY_NO_HANDLER.
    If i use WBS_VAR instead of ZWBS_VAR in when condition.. it is not showing that error.
    this is my code i have written in ZXRSRU01 include.
    DATA:it_wbs_elemt TYPE STANDARD TABLE OF /bic/awbsdsogn00,
         wa_wbs_elemt like line of it_wbs_elemt,
         L_S_RANGE TYPE RSR_T_RANGESID with header line,
         LOC_VAR_RANGE like line of i_T_VAR_RANGE,
         ZLOW TYPE C,
         LV_USER LIKE SY-UNAME,
         lv_user1 LIKE /bic/awbsdsogn00-/BIC/WBSE.
    CASE i_vnam.
    *****************************Start of Code for 'ZWBS_VAR' variable******************************
    when 'ZWBS_VAR'.
    lv_user = sy-uname.
    if lv_user CP '/BIC/WBSE'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = lv_user
    IMPORTING
    output = lv_user1.
    CLEAR wa_wbs_elemt.
    SELECT * FROM /bic/awbsdsogn00 INTO TABLE it_wbs_elemt WHERE /BIC/WBSE = lv_user1.
    READ TABLE it_wbs_elemt INTO wa_wbs_elemt WITH KEY /BIC/WBSE = lv_user1.
    IF sy-subrc = 0.
    l_s_range-low = wa_wbs_elemt-/BIC/WBSE.
    l_s_range-sign = ' I '.
    l_s_range-opt = ' EQ'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDIF.
    ENDCASE.
    IF I_STEP = 3.
    LOOP at i_t_var_range INTO loc_var_range WHERE vnam = 'ZWBS_VAR'.
    CLEAR : l_s_range.
    zlow = loc_var_range-low.
    lv_user = sy-uname.
    CALL FUNCTION 'CONVERSIOn_EXIT_ALPHA_OUTPUT'
    EXPORTING
    input = loc_var_range-low
    IMPORTING
    output = loc_var_range-low.
    IF lv_user NE loc_var_range-low.
    IF lv_user CP '/BIC/WBSE'.
    CALL FUNCTION 'RRMS_MESSAGE_HANDLING'
    EXPORTING
    I_CLASS = 'RSBBS'
    I_TYPE  = 'E'
    I_NUMBER = '000'
    I_MSGV1 = 'You are not authorized for the WBS ELEMENT'
    I_MSGV2 = loc_var_range-low
    I_MSGV3 = 'Enetr your valid WBS ELEMENT'
    I_MSGV4 = lv_user
    EXCEPTIONS
    OTHERS = 02.
    RAISE Again.
    ELSE.
    l_s_range-low = loc_var_range-low.
    l_s_range-sign = loc_var_range-sign.
    l_s_range-opt = loc_var_range-opt.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDIf.
    ENDLOOP.
    ENDIF.
    If you find any errors in this piece of code please let me know..
    Thanks&Regads,
    Sirisha.

    Hey think other way round .
    Filtering the report with the partner(current user executing the report) will suffice your requirement .
    Am I correct ?
    If yes then follow this simple approach .
    Create a variable(mandatory, not ready for input ) of type customer exit on partner infoobject and filter your report with this variable .
    In this way the current user executing the report can see data only related to him .
    Type the below code in cmod .
    WHEN '(give your variable name).
         DATA :lv_bp        TYPE /bi0/oibpartner,
        CHECK i_step EQ '1'.
        lv_bp = sy-uname.
        IF lv_bp IS NOT INITIAL.
          lv_bp = ( sy-uname ) .
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = lv_bp
            IMPORTING
              output = lv_bp.
          l_s_range-sign = 'I'.
          l_s_range-opt  = 'EQ'.
          l_s_range-low  = lv_bp .
          APPEND l_s_range TO e_t_range.
          CLEAR : l_s_range,lv_bp.
        ENDIF.
    If this approach is not flexible in ur case then let me know will change the code what u have written as I can see many errors in that .
    Also I can figure it out that the whole code is ctrl c ctrl v of that sdn document but his requirement was quite different than yours .

  • How to make BEX Customer Exit Variable inactive through Customer Exit Code

    Hi,
    I had created two variables VAR1 and VAR2 as Customer Exit variables
    If VAR1 is entered then it should automatically make the VAR2 as NO Entry Variable.
    vice versa also required.
    can u help me with any code in CMOD so that we can make it inactive through Customer Exit Code.
    Thanks in Advance.
    Sunil.

    What i want is not commenting the code
    I want to make the BEX Variable as inactive by using the Customer Exit Code
    EX : If value in VAR1 is entered  then VAR2 should become automatically inactive.
           If value in VAR2 is entered  then VAR1 should become automatically inactive.
    how can this be done
    Thanks in advance.
    Sunil

  • Variable not touching the CMOD

    Hi,
    I defined a variable in the query and included the code in CMOD, But when i execute the query, the query is not touching the CMOD code and the variable is not getting populated.
    Please let me know what could be the reason and what should be done to execute the code in CMOD.
    Thanks
    GK

    Rishi,
    Y dont try to Debug the Query  in RSRT by giving ur query tech, name as selection . And one more thing put a break-point in the CMOD after activating exit where u wrote the code.
    Check wether the varaible processing type is Customer exit or not. And Is the code is calling that Varaible.
    Hope it helps
    bhaskar

  • How to find where the code for append structures for LIS extractors?

    Hi,
    I found 4 append structures for extractor 2LIS_03_BF,
    Out of 4 append structures, I found code for one, using where-used option. But in vain for other 3. Is it possible they didn't transport the code for remaining structures? how to find that?
    Cheers,
    Kannan N

    Kannan,
    When ever you apply a logic to populate tdata for the appended filed then you will be writing some code in CMOD transaction code where you will find a ZXRSAU01
    program, just double click on that then it will take you to the complete exit. Ther you can find with your data source name.
    Hope it helps...
    ****Assign Points if it helps******
    Gattu

  • CMOD Enhancements

    Hi please confirm that you want to convey that i can write the actual code in CMOD exit_rsap_saplr_001 for transactional data?? if i put 20 data sources enhancement code in there is'nt that too bulky and will cause the failing all extractor if one code is wrong if you still suggest that i can go ahead with 20 similar codes as below . please see my code below which i have used for all 20 datasources with little modification
    if you can recommend some changes in code to improve performance would be great
    case i_datasource.
    WHEN '0CUSTOMER_ATTR'.
    loop at i_t_data into l_s_BIW_KNA1_S.
    l_tabix = sy-tabix.
    clear i_knvp.
    select single * from KNVP into i_knvp where KUNNR = l_s_BIW_KNA1_S-KUNNR.
    if sy-subrc = 0.
    l_s_BIW_KNA1_S-ZZPARFN = i_knvp-PARVW.
    l_s_BIW_KNA1_S-ZZCUSNOBP = i_knvp-KUNN2.
    modify i_t_data from l_s_BIW_KNA1_S index l_tabix.
    endif.
    endloop.
    endcase.
    Thanks
    Poonam

    Hi,
    As a performace improvement , you better to store all the required records from KNVP table into internal table as shown below.
    and one more thing , there are different includes( and FM ) for MAster data and Transaction data enhancements respectively.
    TYPES BEGIN OF TYPE_BIW_KNA1_S.
    INCLUDE STRUCTURE BIW_KNA1_S.
    TYPES END OF TYPE_BIW_KNA1_S.
    TYPES BEGIN OF TYPE_KNVP.
    TYPE: KUNNR LIKE KNVP-KUNNR,
    PARVW LIKE KNVP-PARVW,
    KUNN2 LIKE KNVP-KUNN2.
    TYPES END OF TYPE_KNVP.
    WHEN '0CUSTOMER_ATTR'.
    DATA:
    ITAB_BIW_KNA1_S TYPE STANDARD TABLE OF TYPE_BIW_KNA1_S
    WITH HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    DATA:
    ITAB_KNVP TYPE STANDARD TABLE OF TYPE_KNVP
    WITH HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    ITAB_BIW_KNA1_S[] = I_T_DATA[].
    SELECT KUNNR PARVW KUNN2 FROM KNVP INTO CORRESPONDING FIELDS OF TABLE ITAB_KNVP FOR ALL ENTRIES IN ITAB_BIW_KNA1_S
    WHERE KUNNR = ITAB_BIW_KNA1_S-KUNNR.
    LOOP AT ITAB_BIW_KNA1_S.
    READ TABLE ITAB_KNVP WITH KEY KUNNR = ITAB_BIW_KNA1_S-KUNNR.
    IF SY-SUBRC EQ 0.
    ITAB_BIW_KNA1_S-ZZPARFN = ITAB_KNVP-PARVW.
    ITAB_BIW_KNA1_S-ZZCUSNOBP = ITAB_KNVP-KUNN2.
    MODIFY ITAB_BIW_KNA1_S.
    ENDIF.
    CLEAR ITAB_BIW_KNA1_S.
    ENDLOOP.
    I_T_DATA[] = ITAB_BIW_KNA1_S[].
    With rgds,
    Anil Kumar Sharma .P

  • Big deal wth CMOd

    hi
    1)  when and where do we use delta full and initial update.. in moniter or when extractiong?  (Must understand the 'init,delta, and full load' types of loads and when to use which. )
    2) abt CMOD .. i know how to write the code in ABAP.. but my main question is
    first
      when u go for lis extaction... there u select data source and  the fileds u need.. ex:  data source  2lis_01_s760 (2lis_01_s260 may be this is already in BC) (forget what ever data spurce)
    ok if i need to add external field.. where  shuld i mention abt it../....... if u just write code in CMOD.. system will take it by default.. and how system knowss..please help in this case
    if the adding field which is in DB hwo to add it to the data source?
    if the adding field is in Excel file.. How to add it to the data Source..
    if the adding filed is in another data source how to our data source..
    please help me
    kasinath
    kasinath

    2:
    1. Enhance your extract structure (RSA6 - 'Enhance ExtractStructure') with a 'ZZ'-field
    2. Add your code to the user exit (RSA6 - 'Function Enhancement)
    If your additional field was in an Excel file, it should be uploaded from Flatfile. You can merge both sources by using an ODS

  • Customer exit - code for variable

    Hi Friends,
    I have created a variable "CUST_EXIT_YEST" and defined the processing type as customer exit. Now would like to add code in CMOD.
    Requirement: The variable should allow take yesterday's date. Please help me with the code.
    Already there are some codes defined for other customer exit variables in CMOD. Can I add my code below that. If so please explain.
    Regards,
    Surjit

    If i'm not wrong you want to show previous day in the variable.
    At the bottom of the existing code before EndCase, u can write the below code
    Data: loc_var_range      LIKE rrrangeexit, (must be there this kind of declaration in ur existing code)
    WHEN 'CUST_EXIT_YEST'.
        IF I_STEP = '1'.
          Read Table I_T_VAR_RANGE into LOC_VAR_RANGE WITH KEY VNAM = 'CUST_EXIT_YEST'.
          myrange-SIGN = 'I'.
          myrange-OPT = 'EQ'.
          myrange-LOW = sy-datum - 1.
          APPEND myrange TO e_t_range.
        ENDIF.

Maybe you are looking for