Translate

Saturday, 18 August 2012

Purchase Order Badi

Description :

Purchase Order BADI: PO Creation Not allow if Material have not maintain Standard Cost.


METHOD if_ex_me_process_po_cust~process_item.

DATA : g_header TYPE REF TO if_purchase_order_mm. "im_header
DATA : g_mepoheader TYPE mepoheader. "Header data
DATA : g_item TYPE mepoitem.
DATA : l_stprs TYPE stprs.
data: text1 TYPE String.
INCLUDE mm_messages_mac. "useful macros for message handling



g_item = im_item->get_data( ).
g_header = im_item->get_header( ).
g_mepoheader = g_header->get_data( ).


if g_mepoheader-bsart = 'IO' and g_mepoheader-bukrs = '1302'.
select SINGLE stprs from mbew into l_stprs WHERE matnr = g_item-matnr.
if l_stprs IS INITIAL.
CONCATENATE 'Standard Cost is not Exist for Material ' g_item-matnr INTO text1.
MESSAGE text1 TYPE 'E'.
endif.

endif.
endmethod.

No comments: