Passing Default values to me21n(ME_PROCESS_PO_CUST)

 Passing Default values to me21n(ME_PROCESS_PO_CUST)

ME_PROCESS_PO_CUST (IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM)Passing default values to item category based on po type(in header)

  METHOD if_ex_me_process_po_cust~process_item.
      
DATA:
        flg_pers  
TYPE c,
        ref_pohdr 
TYPE REF TO if_purchase_order_mm,
        wa_pohdr  
TYPE mepoheader,
        wa_item   
TYPE mepoitem,
        wa_pitem  
TYPE mepoitem.

* This method can be used to get referance(Pointer) for header data
      ref_pohdr 
im_item->get_header( ).

* Read header data from above referance
      wa_pohdr 
ref_pohdr->get_data( ).

* im_item of PROCESS_ITEM can be used as a referance to get item data
      wa_item 
im_item->get_data( ).

* IS_PERSISTENT can be used to check whether item is already created or it is nw entry
      flg_pers 
im_item->is_persistent( ).

* We can apply logic for only new items
      
IF flg_pers IS NOT INITIAL.
        
EXIT.
      
ENDIF.

* in this example I am modifying Item category for few conditions
      
IF wa_pohdr-bsart EQ 'UB2'." AND wa_item-knttp = ‘F’.
        wa_item
-pstyp 'U'.
        im_item
->set_dataEXPORTING im_data wa_item ).
      
ENDIF.

  ENDMETHOD.

Result:


 

 

 

Comments

Popular posts from this blog

CDS Views: Table Functions with Example

Passing Dynamic Variables to SO10 TEXT

Adobe Form/PDF Form Introduction