SRM PO Diff Unit

18
UOM – Limitation in SUS Applies to: SAP SRM 4.0 onwards. For more information, visit the Supplier Relationship Management homepage . Summary Standard SUS does not support the purchase order with different order unit and order price unit if one of them is dimensionless or mutually non convertible. This document will provided the complete end to end solution of the mentioned problem. Author: Digvijay Singh Pawar Company: Larsen and Toubro Infotech Limited Created on: 04 September 2009 Author Bio Digvijay Singh Pawar is a SAP technical Consultant in Larsen and Toubro Infotech Limited. He has over 3.5 years of SAP experience. He has worked extensively in ABAP, ALE-IDoc and Workflow. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1

Transcript of SRM PO Diff Unit

UOM – Limitation in SUS

Applies to: SAP SRM 4.0 onwards.

For more information, visit the Supplier Relationship Management homepage.

Summary Standard SUS does not support the purchase order with different order unit and order price unit if one of them is dimensionless or mutually non convertible. This document will provided the complete end to end solution of the mentioned problem.

Author: Digvijay Singh Pawar

Company: Larsen and Toubro Infotech Limited

Created on: 04 September 2009

Author Bio Digvijay Singh Pawar is a SAP technical Consultant in Larsen and Toubro Infotech Limited. He has over 3.5 years of SAP experience. He has worked extensively in ABAP, ALE-IDoc and Workflow.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1

UOM – Limitation in SUS

Table of Contents Business Requirement........................................................................................................................................3 Standard SUS Functionality................................................................................................................................3 Solution Implementation .....................................................................................................................................4

Steps ...............................................................................................................................................................4 Append Structure in ‘INCL_EEW_PD_ITEM_CSF_SUSPO’ .......................................................................................4 Append Structure in ‘INCL_EEW_PD_ITEM_CSF_SUSPCO’.....................................................................................5 Append Structure in ‘INCL_EEW_PD_ITEM_CSF’......................................................................................................6 Create a Remote Enabled Function Module in ERP (R3) ............................................................................................7 Implement BAdI ‘BBP_SAPXML1_IN_BADI’ in SUS ...................................................................................................9 Enhancement on Standard SUS Programs................................................................................................................11 Program ‘LBBP_BD_MAPPING_SAPXML1F0R’.......................................................................................................12 Program ‘LBBP_PDIGPF51’ ......................................................................................................................................13 Program ‘LBBP_PDIGPF86’ (SRM 5.0 onwards) ......................................................................................................14 Make Field Control Settings for Tables (If using standard SUS UI) ...........................................................................15

Related Content................................................................................................................................................17 Disclaimer and Liability Notice..........................................................................................................................18

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 2

UOM – Limitation in SUS

Business Requirement Sometimes clients having a business requirement of creating Purchase Orders and SAs wherein the Order Price unit and Order Unit are different and one of them is dimensionless. Dimensionless units are those which do not have any physical unit of measure associated with it and are based on counts (E.g. EA, Bottles, cartons etc.)

Currently SRM-SUS (till SRM 7.0) supports only the Order unit and order price unit if it is same or mutually convertible (e.g. - gm. and KG) and any of them is not dimensionless. But if you use dimensionless units it does support in SAP ERP but not in SUS.

Standard SUS Functionality Standard SUS supports Dimensionless UOMs as well provided the order Unit is same as Order Price Unit.

UOMs of the same dimension can have different Order Unit and Order Price Unit. This is also supported by SAP

Standard SUS does not support the creation of PO in SUS when Order Unit is different from Order price unit and one of them is dimensionless

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 3

UOM – Limitation in SUS

Solution Implementation Implementing the solution for this is quite different in SRM 4.0 and above versions because SRM 4.0 does not support Enhancement spot for modifying standard SAP code.

Steps

Append Structure in ‘INCL_EEW_PD_ITEM_CSF_SUSPO’

This structure will add the custom fields in SUS PO item structure

• Transaction SE11

• Structure INCL_EEW_PD_ITEM_CSF_SUSPO and Click on display

• Click ‘Append Structure’, give name e.g. ZAINCL_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

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 4

