EXIT_SAPLMEREQ_010

i have put certain check in the User Exit EXIT_SAPLMEREQ_010,
it works finr and if any of my below condition fails it gives error, but when i want to rectify that error all my screen become un-editable and i am not able to edit any record instaed i have to get out of the txn ME51N and then i can do how to go i also want to restrict the user for the below conditions and also want to edit those if any error comes
my source code
*&  Include           ZXM02U12                                         *
DATA : wa_ebkn  TYPE ebkn,
       wa_eban  TYPE eban,
       v_target2  LIKE fmderive005-target2,
       v_code   TYPE aufk-bukrs,
       v_bukrs  TYPE mseg-bukrs.
LOOP AT im_t_eban INTO wa_eban.
  READ TABLE im_t_ebkn INTO wa_ebkn WITH KEY bnfpo = wa_eban-bnfpo.
*******  Check for The Internal Order STARTS
  IF wa_eban-knttp = 'F'.
    SELECT SINGLE bukrs INTO v_bukrs FROM aufk
      WHERE aufnr = wa_ebkn-aufnr.
    SELECT SINGLE bukrs INTO v_code FROM t001k
      WHERE bwkey = wa_eban-werks.
    IF v_code <> v_bukrs.
      MESSAGE e037(zmm) WITH wa_eban-bnfpo.
    ENDIF.
********** Cost Center Shud not be there in case of Internal order
    IF wa_ebkn-kostl IS NOT INITIAL.
      MESSAGE e036(zmm) WITH wa_eban-bnfpo.
    ENDIF.
********** Check Fund Center against Internal Order.
    SELECT SINGLE target2 INTO v_target2 FROM fmderive005
      WHERE sour1_from >= wa_ebkn-aufnr AND
            sour1_to   <= wa_ebkn-aufnr.
    IF v_target2 <> wa_ebkn-fistl.
      MESSAGE e038(zmm) WITH wa_eban-bnfpo.
    ENDIF.
*******  Check for The Internal Order ENDS
*******  Check for The Cost Center STARTS
  ELSEIF wa_eban-knttp = 'K'.
********** Internal order Shud not be there in case of Cost Center.
    IF wa_ebkn-aufnr IS NOT INITIAL.
      MESSAGE e039(zmm) WITH wa_eban-bnfpo.
    ENDIF.
********** Check Fund Center against Cost Center.
    SELECT SINGLE target2 INTO v_target2 FROM fmderive003
      WHERE sour2_from >= wa_ebkn-kostl AND
            sour2_to   <= wa_ebkn-kostl.
    IF v_target2 <> wa_ebkn-fistl.
      MESSAGE e040(zmm) WITH wa_eban-bnfpo.
    ENDIF.
*******  Check for The Cost Center ENDS
  ENDIF.
  CLEAR : wa_eban, wa_ebkn, v_bukrs, v_code, v_target2.
ENDLOOP.

You can get the accounting details with methods from
IF_PURCHASE_REQUISITION_ITEM and
IF_ACCOUNTING_MODEL_MM.
Example:
METHOD if_ex_me_process_req_cust~check.
  DATA: lt_requisition_items      TYPE mmpur_requisition_items.
  DATA: mmpur_accounting_list TYPE mmpur_accounting_list,
            re_exkn TYPE exkn.
   DATA:      ls_mereqitem         TYPE mereq_item.           
   FIELD-SYMBOLS: <item>       TYPE LINE OF mmpur_requisition_items.
   FIELD-SYMBOLS: <is_acc> TYPE LINE OF mmpur_accounting_list.
  CALL METHOD im_header->get_items
    RECEIVING
      re_items = lt_requisition_items.
  LOOP AT lt_requisition_items ASSIGNING <item>.
    CALL METHOD <item>-item->get_data
      RECEIVING
        re_data = ls_mereqitem.
<i> *Accounting Data: </i>
      CALL METHOD <item>-item->if_acct_container_mm~get_items
        RECEIVING
          re_items = mmpur_accounting_list.
<i>* From IF_PURCHASE_REQUISITION_ITEM</i>
      LOOP AT mmpur_accounting_list ASSIGNING <is_acc>.
        CALL METHOD <is_acc>-model->get_exkn
          RECEIVING
            re_exkn = re_exkn.
