Wednesday, October 8, 2014

Blocking PO Line changes based on GRN

Requirement : To Block the PO line item if the GR for that list is completed (PO-quantity = GR quntity)

The above requirement can be achieved by implementing the BAdI ME_PROCESS_PO_CUST


The method FIELDSELECTION_ITEM but couldn't manipulate the standard fields display options, as we don't get these fields in the ch_fieldselection. These are only meant for custom subscreen used in PO Item.

So basically standard fields display properties can only be set using the field selection group set for that particular document type in customizing SPRO.

You can create a copy of this NBF to ZNBF  and check  display only for the required fields.


Then now in method ME_PROCESS_PO_CUST~FIELDSELECTION_ITEM_REFKEYS where you get the item details also.you can use the below kind of code:


DATA: LS_MEPOITEM TYPE MEPOITEM.

  LS_MEPOITEM = IM_ITEM->GET_DATA( ).

  IF . " Set Field Selection group based on your requirement 

    CH_KEY2 = 'ZNBF1'.

     ELSE.

    CH_KEY2 = 'NBF'.

  ENDIF.


Note that the above changes does not disable the Delivery Schedule Tab and Conditions Tab.
For the Delivery Tab you need to implement your logic in IF_EX_ME_PROCESS_PO_CUST~PROCESS_SCHEDULE and for Conditions Tab implement your logic in IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM comparing to database values.