Difference between revisions of "SAP MM PURCHASING"

From SapWiki
Line 61: Line 61:
 
  endif.
 
  endif.
 
* endof insert
 
* endof insert
 +
endmethod.</nowiki>
 +
 +
===BAdi ME_PROCESS_REQ_CUST===
 +
The functionality of Enjoy purchase requisitions can be extensively enhanced via this BAdI. For example, you can run several checks, overwrite the contents of standard fields, or post custom data .
 +
 +
Call points:
 +
*Transactions ME51N, ME52N, ME53N, and ME59N
 +
*BAPI_PR_CREATE
 +
*BAPI_PR_CHANGE
 +
 +
Methods:
 +
*INITIALIZE
 +
*OPEN
 +
*PROCESS_HEADER
 +
*PROCESS_! TEM
 +
*PROCESS_ACCOUNT
 +
*CHECK
 +
*POST
 +
*CLOSE
 +
*FIELDSELECTION_HEADER_REFKEYS
 +
*FIELDSELECTION_HEADER
 +
*FIELDSELECTION_ITEM_REFKEYS
 +
*FIELDSELECTION_ITEM
 +
 +
example:
 +
 +
<nowiki>method IF_EX_ME_PROCESS_REQ_CUST~PROCESS_ITEM .
 +
data: l_mereq_item type mereq_item.
 +
data lt_items type MMPUR_ACCOUNTING_LIST.
 +
data lt_EXKN type EXKN.
 +
data wa_items like line of lt_items.
 +
data wa_zceco type zceco.
 +
data wa_zmatclase type zmatclase.
 +
check im_count <= 1.
 +
l_mereq_item = im_item->get_data( ).
 +
lt_items = im_item->IF_ACCT_CONTAINER_MM~GET_ITEMS( ).
 +
SELECT SINGLE KOSTL INTO wa_zceco-kostl FROM ZCECO
 +
WHERE KOSTL = l_mereq_item-BEDNR.
 +
IF SY-SUBRC = 0.
 +
  SELECT SINGLE SAKTO INTO wa_zmatclase-sakto
 +
                      FROM ZMATCLASE
 +
                      WHERE MATNR = l_mereq_item-MATNR.
 +
  if sy-subrc = 0.
 +
    loop at lt_items into wa_items.
 +
        lt_exkn = wa_items-model->get_exkn( ).
 +
    endloop.
 +
    lt_exkn-sakto =  wa_zmatclase-sakto.
 +
    call method wa_items-model->set_exkn( lt_exkn ).
 +
  endif.
 +
endif.
 
endmethod.</nowiki>
 
endmethod.</nowiki>
  
 
==Programa impresión O/C==
 
==Programa impresión O/C==
 
SAPFM06P y formulario MEDRUCK
 
SAPFM06P y formulario MEDRUCK

Revision as of 21:57, 12 April 2020

USER EXIT/BADI en Orden de Compra , Solicitud de Pedido

  • For verifications do not use field exits but enhancement MM06E005 (Purchase order) or MEREQ001 (PReq). Here, extensive user exits are available. The changing of default fields via field-exits is no longer supported in Transactions ME21N, ME22N, ME51N and ME52N. Enhancement in transaction SMOD => transaction CMOD
  • What enhancements are available for the user exits in purchasing?
Response:
See Note 320601.
See Notes 313925 and 456127 for EDI user exits.
  • What user exits are available for import data?
 Response:
 See Note 118573.

BAdi MEPO_PROCESS_PO_CUST

The BAdi MEPO_PROCESS_PO_CUST is ultimately used to integrate your custom data into the process flow of the purchase order to execute, for example, input checks and to integrate other function modules from your function group.

Call points:

  • Transactions ME21N, ME22N, and ME23N
  • Transaction ME29N
  • BAPI_PO_CREATE1
  • BAPI_PO_CHANGE