<i>*from IF_ACCOUNTING_MODEL_MM</i>
   ENDLOOP.
ENDLOOP.
ENDMETHOD.

Similar Messages

  • Program-logic goes not again in EXIT_SAPLMEREQ_010 after corrected message?

    Hi expert,
    I am using EXIT_SAPLMEREQ_010 in ME51N to add customer messages and it is nicely displayed on pop-screen. After the user correct the messages and press SAVE button, it is not going again in EXIT_SAPLMEREQ_010 and all the same messages are displayed. NO REFRESH?!
    Can anyone help me?
    Thanks in advance.
    Regards,
    Danijela

    Hi ,
    I found the solution in exit: EXIT_SAPLMEREQ_005
    I have written:
    IF im_item_has_errors IS NOT INITIAL.
      ex_recheck_item = 'X'.
    ENDIF.
    so if the item has error it will be rechecked and it comes again in
    EXIT_SAPLMEREQ_010

  • EXIT_SAPLMEREQ_010 DUMP

    Hi Guys,
    I tried activating a user exit for Purchase Requistion and have encountered a short dump stating that "<i>Function Module EXIT_SAPLMEREQ_010 is called, but cannot be found in its function group</i>". I checked the enhancement it belongs to and the function module for the component does not exist. I wanted to repair the function group by executing the function module repair via <i>SE37 > UTILITIES > FUNC GROUP REPAIR</i> but i do not know the imapct. Can you please tell me if this is the correct way of addressing the issue...What are the impacts? Will it delete the exit or will it create the FM for the exist.
    Many thanks!
    Ian

    Hi Lan,
    This user exit was given later by SAP via OSS Note. Probably some one didn't apply this note probably. see oss note
    Note 492788 - MEREQ001: Check new exit for event
    Just follow the steps and check your system and correct it. It should solve your problem.

  • User Exit EXIT_SAPLMEREQ_010

    Hi,
    I have implements the user-exit <b>EXIT_SAPMM06E_012</b> to validate the Purchase order. The following is an extraction of the code:
    *========================== VALIDATE PO ITEMS
      LOOP AT tekpo.
    *   Validate Material group for all non Material purchases
        IF tekpo-matnr IS INITIAL.
    *     I01 Validate Material group active
          CLEAR: t023t.
          SELECT SINGLE * FROM t023t WHERE matkl = tekpo-matkl
                                     AND   spras = sy-langu.
          IF NOT sy-subrc = 0.
            IF NOT tekpo-id IS INITIAL.
              mmpur_business_obj_id tekpo-id.
              mmpur_metafield mmmfd_mat_grp.
            ENDIF.
    *E      The material group & does not exist
            mmpur_message_forced 'E' 'MM' '086' tekpo-matkl '' '' ''.
            w_e_error = 'X'.
          ELSEIF t023t-wgbez = 'DO NOT USE'.
            IF NOT tekpo-id IS INITIAL.
              mmpur_business_obj_id tekpo-id.
              mmpur_metafield mmmfd_mat_grp.
            ENDIF.
    *E      Material group & is inactive. DO NOT USE
            mmpur_message_forced 'E' 'Z_MM06E005' '001'
              tekpo-matkl '' '' ''.
            w_e_error = 'X'.
          ENDIF.
    The statements <b>mmpur_business_obj_id</b> and <b>mmpur_metafield</b> correctly group the error messages per Item number and allow you to edit the field directly from the Messages while the mmpur_message_forced populate the Messages screen.
    Now I am implementing the same validation for the Purchase requisition using user exit <b>EXIT_SAPLMEREQ_010</b>. According to OSS Note 310154 the export parameter should be used for all errors.
    <i><u>OSS Note 310154</u> - Do not output the messages yourself but use the corresponding export parameter of the function exit to store all your messages there.
    This parameter is transferred back to the standard program which carries out the message output.</i>
    This does populate the Messages screen, but the messages are all displayed as Header messages and not with regards to the relevant Item.
    Since the macros <b>mmpur_business_obj_id</b> and <b>mmpur_metafield</b> does not exist in the user exit, how do I go about to report the error messages correctly in the messages screen. Please refer to the below example coding that I used.
    DEFINE m_message.
      wa_message-type       = &1.
      wa_message-id         = &2.
      wa_message-number     = &3.
      wa_message-message_v1 = &4.
      wa_message-message_v2 = &5.
      wa_message-message_v3 = &6.
      wa_message-message_v4 = &7.
      append wa_message to ex_messages.
    END-OF-DEFINITION.
    * I01 Validate Purchase group active
      CLEAR: t024.
      SELECT SINGLE * FROM t024 WHERE ekgrp = wa_eban-ekgrp.
      IF NOT sy-subrc = 0.
    *E  Purchasing group & not defined (please check your input)
        m_message 'E' 'ME' '011' wa_eban-ekgrp '' '' ''.
        w_e_error = 'X'.
      ELSEIF t024-eknam = 'DO NOT USE'.
    *E  Purchasing group & is inactive. DO NOT USE
        m_message 'E' 'Z_MM06E005' '000' wa_eban-ekgrp '' '' ''.
        w_e_error = 'X'.
      ENDIF.
    Thanks and best regards,
    Jacques Botha

    Hello,
    I've tried your approach. However, the cursor still does no position on the error fields when I select the error message from the messages popup and select "Edit".
    Bellow the code used:
    METHOD if_ex_me_process_req_cust~check.
      INCLUDE mm_messages_mac.
      DATA : lt_item TYPE mmpur_requisition_items,
             ls_item TYPE mmpur_requisition_item,
             lo_ref TYPE REF TO if_purchase_requisition_item,
             ls_items TYPE mereq_item.
      IF sy-tcode = 'ME51N' OR sy-tcode = 'ME52N' OR sy-tcode = 'ME53N'.
    * Retreving Item details
        CALL METHOD im_header->get_items
          RECEIVING
            re_items = lt_item.
        LOOP AT lt_item INTO ls_item.
          lo_ref = ls_item-item.
          CALL METHOD lo_ref->get_data
            RECEIVING
              re_data = ls_items.
          IF ls_items-idnlf CS 'test'.
            mmpur_message 'E' 'ME' '303' 'text1' 'text2' 'text3' 'text4'.
            ch_failed = mmpur_yes.
          ENDIF.
        ENDLOOP.
      ENDIF.
    As you can see whenever field IDNLF has the value 'test' a message is triggered. How can I relate this message to a specific field and more important to an item?
    Thank you in advance for any help,
    Stefan

  • MEREQ001 - EXIT_SAPLMEREQ_010

    Hi all,
    While executing the enhancement MEREQ001 in the production it went into dump stating that funtion module EXIT_SAPLMEREQ_010  does not exist in function group XM02.
    ( there is no code used in this FM.The required code is in another fm EXIT_SAPLMEREQ_005 and there is no problem with that  )
    how do i include the function mod in a standard function group.Moreover in development the FM exists in the function group XM02 and hence does not go into a dump.has anyone come across this type of issue ?. pls help to resolve this issue
    thanks.

    Hi,
    Check the function group to see if the EXIT_SAPLMEREQ_010 is in the function group. If not check and/or raise a oss.
    Cheers.
    Reward if useful.

  • Not allowing to change the plants in me51n transaction

    hi all,
    my requirement is to not allow the user to use different plants at item level(10,20 etc) . for that i have used the user exit MEREQ001 in the function module EXIT_SAPLMEREQ_010
    i have written following code
    DATA : WA_EBAN LIKE EBAN,
           WA_EBAN1 LIKE EBAN.
    IF SY-TCODE EQ 'ME51N'.
      READ TABLE IM_T_EBAN INTO WA_EBAN INDEX 1 TRANSPORTING WERKS .
      IF SY-SUBRC EQ 0.
        LOOP AT IM_T_EBAN INTO WA_EBAN1 WHERE WERKS NE WA_EBAN-WERKS.
          IF SY-SUBRC EQ 0.
             MESSAGE ID 'ZM' TYPE 'E' NUMBER '305'.
          ENDIF.
          ENDLOOP.
    ENDIF.
    ENDIF.
    iam able to trigger tha error message when we use diffferent plants at item level.but after that iam not able to change the plants in iten level.so please can anyone suggest me how to solve this problem
    thanks in advance
    rama.

    This OSS [Note 383725 - Enhancement MEREQ001 various problems|https://service.sap.com/sap/support/notes/383725] may help you.
    Regards

  • Deletion indicator not working after user exit error

    Hi Gurus,
    I had one requirement in Purchase Requisition. If the number of items increase by 36 , there should be an error saying that maximum items reached but once that item is deleted that error should disappear.
    I have written the coding in an Exit: EXIT_SAPLMEREQ_010.
    And the coding is :
    IF gs_eban-bsart = gcz902.
    LOOP AT gt_eban INTO gs_eban
    where loekz is initial.
    LOOP AT gt_ebkn INTO gwa_ebkn WHERE banfn = gs_eban-banfn
    and bnfpo IN r_bnfpo.
    recherche division- ordre interne
    LOOP AT ot_div into gwa_div WHERE ot = gwa_ebkn-aufnr AND div = gwa_ebkn-bnfpo.
    ENDLOOP.
    IF sy-subrc NE 0.
    gwa_div-ot = gwa_ebkn-aufnr.
    gwa_div-div = gwa_ebkn-bnfpo.
    APPEND gwa_div TO ot_div.
    ENDIF.
    ENDLOOP.
    ENDLOOP.
    DESCRIBE TABLE ot_div LINES n.
    IF n >= 37.
    case sy-ucomm.
    WHEN 'MESAVE'.
    MESSAGE e111(zpfr) with n.
    exit.
    ENDCASE.
    ENDIF.
    ENDIF.
    So now the exit is working fine......but when i go to delete that extra item it is not getting deleted , so while saving the information message comes that no data changed.
    So ho wto delete that extra item.
    Do anyone have reply....
    thanks in advance.

    Hello.
    If you insert 37 lines you get your error message. But if you delete 1 row, you get error message again, right?
    I think that's because you are not refreshing internal table ot_div. Shouldn't you refresh it before LOOP AT gt_eban INTO gs_eban?
    Regards.
    Valter Oliveira.

  • User exit or BADI for Tcode ME51N

    Hi All,
    My requirement is i need to check available quantity at the time of Purchase req creation. If PR quantity is available in stock then it should not allow to create new PR.
    Is there any user exit or Badi for this requirement. Kindly send me.
    Regards,
    Paras

    Hai,
    User Exit:  MEREQ001
    Function exit             EXIT_SAPLMEREQ_001  
                                   EXIT_SAPLMEREQ_002  
                                   EXIT_SAPLMEREQ_003  
                                   EXIT_SAPLMEREQ_004  
                                   EXIT_SAPLMEREQ_005  
                                   EXIT_SAPLMEREQ_006  
                                   EXIT_SAPLMEREQ_007  
                                   EXIT_SAPLMEREQ_008  
                                   EXIT_SAPLMEREQ_009  
                                   EXIT_SAPLMEREQ_010  
    Screen exit               SAPLMEGUI           
    Include tables           CI_EBANDB           
                                   CI_EBANMEM

  • BADI For Commitment Item Change for Service PO

    Hi All,
    I want to change the commitment item in the PR on change of Material Group . I used the BADI ME_PROCESS_REQ_CUST for changing the commitment item and its working fine for all types of PR except Service PR .
    In service PR , its changing the commitment item only on clicking the Account Assigment button because at this instant only the BADI is getting trigger .
    I want to change the commitment item without clicking the Account Assigment button (on pressing enter or at saving time ) .
    Is there any way ?
    Thanks
    Manik L Dhakate

    We are using User Exit MEREQ  EXIT_SAPLMEREQ_010
    In our PR creation for ME51n, we are validating the Person through HR Org structure at the Point of Key in his Cost Center, whether he belong to his Department cost center, we use this User Exit MEREQ  EXIT_SAPLMEREQ_010. If he doesnu2019t not belong, the message pop up as u201C Please use your department cost centeru201D. This works very good in case of NB Document Type (Non stock & Materials).
    We have customized ZCPR (Service PRs), but for service PRs, the place where we enter Account Assignment is Different screen, either it is planned or unplanned service, the system take you to another separate screen to key in Cost Center & GL, here the validation is not happening,
    Please suggest & advice us, we tried in this BADI : ME_PROCESS_REQ_CUST, we can fix it. Any User Exit or BADI for Service PRu2019

  • User Exit/BADI to change the Purchase Requisition date,creating threw MD02

    Hi,
    I've a requirement to change the Purchase Requisition creation date.
    I'm using MD02 to create Purchase Requisition.
    Based on the requirement if the available qty is less than the required quantity,we can change Purchase requisition date.
    Please let me know if any BADI's/User Exits we can use for this purpose.
    I've checked EXIT_SAPLMEREQ_010. I've kept debugging point nad i run MD02, but it is not stopping in the exit.
    we are using SAP 4.6c.
    Thanks,
    Adi.

    Hi Experts,
    Could you please give me a suggestion for the above problem???
    Thanks,
    Adi.

  • Purchase requisition- Mat. description problem.

    Hi Experts,
    I am stuck with one problem regarding Purchase requisition material description. The scenario is as follows.
    We have two types of PR creation. With or without material code.
    Material description is set to display only. But if the user enters the material code and random description and then press Enter button then the system doesnt pick the description from MAKT and keep the random description and disabling it for input. As shown in below screen shot.
    I want to restrict this, So I used the enhancement - MEREQ001 in CMOD and exit - EXIT_SAPLMEREQ_010  and INCLUDE ZXM02U12 , to compare the material description and change it to master data from table MAKT. But the problem here is the original PR data fetched in to the exit is not changing. I have written below code.
    +++++++++++++++++++++++++++++++++++++++++++++
    LOOP AT im_t_eban INTO l_s_eban.
    IF l_s_eban-matnr <> ''.
            SELECT SINGLE maktx FROM makt INTO mde
              WHERE matnr = l_s_eban-matnr.
              IF mde <> l_s_eban-txz01 .
                MESSAGE w007(zm_msg) . " DISPLAY LIKE 'E'.
                l_s_eban-txz01 = mde.
                  MODIFY im_t_eban FROM l_s_eban TRANSPORTING txz01. " THIS LINE IS GIVING SYNTAX ERROR THAT im_t_eban is not changeable
              ENDIF.
          ENDIF.
    ENDLOOP.
    ++++++++++++++++++++++++++++++++++++++
    So how to solve this problem??
    Or is there any other way to restrict the user to change the material description ??
    Thanks,
    Vishal .

    hello abaper,
    have a look on this
    Hi Gaurav, try this:
    http://scn.sap.com/thread/3297154
    FIELD-SYMBOLS: <T_EBAN> type mereq_t_eban.
    FIELD-SYMBOLS: <im_t_eban> type mereq_t_eban.
    DATA: wa_eban LIKE eban.
    ASSIGN ('(SAPLMEREQ)LT_EBAN[]') to  <T_EBAN> .   <-Uncommet this line
    LOOP AT <im_t_eban> INTO wa_eban.
    * => here you can change the value
       SELECT SINGLE matnr maktx into (mcode,mdesc)
             FROM makt
             WHERE matnr = wa_eban-matnr.
         if sy-subrc = 0 .
         move mdesc to wa_eban-txz01.
       MODIFY <T_EBAN> from wa_eban TRANSPORTING txz01.   <-Change the field-symbol for the one that is referencing the standard table
         ENDIF.
    ENDLOOP.

  • Warining Message in ME21N/ME22N in SAP4.6B

    Hi all,
    I have given a warning message in a user exit(EXIT_SAPMM06E_013). This user exit is triggered on PO SAVE. In ME21, ME22 the warning message is being diaplyed as expected. But in ME21N, ME22N the warning message is not being displayed but is just being ignored. Could you please give the reason for this behavior and the solution to provide the warning message in ME21N, ME22N in SAP 4.6B.
    Thanks in advance.
    Amit

    Hello,
    Try using the component MEREQ001 in a project on CMOD.
    You have some exits there:
    EXIT_SAPLMEREQ_001
    EXIT_SAPLMEREQ_002
    EXIT_SAPLMEREQ_003
    EXIT_SAPLMEREQ_004
    EXIT_SAPLMEREQ_005
    EXIT_SAPLMEREQ_006
    EXIT_SAPLMEREQ_007
    EXIT_SAPLMEREQ_008
    EXIT_SAPLMEREQ_009
    EXIT_SAPLMEREQ_010
    Try and see if any of them will work for your case
    Hope that will help.
    Mário Semedo

  • ME51(2/3/4)N Reset release purchase requisition

    Hello,
    I need to reset the issue of the purchase request after a specific condition occurs.
    To reset the issue I found the user exit EXIT_SAPLMEREQ_010
    (Includes ZXM02U12 MEREQ001 and extension).
    I first used this function:
          CALL FUNCTION 'ME_REL_STRATEGIE_EBAN'
             EXPORTING
                i_eban_new           =  wa_im_eban
               I_EBAN_OLD          =  IM_T_EBAN_PERS
               I_EBKN_NEW          =  IM_T_EBKN
               I_EBKN_OLD          =  IM_T_EBKN_PERS
              I_XCLASS             =
              I_CHANGE_OK          =
              I_CHECK_ALWAYS       =
             IMPORTING
               E_EBAN                =  wa_eban
               E_RESET               =  wa_ereset
    but I did not understand how to use it.
    Then I used the field-symbol:
    DATE f_FRGKZ (30) VALUE '(SAPLMEREQ) EBAN-FRGKZ'.
    FIELD-symbols <FRGKZ>.
    ASSIGN (f_FRGKZ) TO <FRGKZ>.
            MOVE 'X' TO <FRGKZ>.
    But a dump is generated on the move: Error at assignment: overwritten protected field.
    HELP ME - I don't know what to do.
    Edited by: Ermelinda86 on Jul 8, 2010 10:36 AM

    Hi Ermelinda86,
    I had a problem similar to what you're experiencing. I solved by changing appropriately customizing.
    The route from the transaction "spro" is as follows:
    Material Management --> Purchasing ---> Purchase Requisition ---> Release Procedure -
    > Procedure with classification ---> Set Up procedure with classification -
    > Release Indicator     
    Material Management --> Purchasing ---> Purchase Requisition ---> Release Procedure -
    > Procedure with classification ---> Set Up procedure with classification -
    > Release Strategies ---> Release Statuses
    I also found a useful guide at this link:
    http://www.sap123.com/a/59/
    Bye
    Prode

  • How to bring the screen editable after errror message

    Hi All,
    I made a little validation in screen in me56 on a fixed vendor in item level.
    After which I issued an error message.
    I got the error message but the screen remains non-ediatble.
    I need to atleast open the field FIXED VENDOR for input for the user to change the value.
    Please provide me valuable inputs and this is needed very urgently.
    I used the exit EXIT_SAPLMEREQ_008 / Include: zxm02u08.
    Thanks in advance.
    Krithika

    Hi Krithika,
    Whenever an error message is being displayed set a flag.
    Next time just check if the flag is set before performing any other validation.
    If the flag is set then skip the error message and clear the flag, and if the flag is not set then emit the error message.
    But the flag should be declared in the global data of the Function POOL.
    You can also check if the Function Exit EXIT_SAPLMEREQ_010 suits your requirement. In this there is a parameter called EX_MESSAGES. If you populate the error messages in this parameter the system will automatically handle the change/display mode when an error message is displayed.
    Hope this helps in solving your problem.
    Regards,
    Abhisek.

  • Purchase requisition saved with out any warning or error

    Dear Group Members
    User created the Purchase requisition with different item number of purchase requisition      
    Example:
    Item: generally it starts from 10, 20, 30 u2026..
    My user copied the details from other PR using Control C & pasted in the new PR by using Control V item like 270, 280, 290u2026..
    Purchase requisition was saved
    Can we configure the system in such a way that user should not save PR & system showing the error/warning message to make the item number in serial like 10, 20, 30, 40
    Regrds
    Shamulheq

    Hi Shamulheq,
    We have the same issue but with PO numbering and we opted by training the user.  As Jurgen mentioned in customizing you define the interval for numbering however that does not guarantee that will be correct.
    For instance in our case, the user creates the PO using as reference a PR, the Purchasing Requisition documement type is ZXX, after that the user changes the PO type from ZXX to YXX, our numbering for ZXX is 10, but for YXX is 1, then the PO is created with items like 10, 20, 30... instead of 1, 2, 3, which is a real problem since we use EDI and the item number is comunicated to other systems, but still the best idea is to train the user.
    I am not sure if there is a user exit you could use in case you want the system to validate. You can ask your developer.
    EXIT_SAPLMEREQ_001
    EXIT_SAPLMEREQ_010
    Thanks,

Maybe you are looking for