Acorel
Gratis demo

C4C: Extending Pre-Packaged integration content with Standard field: A Simple Workaround

Amber Badam, 21 oktober 2015
We could use Key User Tool ( KUT) or  SDK (PDI) to create Extension fields and add them to the existing Web service and eventually use them for integrations inbound and outbound.
What if we want to add a standard field, which is available on a screen/BO and not available in the standard Webservice?
I came across a scenario, where we wanted to have Standard field “Territory” visible on the Customer Header pane to be available in ECC in order to determine the Sales Office of the Customer. However, this field “Territory” was not available in the outbound Webservice used to replicate customers to SAP Business Suite “Replicate Business Partners to SAP ERP”.
In Order to realize this field in Outbound Web Services, we created an Extension Field “ExtTerritory”and passed the value of Standard Field “Territory” to it based on an Event in the SDK. Subsequently, adjusted the updated WSDL in ESB and mapped the value of new field “ExtTerritory” to a custom field in IDOC DEBMAS06.
This document details the simple work around we have done to accomplish this requirement using SDK.

Step 1: Create an extension field “ExtTerriotry” either via the KUT or SDK on the Business Object Customer.

To create using SDK, Create a New solution and add new item “Business Object Extension”. In this case the object that’s needs to be extended is “Customer”.

Create an Element “ExtTerritory ” in desired node of the Extension Object as shown below and activate the Extension.
 
To create an extension field via KUT follow the how-to-guide(all steps as described in section 4.1.1) and then go to step 5.
Step 2: Script the logic in an “Event” on the BO to move the value from Standard field to Extension Field.
Right click on the BO Extension to add Create Script files. Choose  “Event: Before Save” and code the logic and activate it.
The logic below fetches value Territory ID that is ideally part of Business Object “SalesTerritory”. Note that we cannot use associations to other BO in Extensions.  However, we could query on other BO’s to fetch the desired values.

Step 3. Include the Extension field “ExtTerritory” in the desired Templates/Web Services using the Process Extension Scenario.
Right click on the solution to add new item and select Process Extension Scenario.

Select the Scenario “Business Partner Replication” and Save the PES.
Step 4: Add the Scenario “ProcessExtensionScenario1” created above in the above step to the extension fields defined in the Extension object. Save and activate.

Step 5: (Required only for fields created using KUT).   Create Reference to Extension fields to access them in the BO Extension.
To do this, Right click on the Solution and add new item and then SAP => Extension => References to Customer Specific Fields.

Click on the  .ref object created to see the Extension field created using KUT. Select the field followed by SAVE and Activate. 
Once done, the Extension field is available in your Extension Object and you could use it in an EVENT –Script file to populate the value from the standard field to the Extension field.
Result: The field “ExtTerritory” is available in WSDL of the service “Business Partner Replication” which will have the same value as in standard field “Territory”
Outbound Message BusinessPartnerReplication now contains the value of standard field “Territory”. This is filled just before SAVE happens on the customer.

Eventually, download the Updated WSDL from Communication Arrangement and use it in the ESB. Map the new field “ExtTerritory” to a custom field in the IDOC.
Furthermore, you could implement a standard BADI before the Inbound IDOC is created, to adjust the value of the Sales Office in ECC.

Receive our weekly blog by email?
Subscribe here:

More blogs