Methods:

  • INITIALIZE - From this method, you call the Initialize function module of your function group when you start your transaction.
  • OPEN - This method runs as soon as a purchase order is opened. Then you call the Open function module to make custom data available.
  • PROCESS_ITEM - You can check inputs at item level.
  • PROCESS_HEADER - You can check inputs at header level.
  • PROCESS_SCHEDULE - You can check inputs on schedules.
  • PROCESS_ACCOUNT - You can check inputs for account assignments.
  • CHECK - This method allows you to check the document completely.
  • POST - When the purchase order is saved, you must also save your own data by calling the Post function module.
  • CLOSE - You also call the Initialize function module before a new document is started.
  • FIELOS ELECTION_* - Depending on the context , you can set the field status of your custom fields in various methods for the field selection.

example:

method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM .
* begin of insert SYDAB01
 DATA: ls_mepoitem TYPE mepoitem.
 data lt_account type PURCHASE_ORDER_ACCOUNTINGS.
 data lt_EXKN type MEPOACCOUNTING.
 data wa_account like line of lt_account.
 data wa_zceco type zceco.
 data wa_zmatclase type zmatclase.
 ls_mepoitem = im_item->get_data( ).
 lt_account = im_item->GET_ACCOUNTINGS( ).
 SELECT SINGLE KOSTL INTO wa_zceco-kostl FROM ZCECO
 WHERE KOSTL = ls_mepoitem-BEDNR.
 IF SY-SUBRC = 0.
 SELECT SINGLE SAKTO INTO wa_zmatclase-sakto
                       FROM ZMATCLASE
                       WHERE MATNR = ls_mepoitem-MATNR.
   if sy-subrc = 0.
     loop at lt_account into wa_account.
       lt_exkn = wa_account-ACCOUNTING->get_data( ).
     endloop.
     lt_exkn-sakto =  wa_zmatclase-sakto.
     call method wa_account-ACCOUNTING->set_data( lt_exkn ).
   endif.
 endif.
* endof insert
endmethod.

BAdi ME_PROCESS_REQ_CUST

The functionality of Enjoy purchase requisitions can be extensively enhanced via this BAdI. For example, you can run several checks, overwrite the contents of standard fields, or post custom data .

Call points:

  • Transactions ME51N, ME52N, ME53N, and ME59N
  • BAPI_PR_CREATE
  • BAPI_PR_CHANGE

Methods:

  • INITIALIZE
  • OPEN
  • PROCESS_HEADER
  • PROCESS_! TEM
  • PROCESS_ACCOUNT
  • CHECK
  • POST
  • CLOSE
  • FIELDSELECTION_HEADER_REFKEYS
  • FIELDSELECTION_HEADER
  • FIELDSELECTION_ITEM_REFKEYS
  • FIELDSELECTION_ITEM

example:

method IF_EX_ME_PROCESS_REQ_CUST~PROCESS_ITEM .
 data: l_mereq_item type mereq_item.
 data lt_items type MMPUR_ACCOUNTING_LIST.
 data lt_EXKN type EXKN.
 data wa_items like line of lt_items.
 data wa_zceco type zceco.
 data wa_zmatclase type zmatclase.
 check im_count <= 1.
 l_mereq_item = im_item->get_data( ).
 lt_items = im_item->IF_ACCT_CONTAINER_MM~GET_ITEMS( ).
 SELECT SINGLE KOSTL INTO wa_zceco-kostl FROM ZCECO
 WHERE KOSTL = l_mereq_item-BEDNR.
 IF SY-SUBRC = 0.
   SELECT SINGLE SAKTO INTO wa_zmatclase-sakto
                       FROM ZMATCLASE
                       WHERE MATNR = l_mereq_item-MATNR.
   if sy-subrc = 0.
     loop at lt_items into wa_items.
        lt_exkn = wa_items-model->get_exkn( ).
     endloop.
     lt_exkn-sakto =  wa_zmatclase-sakto.
     call method wa_items-model->set_exkn( lt_exkn ).
   endif.
 endif.
endmethod.

Programa impresión O/C

SAPFM06P y formulario MEDRUCK