Use BAdI to set the Shipping Point automatically for the PO which is associated with SD process.
When a Purchase Order is associated with the Sales & Distribution process, always the shipping data is required within PO (Shipping Data tab will comes when user creates PO).
Normally, the Intercompany Purchase Order or STO are belongs to those kinds of purchase orders.
There is a business scenario that is when end user creates an Intercompany Purchase Order or a STO Purchase Order, user wants set the value of Storage loc. for EP (storage location for external procurement : which exists in the MRP 2 view of material master-MM03 ) to the Shipping Point which exists in PO’s Shipping Data tab.
Here is a simple solution to solve this issue, that is use a BAdI to do an Enhancement to realize it.
In the method IF_EX_ME_PROCESS_PO_CUST~PROCESS-ITEM, add the below ABAP source codes:
DATA: IS_ITEM TYPE MEPOITEM,
IS_HEADER TYPE REF TO IF_PURCHASE_ORDER_MM,
ITEMS TYPE PURCHASE_ORDER_ITEMS,
ITEM_OBJ TYPE PURCHASE_ORDER_ITEM,
RE_HEADER TYPE MEPOHEADER,
MY_EKPV TYPE EKPV,
L_LGFSB TYPE LGFSB.
IS_HEADER = IM_ITEM->GET_HEADER( ).
RE_HEADER = IS_HEADER->GET_HEADER( ).
IS_ITEM = IM_ITEM->GET_DATA( ).
ITEMS = IS_HEADER->GET_ITEMS( ).
IF IS_ITEM-LFRET = ‘ZNLC’.
IF NOT ITEMS IS INITIAL.
LOOP AT ITEMS INTO ITEM_OBJ.
MY_EKPV = ITEM_OBJ-ITEM->GET_SHIPPING_DATA( ).
SELECT SINGLE LGFSB
I NTO L_LGFSB
WHERE MATNR = IS_ITEM-MATNR
AND WERKS = RE_HEADER-FESWK.
IF SY-SUBRC = 0.
MY_EKPV-VSTEL = L_LGFSB.
ITEM_OBJ-ITEM->SET_SHIPPING_DATA( IM_EKPV = MY_EKPV ).
Then the value of Storage loc. for EP will be set to the Shipping Point which exists in that PO’s Shipping Data tab automatically.
1.What is Storage loc. for EP ? (Definition from SAP):
Key of the storage location that is proposed in the purchase requisition in materials planning for subsequent storage of the material. In the case of a material procured externally, this storage location is proposed in the planned order in materials planning.
2.What is Shipping Point ? (Definition from SAP):
It is the physical location (for example, a warehouse or collection of loading ramps) from which you ship the item.
You can predefine shipping/receiving points in the system, based on different combinations of a).plants, b).shipping conditions, c).loading groups
During delivery processing, the shipping/receiving point is the most important criterion that you use to select deliveries.A delivery can be shipped from one shipping point only or received at one receiving point only.