In some industries, it is a common practice to have multiple units of measure in procurement. For example, in chemical industry, the products are procured and stored in ‘drums'(order unit), price is negotiated in KGs (Price unit) and warehouse issues the chemical in KG (base unit and issue unit). Currently, SRM-SUS supports only order unit and does not support price units. Price conversion is supported to a limited extent when conversion between order unit & price unit is defined in unit of measure configuration itself. For example, conversions like ‘L' and ‘KL' are supported. However, it is a common practice in the industry as well to use dimensionless units (like DR, PC, CAN etc) and define the conversion between 2 units within the PO. SAP ERP does supports this type of usage.
I have completed a project solution to support different ordering units and pricing ordering units and their conversion in SUS. It make use of standard enhancement tools like Customer fields(CUF), BADIs and Enhancement spots.
h2. Steps:
1. Defining customer field in SUSPO
h3. 2. Define ZZINCL_EEW_PD_ITEM_CSF_SUSPO - Txn SE11
- Data Type : INCL_EEW_PD_ITEM_CSF_SUSPO and Click on display
- Click ‘Append Structure’, give name ZZINCL_EEW_PD_ITEM_CSF_SUSPO
- Include the fields as per following screen shots. You can also define a structure separately if you wish to
- Activate the structure
!http://i261.photobucket.com/albums/ii54/manualisbetter/1.jpg|height=429|alt=|width=1023|src=http://i...!
Currency/Quantity fields view
!http://i261.photobucket.com/albums/ii54/manualisbetter/2.jpg|height=400|alt=|align=baseline|width=10...!
h3. 3. Define structure ZAINCL_EEW_PD_ITEM_CSF- Txn SE11
- Data Type : INCL_EEW_PD_ITEM_CSF and Click on Display
- Click ‘Append Structure', give name ZAINCL_EEW_PD_ITEM_CSF
- Add the Include (ZACI_ITEM_MMSUS) defined in step 1 in this structure also as per following screen shot
- Activate the structure
!http://i261.photobucket.com/albums/ii54/manualisbetter/9.jpg|height=300|alt=|width=1024|src=http://i...!
h3. 4. Define structure ZAINCL_EEW_PD_ITEM_CSF_SUSPCO
Txn SE11
Data Type : INCL_EEW_PD_ITEM_CSF_SUSPCO & Click on Display
Click ‘Append Structure’, give name ZAINCL_EEW_PD_ITEM_CSF_SUSPCO
Add the Include (ZACI_ITEM_MMSUS) defined in step 1 in this structure also as per following screen shot
Activate the structure
!http://i261.photobucket.com/albums/ii54/manualisbetter/10.jpg|height=350|alt=|width=1024|src=http://...! !http://i261.photobucket.com/albums/ii54/manualisbetter/10.jpg|height=1|alt=|width=1|src=http://i261....!
h3. 5. 5. Make Field Control Settings for Tables
Menu: SPRO-> SRM -> SUS -> Make field control settings for Tables
Make the following settings
!http://i261.photobucket.com/albums/ii54/manualisbetter/11.jpg|height=300|alt=|width=1024|src=http://...!
Add the following entries (ZZ_* fields)
!http://i261.photobucket.com/albums/ii54/manualisbetter/12.jpg|height=180|alt=|width=1024|src=http://...!
!http://i261.photobucket.com/albums/ii54/manualisbetter/12.jpg|height=1|alt=|width=1|src=http://i261....!
Ignore the namespace warning message while saving.
!http://i261.photobucket.com/albums/ii54/manualisbetter/13.jpg|height=180|alt=|width=1024|src=http://...!
!http://i261.photobucket.com/albums/ii54/manualisbetter/13.jpg|height=1|alt=|width=1|src=http://i261....!
6. Create Remote Function Module in ERP : Z_PO_GETDETAIL
Txn: SE37
Create a Remote-Enabled function module Z_PO_DETAIL as follows.
!http://i261.photobucket.com/albums/ii54/manualisbetter/14.jpg|height=1|alt=|width=1|src=http://i261....! !http://i261.photobucket.com/albums/ii54/manualisbetter/15.jpg|height=1|alt=|width=1|src=http://i261....!
!http://i261.photobucket.com/albums/ii54/manualisbetter/15.jpg|height=320|alt=|width=1024|src=http://...!
Source code as follows:
FUNCTION Z_PO_GETDETAIL .
"----
</p><p>""Local Interface:</p><p>" IMPORTING" VALUE(PURCHASEORDER) TYPE BAPIEKKO-PO_NUMBER</p><p>" VALUE(ITEMNUMBER) TYPE BAPIEKPO-PO_ITEM" EXPORTING</p><p>" VALUE(E_LMEIN) TYPE EKPO-LMEIN" VALUE(E_BPRME) TYPE EKPO-BPRME</p><p>" VALUE(E_BPUMZ) TYPE EKPO-BPUMZ" VALUE(E_BPUMN) TYPE EKPO-BPUMN</p><p>" VALUE(E_NETPR) TYPE EKPO-NETPR" VALUE(E_PEINH) TYPE EKPO-PEINH</p><p>"----
select single * from ekpo
where ebeln = purchaseorder
and ebelp = itemnumber.
if sy-subrc = 0.
e_lmein = ekpo-lmein.
e_bprme = ekpo-bprme.
e_bpumz = ekpo-bpumz.
e_bpumn = ekpo-bpumn.
e_netpr = ekpo-netpr.
e_peinh = ekpo-peinh.
endif.
ENDFUNCTION.
If you get a syntax error, while activating the function module:
Choose menu option Goto->Global Data
Add the following statement there:
tables: ekpo.
h3. 7. Implement BADI BBP_SAPXML1_IN_BADI in SUS
Txn : SE18Display BADI BBP_SAPXML1_IN_BADI
Follow menu Implementation ->Create
Create the implementation with name ZZ_PO_UOM as per following:!http://i261.photobucket.com/albums/ii54/manualisbetter/16.jpg|height=1|alt=|width=1|src=http://i261....!
!http://i261.photobucket.com/albums/ii54/manualisbetter/16.jpg|height=404|alt=|width=1024|src=http://...! In
method IF_EX_BBP_SAPXML1_IN_BADI~PURCHASEORDER_SUS.
* break-point.
* Data: Structure
data: ls_item type BBPS_PDEXT_SUSPO_ITEM_ICU.
* Import parameter(s)
DATA: L_EXTITEMNO TYPE EBELP.
* Export parameter(s)
data: l_LMEIN type MEINS.
data: l_BPRME type MEINS.
data: l_BPUMZ type EPEIN.
data: l_BPUMN type EPEIN.
data: l_NETPR type WERT11V.
data: l_PEINH type PEINH.
* Only need to handle for the PO from R/3 system
* check IS_PURCHASE_ORDER_MESSAGE-MESSAGE_HEADER-ID-SCHEME_AGENCY_ID CS 'R3'.
loop at ct_item into ls_item.
* where pr_unit is initial.
L_EXTITEMNO = LS_ITEM-NUMBER_EXT+5(5).
CALL FUNCTION 'Z_PO_GETDETAIL'
DESTINATION cs_header-SRC_LOGSYS
EXPORTING
PURCHASEORDER = cs_header-SRC_OBJECT_ID
ITEMNUMBER = L_EXTITEMNO
IMPORTING
E_LMEIN = l_LMEIN
E_BPRME = l_BPRME
E_BPUMZ = l_BPUMZ
E_BPUMN = l_BPUMN
E_NETPR = l_NETPR
E_PEINH = l_PEINH.
* PO detail is returned successfully
if sy-subrc = 0.
ls_item-pr_unit = ls_item-unit.
* Additionals customer fields for display
ls_item-ZZ_MEINS = ls_item-unit.
ls_item-ZZ_BPUMN = l_BPUMN.
ls_item-ZZ_BPRME = l_BPRME.
ls_item-ZZ_BPUMZ = l_BPUMZ.
* ls_item-ZZ_NETPR = l_NETPR.
* ls_item-ZZ_PEINH = l_PEINH.
ls_item-ZZ_NETPR = ls_item-price.
ls_item-ZZ_PEINH = ls_item-PRICE_UNIT.
modify ct_item from ls_item.
endif.
endloop.
endmethod.
h3. 8. Enhancement on standard SUS programs
Use the Enhancment spots in ABAP editor (Trx SE38) adapting the system to customer requirement. Enhancement spots are like BADI but provided in the standard programs to enable customers to enhance the standard functionalities.
9. Program LBBP_BD_MAPPING_SAPXML1F0R$$-Start: (1 )--
$$</p><p>ENHANCEMENT 1 ZZ_CUSTOMER_EXTENSION. "active version</p><p> IF cs_item-unit <> cs_item-pr_unit.</p><p> cs_item-pr_unit = space.</p><p> ENDIF.</p><p>ENDENHANCEMENT.</p><p>$$-End: (1 )--
$$ENDFORM. " map_scheduleline_in
Click on ‘Activate Enhancements' button.
h3. 10. Program LBBP_PDIGPF51
Enhancement spot procedure is explained in step 4
Include the following codes:
>>>
* price calculation with same price unit
PERFORM item_value USING p_itmigp-price
p_itmigp-quantity
p_itmigp-price_unit
CHANGING p_itmigp-value.
ENDIF.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1 ) Form SUSPO_ITM_CHECK, End D
$$-Start: (1 )--
$$</p><p>ENHANCEMENT 1 ZZ_CUSTOMER_EXTENSION2. "active version</p><p>* break-point.</p><p>* Import parameter(s)</p><p> DATA: L_EXTITEMNO TYPE EBELP.</p><p>* Export parameter(s)</p><p> data: l_BPUMZ type EPEIN.</p><p> data: l_BPUMN type EPEIN.</p><p>* SUS Limitation !!!</p><p>* PO Conversion Rate (Order <-> Price) unit is involved!!!</p><p>* -> Manual re-computation is required here to ensure right value is displayed</p><p>* only R/3 PO is affected here</p><p> check p_itmigp-SRC_OBJECT_TYPE cs 'BUS2012'.</p><p> L_EXTITEMNO = p_itmigp-SRC_ITM_ID+5(5).</p><p> CALL FUNCTION 'Z_PO_GETDETAIL'</p><p> DESTINATION p_itmigp-SRC_LOG_SYS</p><p> EXPORTING</p><p> PURCHASEORDER = p_itmigp-SRC_OBJECT_ID</p><p> ITEMNUMBER = L_EXTITEMNO</p><p> IMPORTING</p><p> E_BPUMZ = l_BPUMZ</p><p> E_BPUMN = l_BPUMN.</p><p> if sy-subrc = 0.</p><p> p_itmigp-value = p_itmigp-quantity * ( l_BPUMZ / l_BPUMN ) * ( p_itmigp-price / p_itmigp-price_unit ).</p><p> p_itmigp-price = ( l_BPUMZ / l_BPUMN ) * ( p_itmigp-price / p_itmigp-price_unit ).</p><p> p_itmigp-price_unit = 1.</p><p> ENDIF.</p><p>ENDENHANCEMENT.</p><p>$$-End: (1 )
$$</p><p>ENDFORM. " suspo_itm_check</p><p>>>> </p><p style="margin: 0in 0in 0pt" class="MsoNormal"> </p><h3 style="margin: 0in 0in 0pt" class="MsoNormal">11. [ | https://weblogs.sdn.sap.com/cs/blank/edit/wlg/]Program LBBP_PDIGPF86</h3><p style="margin: 0in 0in 0pt" class="MsoNormal"> </p><p style="margin: 0in 0in 0pt" class="MsoNormal">Enhancement spot procedure is explained in Step 4</p><p style="margin: 0in 0in 0pt" class="MsoNormal"> </p><p style="margin: 0in 0in 0pt" class="MsoNormal">Include the following codes:</p><p style="margin: 0in 0in 0pt" class="MsoNormal"> </p><p>>>> </p><p>* check the unit of measure</p><p> IF cs_new_itmigp-unit <> is_old_itmigp-unit OR p_method EQ c_check.</p><p> PERFORM check_unit_of_measure USING cs_new_itmigp-unit</p><p> is_icom-product</p><p> is_icom-ordered_prod</p><p> CHANGING</p><p> lv_error_unit.</p><p> ENDIF.</p><p>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1 ) Form CHECK_SUSINV_GENERAL_CHECKS, End D</p><p>$$-Start: (1 )
$$</p><p>ENHANCEMENT 2 ZZ_CUSTOMER_EXTENSION3. "active version</p><p>* break-point.</p><p>* Data structure</p><p> DATA: ls_item type BBP_PDS_PO_ITEM_D.</p><p>* Import parameter(s)</p><p> DATA: L_EXTITEMNO TYPE EBELP.</p><p>* Export parameter(s)</p><p> data: l_BPUMZ type EPEIN.</p><p> data: l_BPUMN type EPEIN.</p><p> data: l_NETPR type WERT11V.</p><p> data: l_PEINH type PEINH.</p><p> CALL FUNCTION 'BBP_PD_SUSASN_ITEM_GETDETAIL'</p><p> EXPORTING</p><p> I_GUID = CS_NEW_ITMIGP-SRC_GUID</p><p> IMPORTING</p><p> E_ITEM = ls_item.</p><p>* Manual re-computation is required here to ensure right value is displayed</p><p>* only R/3 PO is affected here</p><p> check ls_item-BE_REFOBJ_TYPE = 'BUS2012'.</p><p> L_EXTITEMNO = ls_item-BE_REFOBJ_ITEM+5(5).</p><p> CALL FUNCTION 'Z_PO_GETDETAIL'</p><p> DESTINATION IS_ICOM-BE_LOG_SYSTEM</p><p> EXPORTING</p><p> PURCHASEORDER = ls_item-BE_REFOBJ</p><p> ITEMNUMBER = L_EXTITEMNO</p><p> IMPORTING</p><p> E_BPUMZ = l_BPUMZ</p><p> E_BPUMN = l_BPUMN</p><p> E_NETPR = l_NETPR</p><p> E_PEINH = l_PEINH.</p><p> if sy-subrc = 0.</p><p> cs_new_itmigp-value = cs_new_itmigp-quantity * ( l_BPUMZ / l_BPUMN ) * ( l_NETPR / l_PEINH ).</p><p> ENDIF.</p><p>ENDENHANCEMENT.</p><p>$$-End: (1 )--
$$ENDFORM. " check_susinv_general_checks
>>>