0% found this document useful (0 votes)
376 views

FSCM Configuration Link

The document discusses validating purchase order line items against custom fields using the ME_PROCESS_PO_CUST BADI in SAP. It recommends using the PROCESS_ITEM or CHECK methods to validate custom fields and raise errors. The EXIT_SAPMM06E_012 and EXIT_SAPMM06E_017 exits can also be used to perform item level validations and remove invalid lines on save. Sample code is provided to invalidate a line item by calling the invalidate method if validation fails.

Uploaded by

Soumen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
376 views

FSCM Configuration Link

The document discusses validating purchase order line items against custom fields using the ME_PROCESS_PO_CUST BADI in SAP. It recommends using the PROCESS_ITEM or CHECK methods to validate custom fields and raise errors. The EXIT_SAPMM06E_012 and EXIT_SAPMM06E_017 exits can also be used to perform item level validations and remove invalid lines on save. Sample code is provided to invalidate a line item by calling the invalidate method if validation fails.

Uploaded by

Soumen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Validation on ITEM level in ME21n or ME22n

I have a requirement on ME21n or ME22n, I need to do validation on material type and it is not successful, I
need to trough error message. I made that development according to requirement in EXIT ME_PROCESS_PO_CUST
(PROCESS_ITEM).

Use this exit MM06E005 -> EXIT_SAPMM06E_017 it will work.

* Remove previous message


mmpur_context mmcnt_context_badi.
IF NOT ls_item-id IS INITIAL.
mmpur_remove_msg_by_context ls_item-id mmcnt_context_badi.
ENDIF.
* here some check set an error and invalidate item
IF ls_material_plant-mmsta EQ '30'.
im_item->invalidate( ).
mmpur_metafield mmmfd_matnr.
mmpur_message_forced 'E' 'ZXXX' '999' <itemdata>-matnr <itemdata>-werks space
space.
ENDIF.
I'm explaining you my full requirement, When user create PO using ME21n with Document type NB and material
type ROH that time system check RFQ number; When RFQ number is not available then system trough an
error.
So according that I'm using badi ME_PROCESS_PO_CUST and method PROCESS_ITEM
Also check my below code and suggest me where we need to correct this.

Use this exit MM06E005 -> EXIT_SAPMM06E_017 it will work.


How to validate the custom fields created in
PO item level using user exit with
Process_item?
have created the custom fields in the PO item.Now,I need to validate those fields.I am using the process_item
method to validate the custom fields.
But process_item method is not getting triggered for the changes to the custom fields.How to validate the Po
item level custom fields.
Please check if your enhancement implementation is active for Enh. Spot ME_PROCESS_PO_CUST

How did you add your customer fields/screen: the old exit MM06E005 or the BAdI ME_GUI_PO_CUST.
Nevertheless, read first KBA 1927793 - ME_PROCESS_PO_CUST not triggered at custom field copy / change
in ME21n / ME22n.
BADI ME_PROCESS_PO_CUST is not designed to be triggered on changing the values of custom fields.
You could code your check in

 Method CHECK of ME_PROCESS_PO_CUST which will always been executed before SAVE and yet
allow to raise errors.
 Customer exit EXIT_SAPMM06E_012 of MM06E005

Exit for Purchasr order line item validation


While creating Purchase Order Me21/ Me21n , I have to validate the line item against some Custom table field.
If this validation fails ( Like after pressing the Enter Key Or Save ) that particular Line item has to be removed from
purchase order with some message. Suppose Purchase order has 5 line items , 4th Item failed in validation, then the
postion of 5th Line item should be 4th and line item which has error must be removed .
You can check the methods PROCESS_ITEM and CHECK of BADI ME_PROCESS_PO_CUST.
These might help in meeting your requirement.
You can also check if Enhancement MM06E005 helps in meeting your requirement.
Following ar ethe user exits for Me21/Me21n:
AMPL0001 User subscreen for additional data on AMPL
LMEQR001 User exit for source determination
LWSUS001 Customer-Specific Source Determination in Retail
M06B0001 Role determination for purchase requisition release
M06B0003 Number range and document number
M06B0004 Number range and document number
M06E0005 Role determination for release of purchasing documents
ME590001 Grouping of requsitions for PO split in ME59
MEETA001 Define schedule line type (backlog, immed. req., preview)
MEFLD004 Determine earliest delivery date f. check w. GR (only PO)
MEVME001 WE default quantity calc. and over/ underdelivery tolerance
MM06E001 User exits for EDI inbound and outbound purchasing documents
MM06E003 Number range and document number
MM06E004 Control import data screens in purchase order
MM06E005 Customer fields in purchasing document
MM06E007 Change document for requisitions upon conversion into PO
MM06E008 Monitoring of contr. target value in case of release orders
MM06E010 Field selection for vendor address
MMFAB001 User exit for generation of release order
MRFLB001 Control Items for Contract Release Order ....

