Contract Assignment for SC created by external requirement and having hierarchy items .
Section 1.1:Overview & Purpose of Document : We create a Purchase Requisition with an outline having service hierarchy it goes to the sourcing application where we can assign the Supplier . However the standard behavior says as below
“In SAP SRM 7.0, if the item you want to source is a hierarchical service that originates from the SAP ERP system (MM-SRV), the system automatically creates a back-end contract. As of enhancement package 1 for SAP SRM 7.0, if you have activated the business function SRM, Service Procurement Innovations (SRM_SERVICE_PROC_1) and the Customizing switch Central Contract Management (SRM_701_SERV_PROC_CCM), a central contract is created by default in SAP SRM. In the central contract, the strategic purchaser can define to which back-end system or systems the contract is replicated. This means a contract is created in a back-end system with reference to the central contract in SAP SRM”[Ref1]
However the client requirement was it should use an existing source of Supply and a central contract which is already created should be assigned to the line item and not to create a contract in an attempt to assign .
Example: We create a SC with line items seen as hierarchy .
001 Outline level Hierarchy
002 Line items 3000012
003 Line item 3000013
In this case for the services there is already an existing contract in SRM which is not defined in backend so it was picking up the choices and giving in Source of Supply tab . Remember incase of hierarchy you can only assign to the outline level and not to each line item as you wont get the source of Supply tab for each line item but only for the outline level .
Now as seen in figure I we see the below list of contracts having materials as follows .
7000001251 : 3000012
7000001268 : 3000012 , 3000013
7000001238 : 3000000 , 3000012 , 3000013
SC line items : 3000012 , 3000013
NOTE : ** Is it correct that Contract marked in red be displayed in Source of Supply tab ? We can only assign contracts at header level and since if it doesn’t contain all line items why should it be applied ?
When a contract is proposed as a SoS in service procurement scenario, the price of the outline will be shown for all items. This is because, price determination for individual services from the contract is not done in Sourcing application[Ref2]
Now we try to assign the contract shown in the SOS tab by clicking on Assign Supplier and get the error
Line 1.2: Product ” deviates from product ‘0000000000000000000000000000000003000012’ in corresponding contract item
Reason : Because the nature of the contract has to be same as SC item[Ref2 ] which is hierarchy and it is trying to match the line item hierarchy and contract and getting the error . And if you debug you would realize that it is assigning the first level item to the hierarchy item and the reason why it gets an error since there becomes a line mismatch .
Section 1.2 :Issue Faced : Hence there are 2 issues with the existing functionality .
Issue 1 : Contracts not covering all line items are also shown . why should the contract 7000001251 be displayed since it only pertains to one item and if we assign the same it would not help as only one item would be included in contract .
Issue 2 : Contracts created in SRM are not been able to assign to hierarchy line items . Also rem we cannot create hierarchy type of contracts in SRM hence there is no way where we can match the TYPE of contract and SC line item incase hierarchy . It gives the Error message 179 Class bbp_pd in SRM .
Suggested Solution : We will make changes at 2 places :
CHANGE 1 : Source of Supply Tab to display only those Contracts which match and have all line items as that of SC .
CHANGE 2 : To assign the correct line item of contract to outline Line item .
SECTION 2.1 [CHANGE 1] : Go to the BADI BBP_SOS_BADI and to the method METHOD if_ex_bbp_sos_badi~bbp_sos_check.
Note : This method is called when you click on SOS Tab of the SC the first time and it will get the list of contracts based on the code here . Thus we make the changes incase of services hierarchy items it should run and should fetch only those contracts which have all items of SC . Also remember this would be done when the Approver is a SRM user with a Sourcing role . This wont run for Requestor since the requestor cannot create a Hierarchy item in SRM .
IF ct_found_contract IS NOT INITIAL ” If contarcts exists for the vendor material combination then go ahead
AND sy–uname <> ls_tvarvc–low.
“When User is not DE1 Remote to ensure it is run only when the user is approving and not creating a SC in which case it would be system user .
CALL FUNCTION ‘BBP_PD_SC_ITEM_GETDETAIL’
i_guid = is_search_criteria–pos_id
e_item = ls_sc_item. ” Getting a list of all SC items .
IF ls_sc_item IS NOT INITIAL AND
ls_sc_item–product_type = c_service. ” Only to be run incase of services .
CALL FUNCTION ‘BBP_PD_SC_GETDETAIL’ “ To get SC item details
i_guid = ls_sc_item–header
e_header = ls_sc_header
e_item = li_sc_item.
IF ls_sc_header–subtype = c_er.
DELETE li_sc_item WHERE parent NE ls_sc_item–parent .
IF li_sc_item IS NOT INITIAL.
LOOP AT ct_found_contract INTO ls_found_contract.
Ref 1 http://help.sap.com/saphelp_srm701/helpdata/en/ba/c346a35c2e4aa78bfeb99f60a40266/frameset.htm
Ref 2 : http://www.stechno.net/sap-notes.html?view=sapnote&id=1476447