Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

error message at ME21n using user-exit EXIT_SAPMM06E_012

0 Kudos

I have requirement of validation at me21n while saving PO with respect to PR. i used user exit EXIT_SAPMM06E_012(MM06E005)for enhancement using table TEKPO. but the error is showing in popup box and it allow to hold the PO and the PO number is generated but i want it to show in status bar and PO number should not be generated. how to show error in status bar?

16 REPLIES 16

raymond_giuseppi
Active Contributor

Better use an up-to-date BAdI such as ME_PROCESS_PO_CUST. In your implementing methods use the macros of include MM_MESSAGES_MAC to handle errors (Many discussions and samples can be found in the forum)

0 Kudos

I didnt get any solution in the forum. i can't use this user exit for validation? i cant get the error in status bar through this user exit?

0 Kudos

This exit is not suitable, its purpose is execution of some checks during save for customer fields, checks that would not have been performed in customer exit subscreen logic for any reason (e.g. when user didn't display the customer enhanced dynpro) it's a "last chance" check before updating database, not anything more...

Which keywords did you use to get no result during your search ???

0 Kudos

I used the badi ME_Process_PO_CUST but it is not working. can you tell me which method should i use so that when i save PO without entering reason of order it should raise the error but doesnot allow user to hold the PO. so which method i shoukd use of badi ME_Process_PO_CUST

0 Kudos

To check some item / header data use PROCESS_ITEM / HEADER to raise an immediate error (With some GET_DATA, mmpur_message_forced, INVALIDATE).

You can also use method CHECK which is executed either when user select the related function or before the save process, and is the last method to raise an error.

Also elaborate on your'it is not working' which at least lacks of precision/information...

0 Kudos

No from this badi also its giving the option of hold edit cancel. when i click on hold the PO is generated. i dont want the option for hold. is it possible?

0 Kudos

No, This step is required. Only then look at BAdI ME_HOLD_PO as provided in jrgen.lins's answer to deactivate the 'hold' option. (e.g; 1-raise the error in a correct way, 2-deactivate the hold option)

0 Kudos

No not working with hold badi. still getting the option of hold.

0 Kudos

I have to raise the error at time of save. not at time of check? should it come in post method?

0 Kudos

The POST method does no longer allow error messages to be raised, as I already wrote the last allowed step is CHECK...

0 Kudos

> Paste your code???

0 Kudos

SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

TABLES: EBAN,EKPO.

 TYPES : BEGIN OF TY_EBAN,

           BANFN TYPE EBAN-BANFN,

           MATNR TYPE EBAN-MATNR,

           EBELP TYPE EBAN-EBELP,

           MENGE TYPE EBAN-MENGE,

         END OF TY_EBAN.



 TYPES: BEGIN OF TY_EKPO,

          BANFN TYPE EKPO-BANFN,

          MENGE TYPE EKPO-MENGE,

        END OF TY_EKPO.



 TYPES: BEGIN OF TY_EKPO_1,

          BANFN TYPE EKPO-BANFN,

          MENGE TYPE EKPO-MENGE,

        END OF TY_EKPO_1.



 DATA: IT_EKPO_1 TYPE TABLE OF TY_EKPO_1,

       WA_EKPO_1 TYPE TY_EKPO_1.

 DATA: IT_EKPO TYPE TABLE OF TY_EKPO,

       WA_EKPO TYPE TY_EKPO.



 DATA: IT_EBAN TYPE TABLE OF TY_EBAN,

       WA_EBAN TYPE TY_EBAN,

       WEKPO   TYPE BEKPO.

 DATA: LV_FLAG TYPE FLAG,

       LV_ITEM TYPE STRING.

 DATA: LV_TOTAL TYPE I.



 IF TEKPO IS INITIAL.

   SELECT BANFN MATNR EBELP MENGE

   FROM EBAN

   INTO TABLE IT_EBAN

   FOR ALL ENTRIES IN TEKPO

   WHERE BANFN = TEKPO-BANFN.





   SELECT BANFN MENGE

   FROM EKPO

   INTO CORRESPONDING FIELDS OF TABLE IT_EKPO

    FOR ALL ENTRIES IN TEKPO

   WHERE BANFN = TEKPO-BANFN.

 ENDIF.



 LOOP AT IT_EKPO INTO WA_EKPO.

   WA_EKPO_1-BANFN = WA_EKPO-BANFN.

   WA_EKPO_1-MENGE = WA_EKPO-MENGE.

   COLLECT WA_EKPO_1 INTO IT_EKPO_1.

 ENDLOOP.



 CLEAR: LV_FLAG,LV_ITEM.



 LOOP AT TEKPO INTO WEKPO.

   IF WEKPO-KNTTP = 'Q'.

     READ TABLE IT_EKPO_1 INTO WA_EKPO_1 WITH KEY BANFN = WA_EKPO-BANFN.

     IF SY-SUBRC = 0.

       LV_TOTAL = WEKPO-MENGE + WA_EKPO_1-MENGE.

       READ TABLE IT_EBAN INTO WA_EBAN WITH KEY BANFN = WEKPO-BANFN.

       IF SY-SUBRC = 0.

         IF LV_TOTAL < WA_EBAN-MENGE.

           IF WEKPO-BSGRU = ' '.

             LV_FLAG = 'X'.

             CONCATENATE LV_ITEM WEKPO-EBELP INTO LV_ITEM SEPARATED BY ','.

           ENDIF.

         ENDIF.

       ENDIF.

     ELSE.

       LV_TOTAL = WEKPO-MENGE.

       READ TABLE IT_EBAN INTO WA_EBAN WITH KEY BANFN = WEKPO-BANFN.

       IF SY-SUBRC = 0.

         IF LV_TOTAL < WA_EBAN-MENGE.

           IF WEKPO-BSGRU = ' '.

             LV_FLAG = 'X'.

             CONCATENATE LV_ITEM WEKPO-EBELP INTO LV_ITEM SEPARATED BY ','.

           ENDIF.

         ENDIF.

       ENDIF.

     ENDIF.

   ENDIF.

 ENDLOOP.



 IF LV_ITEM IS NOT INITIAL AND LV_FLAG IS NOT INITIAL .

   CONCATENATE 'Please select the valid reason for item' LV_ITEM INTO LV_ITEM.

   MESSAGE LV_ITEM TYPE 'E'.

 ENDIF.

0 Kudos

The short test of EXIT_SAPMM06E_012 is 'Check Customer-Specific Data Before Saving'?

Could you try using EXIT_SAPMM06E_017(Export Data to Customer Subscreen for Purchasing Document Item (PAI)).

0 Kudos

No its not working i have given the value still it's showing error. can you suggest me something else?

0 Kudos

i want the error while i save PO without giving reason of order. but at time of save the PO without giving reason it shows the error in popup and give the tab for hold edit and cancel. when i click on hold it generates the PO number. which i dont want the option of hold

JL23
Active Contributor

Holding a PO is a standard SAP feature which allows the user to save his work (which could actually be from some hours in large purchase orders) in cases an error cannot be resolved right away and needs some hours to be resolved.

How do deal with messages is detailed explained in OSS note 310154 - ME21N/ME51N: Customer-specific check, generating error log

How to prevent POs from being hold is documented in OSS note 390117 - ME21N: Prevent holding of purchase orders

further details are in OSS note 668212 - ME21N: Document type authorization when holding a PO