UOM – Limitation in SUS

Currency / Quantity field view

Append Structure in ‘INCL_EEW_PD_ITEM_CSF_SUSPCO’

This structure will add the custom fields in SUS PCO item structure

• Transaction SE11

• Structure INCL_EEW_PD_ITEM_CSF_SUSPCO and Click on display

• Click ‘Append Structure’, give name e.g. 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

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 5

UOM – Limitation in SUS

Append Structure in ‘INCL_EEW_PD_ITEM_CSF’

This structure will add the custom fields in SRM PO item structure

• Transaction SE11

• Structure INCL_EEW_PD_ITEM_CSF and Click on display

• Click ‘Append Structure', give name e.g. ZAINCL_EEW_PD_ITEM_CSF

• Add the Include (ZSUS_STR_ITEM_MMSUS) defined in step 1 in this structure also as per following screen shot

• Activate the structure

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 6

UOM – Limitation in SUS

Create a Remote Enabled Function Module in ERP (R3)

This function module will fetch the required data from R3 for implementing solution

• Transaction SE37

• Create a remote enabled function module e.g. ZSUS_PO_DETAILS_TEMP as follows.

Import Parameters:

Export Parameters:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 7

UOM – Limitation in SUS

Source code:

FUNCTION zsus_po_details_temp. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(IW_PO_NUMBER) TYPE BAPIEKKO-PO_NUMBER *" VALUE(IW_ITEM_NUMBER) TYPE BAPIEKPO-PO_ITEM *" EXPORTING *" VALUE(EW_LMEIN) TYPE EKPO-LMEIN *" VALUE(EW_BPRME) TYPE EKPO-BPRME *" VALUE(EW_BPUMZ) TYPE EKPO-BPUMZ *" VALUE(EW_BPUMN) TYPE EKPO-BPUMN *" VALUE(EW_NETPR) TYPE EKPO-NETPR *" VALUE(EW_PEINH) TYPE EKPO-PEINH *"---------------------------------------------------------------------- *" Fetch additional fields for UOM from EKPO table SELECT SINGLE lmein bprme bpumz bpumn netpr peinh FROM ekpo INTO (ew_lmein, ew_bprme, ew_bpumz, ew_bpumn, ew_netpr, ew_peinh) WHERE ebeln EQ iw_po_number AND ebelp EQ iw_item_number. ENDFUNCTION.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 8

UOM – Limitation in SUS

Implement BAdI ‘BBP_SAPXML1_IN_BADI’ in SUS

Call the function module in BAdI that you have created in R3

• Transaction SE18

• Create the implementation e.g. ‘ZBBP_SAPXML1_IN_BADI’ as per following

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 9

UOM – Limitation in SUS

In method ‘IF_EX_BBP_SAPXML1_IN_BADI~PURCHASEORDER_SUS’

Write the following code:

METHOD if_ex_bbp_sapxml1_in_badi~purchaseorder_sus. DATA: w_extitemno TYPE ebelp, w_lmein TYPE meins, w_bprme TYPE meins, w_bpumz TYPE epein, w_bpumn TYPE epein, w_netpr TYPE wert11v, w_peinh TYPE peinh. FIELD-SYMBOLS: <fs_item> TYPE bbps_pdext_suspo_item_icu. *" UOM development *" Only need to handle for the PO from R/3 system LOOP AT ct_item ASSIGNING <fs_item>. CLEAR: w_extitemno, w_lmein, w_bprme, w_bpumz, w_bpumn, w_netpr, w_peinh. w_extitemno = <fs_item>-number_ext+5(5).

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 10

UOM – Limitation in SUS

