03-25-2006 2:37 AM
I am working on an user exit which should reset the order quantity in Me22 if user tries to modify it. Suppose the original qty is 200 KG and user tries to modify it to 100 KG, it should be reset back to 200 KG upon save. I tried user exit EXIT_SAPMM06E_013 and EXIT_SAPMM06E_017. I tried to over write new values of that field with old values. ( Eg. YEKPO-MENGE to XEKPO-MENGE). But still the PO document is saved with XEKPO-MENGE . Is there any other process overwriting it back or is it losing it scope outside my Include ? Here is my code in EXIT_SAPMM06E_013.
Also tried putting YEKET-MENGE to XEKET-MENGE. Still did not work. Then i moved to EXIT_SAPMM06E_017. Tried to copy i_ekpo_old-menge to i_ekpo-menge. Still did not help.
I had similar problem with Sales order too. I figured out that along with YVBAP-KWMENG copy to XVBAP-KWMENG, i had to do YVBEP-CMENG to XVBEP-CMENG and it worked fine.
*----------------------------------------------------------------------
*
* INCLUDE ZSWI_NOMIT_PO_VALIDATION
*
*----------------------------------------------------------------------
DATA: i_wa_xekpo TYPE uekpo,
i_wa_yekpo TYPE uekpo,
i_oijnomi TYPE oijnomi.
DATA: i_wa_yeket TYPE ueket,
i_wa_xeket TYPE eket,
i_eket TYPE eket OCCURS 0 .
DATA :i_tabix TYPE sytabix.
CONSTANTS: c_char_i VALUE 'I',
c_char_e VALUE 'E',
c_char_f VALUE 'F',
c_char_p VALUE 'P',
c_char_v VALUE 'V',
c_bulk_order(2) VALUE 'ZB',
c_po_change(4) VALUE 'ME22',
c_pon_change(5) VALUE 'ME22N'.
IF i_ekko-bstyp = c_char_f AND " Purchase orders
i_ekko-bsart = c_bulk_order AND " Bulk orders
sy-batch IS INITIAL AND " In foreground
( sy-tcode = c_po_change OR " PO Change
sy-tcode = c_pon_change ) . " Enjoy PO Change
CLEAR: i_wa_msg .
REFRESH: i_message .
LOOP AT xekpo INTO i_wa_xekpo .
i_tabix = sy-tabix.
READ TABLE yekpo
INTO i_wa_yekpo
WITH KEY ebeln = i_wa_xekpo-ebeln
ebelp = i_wa_xekpo-ebelp .
IF sy-subrc EQ 0 .
CLEAR: i_oijnomi .
SELECT SINGLE * FROM oijnomi
INTO i_oijnomi
WHERE docnr = i_wa_xekpo-ebeln
AND docitm = i_wa_xekpo-ebelp
AND docind = c_char_p .
IF sy-subrc EQ 0. " TIED TO A NOMINATION
IF i_wa_xekpo-menge NE i_wa_yekpo-menge .
xekpo-menge = i_wa_yekpo-menge.
MODIFY xekpo FROM xekpo INDEX i_tabix
TRANSPORTING menge .
READ TABLE yeket INTO i_wa_yeket
WITH KEY ebeln = i_wa_xekpo-ebeln
ebelp = i_wa_xekpo-ebelp .
xeket-menge = i_wa_yeket-menge.
MODIFY xeket FROM xeket INDEX i_tabix
TRANSPORTING menge .
ELSEIF i_wa_xekpo-werks NE i_wa_yekpo-werks .
MODIFY xekpo FROM i_wa_yekpo INDEX i_tabix
TRANSPORTING werks.
ENDIF .
ENDIF .
ENDIF .
ENDLOOP .
ENDIF .
03-25-2006 3:40 AM
Hello Shareen,
You cannot modify any Purchase order fields (Header and Line)with these function exits EXIT_SAPMM06E_XXX in 4.6C. They can only be used for validations or outbound scenarios such as updating a custom table. Probably in later versions, you may be able to do that. When we had such a requirement, we ended up creating a custom enhancement.
Thanks,
Venu
03-25-2006 3:15 AM
Hi Shareen,
Please check whether you have populated update flag field with value 'C' (Change) in XEKPO or XEKET structures. I do not have SAP system now therefore I can not tell the exact field name. Something like UPDKZ perhaps.
Hope this will help.
Regards,
Ferry Lianto
03-26-2006 4:13 AM
The XEKPO already has Update Indicator in KZ ( this is the only update indicator).Same goes to XEKET too. Both are marked U for Update.
Thanks,
Shareen
03-25-2006 3:40 AM
Hello Shareen,
You cannot modify any Purchase order fields (Header and Line)with these function exits EXIT_SAPMM06E_XXX in 4.6C. They can only be used for validations or outbound scenarios such as updating a custom table. Probably in later versions, you may be able to do that. When we had such a requirement, we ended up creating a custom enhancement.
Thanks,
Venu
03-26-2006 4:14 AM
Venu,
I am sure its possible for PO in 4.6c . Coz I was able to do it for the Sales order.
Thanks
Shareen
03-27-2006 10:31 PM
Hello Shareen,
If you look at the documentation of SMOD object 'MM06E005', SAP has clearly stated that standard fields cannot be changed.
Thanks,
Venu
03-28-2006 6:04 AM
If the field are not allowed to be changed in PAI, atleast they should be allowed On Save. I could do a similar thing on Sales order side.Thanks again, for all your efforts!!
rgds,
SHK