Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
poulamidas
Explorer
6,299
Introduction

SAP TM or Transport Management System is used to optimize logistics by managing all aspects of Transportation processes within a company. Not only it streamlines the logistics businesses by improving efficiency, but it also helps in reducing cost of business. One of the key aspects of implementing SAP TM is its integration with ECC system. In many cases, data is replicated using Service Interfaces. It is also quite common that customized structures or attributes need to be replicated from SAP TM to ECC.

Accommodate the custom attributes, the webservice need to be enhanced. This enhancement can be done with or without involving PI as a middleware.

In this blogpost, I have shared the solution to enhance webservices via Point-to-Point connection using SOAMANAGER technology. Using Backend Metadata Repository, the enhancement can be achieved.

 

Requirement

Shipments can be created in ECC from Freight Order in SAP TM. The shipment created in ECC does not have the vehicle type. Therefore, we will enhance the webservice to send the Vehicle Type through a custom attribute from TM to ECC.

 

Prerequisites

  • Access to SAP TCodes like SPROXY, SRT_MONI, SPXNGENAPPL

  • Knowledge of SAP ABAP, BOPF coding.


 

Solution  

Step 1: Create Custom Namespace in TM System

 

Go to TCode SPXNGENAPPL to create the custom namespace under which the enhancement will be created.

Create an entry for the custom namespace (Format: http://CompanyName/xi/RelevantName). Choose the option Backend Metadata Repository from the dropdown from the right column.

Save the entry. It does not get captured in TR. We must create the entry manual in higher environments.

To easy identification, use the namespace of the Standard Webservice and append some meaningful name at the end separated by ‘/.’ The custom namespace name is critical. X`


The same namespace will be present under namespaces in SPROXY, and the enhanced nodes and structures will be saved there.

 

Step 2: Enhance Standard Webservice in TM System

  1. Locate the Webservice.


 

Now go to TCode SPROXY. Find the Service to be enhanced. Double click on it. The Service Consumer details will display on the right. Go to Internal View Tab.


 

We will use the following webservices in TM and in ECC, respectively.

TM: TransportationOrderSCMExecutionRequest_Out (Service Consumer)

ECC: TransportationOrderSCMExecutionRequest_In (Service Provider)

 

  1. Find the Node to be Enhanced


 

Here, we will be enhancing the node TRANSPORTATION_ORDER_EXECUTION and adding custom attributes to it.


 

Click on the node TRANSPORTATION_ORDER_EXECUTION and once the window on the appears, double click on the ABAP Name (Here, /SCMTMS/CPX_TOR_SCMEXR_TOREXE) under Global Data Type with Elements.

 

The node structure will open. Go to Proxy Editor.


 

Click on Create Enhancement to create Data Type Structure. A wizard will appear.


 

Provide Enhancement Name as per the naming conventions followed by the organisation. In the namespace, provide the namespace name you have maintained earlier for the MDR. Next, click on Continue button at the bottom.


In the next step, maintain Package, Transport Request No and Prefix name. The prefix is for internal attributes. If TR number is not known, check Local Button.


Click on Continue and Finish. Once done, click on SAVE button to save the changes.

Now go to External View to add custom attributes to the structure environment. You can add individual attributes, or you can add a custom data type to the enhancement.


To add an attribute or element, right click on the Enhancement Name and choose attribute or element.


 

If you want to add a custom data type, choose Add Element, and provide appropriate name starting with YY or ZZ.


 

Now, right click on the Element Name and choose Set Global Type Reference to create custom reference for the datatype.


 


 

Here you can create your own reference or use existing ones. Creating reference will open a wizard like the previous one. Once you have created the reference, add maximum length and type to the elements.

After creation of custom fields, save and activate the changes.

 

Step 3: Add Custom Code for Custom Attributes in ECC

 We need to add our own custom code to perform data mapping for the custom attributes. This will allow the system to send the data from the system to the XML message.

 

BADI in TM System: /SCMTMS/TOR_SE_SHPMNT_REQ

Interface: /SCMTMS/TOR_IF_SE_SHPMNT_REQ

 Create BADI Implementation and add your code to complete the mappings of the attribute.

The data present in the OUT structure is finally send to the XML message. Therefore, the data manipulation or data population of the custom attributes should be done in the OUT structure.

 

In TM system, every document acts like an Object. Therefore, BOPF coding might be required the required value.


 

After replication, the XML message can be checked in SRT_MONI TCode to display XML messages. You can check whether the XML message has been successfully processed in the system. This is visible both in Source and Target System.


 

Step 4: Create Custom Namespace in ECC System

Repeat Step 1 in ECC system as well. Be extra careful to maintain the exact Namespace name as it was maintained in TM system.

 

This is crucial as identical mappings and names in source and target will ensure that XML is mapped properly, and data is flowing between the system successfully.

 

 

Step 5: Enhance Standard Webservice in ECC

Webservice Name in ECC: TransportationOrderSCMExecutionRequest_In (Service Provider)

Follow the same steps as they were in step 2. Keep the names in every step identical in both source and Target system. So, the enhancement name, structure name, attribute name as well as the data types should be identical in both systems.

 

And most importantly, the Custom Namespace (MDR) name should be identical, even upper case and lower case.

 

Step 5: Add Custom Code for Custom Attributes in ECC

 

Like the Source system, the custom attributes need to be mapped to the correct fields in the Target system for further usage.

 

BADI in ECC is:  TRA_SE_TO_SHPMNT_RQ_IN

Interface: IF_TRA_SE_TO_SHPMNT_RQ_IN

 

Here, the incoming data from the XML message will be stored in the IN structure. The data received from TM system can be stored in Standard Table as well Custom table to be used later.

 

 

Conclusion

 

In this blog post, we have enhanced a standard webservice by addition of custom attributes without involving PI system. This Point-to-Point communication system can be used in multiple scenarios without involving any middleware or third parties. It is synchronous and efficient and highly effective.

 
4 Comments
Labels in this area