*" Fetch the additional fields from R3 for UOM calculation CALL FUNCTION 'ZSUS_PO_DETAILS_TEMP' DESTINATION cs_header-src_logsys EXPORTING iw_po_number = cs_header-src_object_id+4 iw_item_number = w_extitemno IMPORTING ew_lmein = w_lmein ew_bprme = w_bprme ew_bpumz = w_bpumz ew_bpumn = w_bpumn ew_netpr = w_netpr ew_peinh = w_peinh. * PO detail is returned successfully IF sy-subrc EQ 0. MOVE: <fs_item>-unit TO <fs_item>-pr_unit, * Additional customer fields for display <fs_item>-unit TO <fs_item>-zz_meins, w_bpumn TO <fs_item>-zz_bpumn, w_bprme TO <fs_item>-zz_bprme, w_bpumz TO <fs_item>-zz_bpumz, <fs_item>-price TO <fs_item>-zz_netpr, <fs_item>-price_unit TO <fs_item>-zz_peinh. ENDIF. ENDLOOP. *End UOM development ENDMETHOD. 

Enhancement on Standard SUS Programs

• Transaction SE18

Include LBBP_BD_MAPPING_SAPXML1F0R

Include LBBP_PDIGPF51

• For SRM 5.0 onwards

Include LBBP_BD_MAPPING_SAPXML1F0R

Include LBBP_PDIGPF51

Include LBBP_PDIGPF86

For SRM 4.0 you need to take the access key for adding code in standard include and for SRM 5.0 and above you can use enhancement option available in se38

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 11

UOM – Limitation in SUS

Program ‘LBBP_BD_MAPPING_SAPXML1F0R’

• Transaction SE38

• Press <Shift+F4> or click on button to have the screen in enhancement mode. (SRM 5.0 and above)

• Follow menu Edit -> Enhancement options -> Show implicit Enhancement options, you will see the yellow lines showing enhancement spots at the end of the program.

• Select the yellow line and follow menu option Edit -> Enhancement operations -> Create

enhancement

• In the popup for type of enhancement, select ‘Code'.

• Enter the name of the enhancement e.g. ZZ_ENHANCEMENT1

PERFORM map_quantity_in USING <scheduleline> 'QUANTITY' CHANGING cs_item-quantity cs_item-unit. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1 ) Form MAP_SCHEDULELINE_IN, End D *$*$-Start: (1 )--------------------------------------------------------------------------------$*$* ENHANCEMENT 1 ZZ_CUSTOMER_EXTENSION. "active version IF cs_item-unit <> cs_item-pr_unit. cs_item-pr_unit = space. ENDIF. ENDENHANCEMENT. *$*$-End: (1 )--------------------------------------------------------------------------------$*$* ENDFORM. " map_scheduleline_in

• Click on ‘Activate Enhancement’ button.

Note: If you are on SRM 4.0 than just add the below code before ‘ENDFORM'

IF cs_item-unit <> cs_item-pr_unit. cs_item-pr_unit = space. ENDIF.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 12

UOM – Limitation in SUS

Program ‘LBBP_PDIGPF51’ • For SRM 5.0 and above add the following code using enhancement options.

* 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 )--------------------------------------------------------------------------------$*$* ENHANCEMENT 1 ZZ_CUSTOMER_EXTENSION2. "active version DATA: l_EXTITEMNO TYPE EBELP. DATA: l_BPUMZ TYPE EPEIN. DATA: l_BPUMN TYPE EPEIN. check p_itmigp-SRC_OBJECT_TYPE cs 'BUS2012'. L_EXTITEMNO = p_itmigp-SRC_ITM_ID+5(5). CALL FUNCTION 'Z_PO_GETDETAIL' DESTINATION p_itmigp-SRC_LOG_SYS EXPORTING PURCHASEORDER = p_itmigp-SRC_OBJECT_ID ITEMNUMBER = L_EXTITEMNO IMPORTING E_BPUMZ = l_BPUMZ E_BPUMN = l_BPUMN. if sy-subrc = 0. p_itmigp-value = p_itmigp-quantity * ( l_BPUMZ / l_BPUMN ) * ( p_itmigp-price / p_itmigp-price_unit ). p_itmigp-price = ( l_BPUMZ / l_BPUMN ) * ( p_itmigp-price / p_itmigp-price_unit ). p_itmigp-price_unit = 1. ENDIF. ENDENHANCEMENT. *$*$-End: (1 )--------------------------------------------------------------------------------$*$* ENDFORM. " suspo_itm_check

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 13

UOM – Limitation in SUS

• For SRM 4.0 just add the following code using access key.

DATA: L_EXTITEMNO TYPE EBELP. DATA: l_BPUMZ type EPEIN. DATA: l_BPUMN type EPEIN. check p_itmigp-SRC_OBJECT_TYPE cs 'BUS2012'. L_EXTITEMNO = p_itmigp-SRC_ITM_ID+5(5). CALL FUNCTION 'ZSUS_PO_DETAILS_TEMP' DESTINATION p_itmigp-SRC_LOG_SYS EXPORTING iw_po_number = p_itmigp-SRC_OBJECT_ID+4 iw_item_number = L_EXTITEMNO IMPORTING EW_BPUMZ = l_BPUMZ EW_BPUMN = l_BPUMN . if sy-subrc = 0. p_itmigp-value = p_itmigp-quantity * ( l_BPUMZ / l_BPUMN ) * ( p_itmigp-price / p_itmigp-price_unit ). p_itmigp-price = ( l_BPUMZ / l_BPUMN ) * ( p_itmigp-price / p_itmigp-price_unit ). p_itmigp-price_unit = 1. ENDIF.

Program ‘LBBP_PDIGPF86’ (SRM 5.0 onwards) • Add following code using enhancement option

* check the unit of measure IF cs_new_itmigp-unit <> is_old_itmigp-unit OR p_method EQ c_check. PERFORM check_unit_of_measure USING cs_new_itmigp-unit is_icom-product is_icom-ordered_prod CHANGING lv_error_unit. ENDIF. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1 ) Form CHECK_SUSINV_GENERAL_CHECKS, End D *$*$-Start: (1 )--------------------------------------------------------------------------------$*$* ENHANCEMENT 2 ZZ_CUSTOMER_EXTENSION3. "active version DATA: ls_item type BBP_PDS_PO_ITEM_D. DATA: L_EXTITEMNO TYPE EBELP. DATA: l_BPUMZ type EPEIN. DATA: l_BPUMN type EPEIN. DATA: l_NETPR type WERT11V. DATA: l_PEINH type PEINH. CALL FUNCTION 'BBP_PD_SUSASN_ITEM_GETDETAIL' EXPORTING I_GUID = CS_NEW_ITMIGP-SRC_GUID

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 14

UOM – Limitation in SUS

IMPORTING E_ITEM = ls_item. check ls_item-BE_REFOBJ_TYPE = 'BUS2012'. L_EXTITEMNO = ls_item-BE_REFOBJ_ITEM+5(5). CALL FUNCTION 'Z_PO_GETDETAIL' DESTINATION IS_ICOM-BE_LOG_SYSTEM EXPORTING PURCHASEORDER = ls_item-BE_REFOBJ ITEMNUMBER = L_EXTITEMNO IMPORTING E_BPUMZ = l_BPUMZ E_BPUMN = l_BPUMN E_NETPR = l_NETPR E_PEINH = l_PEINH. if sy-subrc = 0. cs_new_itmigp-value = cs_new_itmigp-quantity * ( l_BPUMZ / l_BPUMN ) * ( l_NETPR / l_PEINH ). ENDIF. ENDENHANCEMENT. *$*$-End: (1 )--------------------------------------------------------------------------------$*$* ENDFORM. " check_susinv_general_checks

Make Field Control Settings for Tables (If using standard SUS UI)

Menu: SPRO-> SRM -> SUS -> Make field control settings for Tables

Make the following settings

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 15

UOM – Limitation in SUS

Add the following entries (ZZ_* fields)

Ignore the namespace warning message while saving.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 16

UOM – Limitation in SUS

Related Content https://forums.sdn.sap.com/thread.jspa?threadID=195616

http://help.sap.com/saphelp_sm32/helpdata/EN/52/16ace6543311d1891c0000e8322f96/content.htm

http://help.sap.com/saphelp_srm30/helpdata/en/c1/4e5c3c3906b106e10000000a11402f/content.htm

http://help.sap.com/saphelp_srm30/helpdata/en/d1/77623c44696069e10000000a11405a/content.htm

For more information, visit the Supplier Relationship Management homepage.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 17

UOM – Limitation in SUS

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 18