User Exit or Badi validations at item level in


ME21N and ME22N
Anyone know of any User Exit or Badi that can be used to perform validations at item level in ME21N and
ME22N transactions need to do validations materials at each position. I've found some but I do not work or are
across the board when clic on the save button, the customer wants a treatment level position and the error
message is in the position where the error occurs.
ME_PROCESS_PO_CUST Method PROCESS ITEM
Exits
-------------------------
EXIT_SAPMM06E_012
EXIT_SAPMM06E_016
EXIT_SAPMM06E_017
How to search for a BAdi?
Run tcode ME21N/ME22N and in SE24 open class Cl_EXITHANDLER, find method GET_INSTANCE and set a
break point after CALL METHOD cl_exithandler=>get_class_name_by_interface and you can find BAdi's called
during execution.
we did some validations for PO item few months before i am pasting its code below. it must help you.
Implement method posted of ME_PURCHDOC_POSTED, get all the details of items and
then change the fields values and pass to BAPI_PO_CHANGE so as to change PO details
after Post PO processing.]
IF SY-UNAME = 'C5133392'.

DATA: wa_ekpo like line of IM_EKPO,


lt_po_item type standard table of BAPIMEPOITEM,
lt_po_itemx type standard table of BAPIMEPOITEMX,
wa_po_item type BAPIMEPOITEM,
wa_po_itemx type BAPIMEPOITEMX,
lt_return type standard table of BAPIRET2.

*data: ls_ebeln type BAPIMEPOHEADER-PO_NUMBER.


DATA : PO_NUMBER TYPE EKKO-EBELN.

check im_ekko-ebeln ne PO_NUMBER.

PO_NUMBER = im_ekko-ebeln.

LOOP AT IM_EKPO into wa_ekpo.

wa_po_item-PO_ITEM = wa_ekpo-ebelp.
* EVERS to be derived
wa_po_item-QUANTITY = '32'.
APPEND wa_po_item to lt_po_item .

wa_po_itemx-PO_ITEM = wa_ekpo-ebelp.
wa_po_itemx-QUANTITY = 'X'.
APPEND wa_po_itemx to lt_po_itemx.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CHANGE' IN BACKGROUND TASK
EXPORTING
purchaseorder = PO_NUMBER
NO_MESSAGING = 'X'
NO_MESSAGE_REQ = 'X'
NO_AUTHORITY = 'X'
NO_PRICE_FROM_PO = 'X'
TABLES
RETURN = lt_return
POITEM = lt_po_item
POITEMX = lt_po_itemx.

First thing you need to create BADI implementation.


For validation at Item level, you need write in method Process_Item or header level Process_header.
For example in the below code, i want make tax code as mandatory so i have written the below code.
i.e.,
decalration for acessing the data in method.
DATA: re_data TYPE mepoitem.

DATA: re_header TYPE REF TO if_purchase_order_mm.

DATA: re_hdrdata TYPE mepoheader.


INCLUDE mm_messages_mac. "useful macros for message handling

re_data = im_item->get_data( ). "fetching the item level data.


re_header = im_item->get_header( ).
re_hdrdata = re_header->get_data( ).
IF ( sy-tcode = 'ME21N' OR sy-tcode = 'ME22N' ) and re_hdrdata-ekorg = '0001' AND re_data-pstyp NE '7' and
re_data-mwskz IS INITIAL and re_data-LOEKZ eq ''.
mmpur_metafield mmmfd_tax_code. "metafield for Taxcode.
mmpur_message_forced 'E' 'ME' '563' '' '' '' ''. "Error msg number 563 and Msg class 'ME', Msg type 'E' error

* to invalidate the object call the method invalidate


CALL METHOD im_item->invalidate( ). " im_item is parameter of badi PROCESS_item

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy