Professional Documents
Culture Documents
Cookbook For Dock Appointment Scheduling Integration With External Systems
Cookbook For Dock Appointment Scheduling Integration With External Systems
0 – July 2020
CUSTOMER
Applicable Releases:
Topic Area:
2
Figure 1 SAP API Business Hub: API Package for LBN Freight Collaboration option ............................... 6
Figure 2 Solution Architecture – LBN Integration with SAP TM and EWM via APIs .................................. 7
Figure 3 Create a New Enterprise Service Consumer ................................................................................ 8
Figure 4 Choose Service Generation Source ............................................................................................. 8
Figure 5 Generate Service Consumer by External WSDL - Local File ....................................................... 9
Figure 6 Generated Service Consumer by WSDL GenericAppointment_In ............................................. 10
Figure 7 SOAMANAGER: Consumer Proxy ZLBNCO_GENERIC_APPOINTMENT_IN ........................... 10
Figure 8 Create a New Consumer Proxy ................................................................................................... 11
Figure 9 Choose Service Provider ............................................................................................................ 12
Figure 10 Generate Service Consumer by external WSDL - Local File ...................................................... 13
Figure 11 Specify a Service Name .............................................................................................................. 14
Figure 12 Generated Service Consumer by WSDL GenericAppointment_In .............................................. 15
Figure 13 Create a New Enterprise Service Consumer ............................................................................... 16
Figure 14 Service Consumer generation by WSDL URL ............................................................................. 16
Figure 15 Service Consumer (Proxy) <prefix>CO_GENERIC_APPOINTMENT_CAN ............................... 17
Figure 16 SOAMANAGER: Consumer Proxy .............................................................................................. 17
Figure 17 Class Diagram for EWM - LBN-DAS Integration ......................................................................... 19
Figure 18 Mapping Table for Supply Chain Unit and (Docking) Location .................................................... 21
Figure 19 Type Adjustment to Generate Proxy Classes for GenericAppointmentCancellation_In ............. 21
Figure 20 EWM Monitor Customizing: Standard Monitor Nodes for TUs to Add LBN-DAS Extensions ..... 22
Figure 21 EWM Monitor Customizing: define node profiles for TU ............................................................ 23
Figure 22 Node Profile list structure /SCWM/S_WIP_SR_TU_HDR .......................................................... 23
Figure 23 Define Object Class Methods for Appointment Creation and Cancellation Request ................. 24
Figure 24 New Monitor Methods Inbound TU to Call LBN APIs GenericAppointment_In and
GenericAppointmentCancellation_In ............................................................................................................... 24
Figure 25 New Monitor Methods Outbound TU to Call LBN APIs GenericAppointment_In and
GenericAppointmentCancellation_In ............................................................................................................... 25
Figure 26 Transaction SRT_MONI showing outgoing and incoming SOA messages for
GenericAppointment_In | GenericAppointment_Out | GenericAppointmentCancellation_In .......................... 30
Figure 27 Updated Outbound TU after Appointment Confirmation (GenericAppointment_Out) ................. 30
3
HISTORY OF CHANGES
The following table provides an overview of the most important changes that have been made in the latest
versions.
4
GETTING STARTED
This cookbook provides the information on integration of dock appointment functionality available in SAP
Logistics Business Network (SAP LBN) with one of the following backend applications:
For this integration, SAP LBN offers APIs to perform the following:
This guide supports the following integration scenarios for SAP EWM and EWM on SAP S/4HANA:
This guide supports the following integration scenarios for SAP TM and TM on SAP S/4HANA:
• Receive an appointment confirmation from SAP LBN and store the data in the TM Freight Order (FO)
• Cancel a confirmed appointment
The creation or cancellation of an appointment request in SAP LBN based on a TM FO is already supported
in SAP TM standard (subcontracting process) and therefore not covered in this how-to-guide.
5
SOLUTION IMPLEMENTATION
To connect your TM on SAP S/4HANA or EWM on SAP S/4HANA with the dock appointment scheduling
functionality in SAP LBN, you must create an implementation in your S/4HANA system towards the
consumer and provider APIs.
The following SAP LBN dock appointment scheduling APIs are published in SAP API Business hub
https://api.sap.com/ in the API Package SAP Logistics Business Network, freight collaboration option:
In addition, the LBN API calls must be integrated in your EWM/TM solution.
Figure 1 SAP API Business Hub: API Package for LBN Freight Collaboration option
6
Figure 2 Solution Architecture – LBN Integration with SAP TM and EWM via APIs
The system calls the appointment request API, GenericAppointment_In in SAP LBN from EWM with an
outbound SOAP message. An event in EWM, such as a completion of planning of a TU, triggers the
message creation and sends it to the cloud solution.
7
1. Download the WSDL file from https://api.sap.com/api/GenericAppointment_In/overview and create the
service consumer in the backend system via transaction SPROXY.
8
3. Choose the Local File as the WSDL/Schema Source.
4. Specify a service name and namespace suffix. Adapt to your naming convention if needed.
5. Specify the package, transport, and so on. Finalize the service consumer creation.
9
6. Activate the new service consumer that also generated dynamic data types.
10
Consumer API for Appointment Change Notification (GenericAppointment_Out)
The system calls the appointment request API, GenericAppointment_In in SAP LBN from EWM with
an outbound SOAP message. An event in EWM, such as a completion of planning of a TU, triggers the
message creation and sends it to the cloud solution.
11
2. Choose the Kind of Service Provider as External WSDL/Schema.
12
3. Choose the Local File as the WSDL/Schema Source.
5. Specify a service name and namespace suffix. Adapt to your naming convention if needed.
13
Figure 11 Specify a Service Name
6. Specify the package, transport, and so on. Finalize the service consumer creation.
7. Once the service is created, change the ABAP type of the elements AppointmentStartDateTime
and AppointmentEndDateTime to STRING and activate the proxy.
14
Figure 12 Generated Service Consumer by WSDL GenericAppointment_In
When an EWM Transportation Unit (TU) is updated with an appointment ID from SAP LBN, the system
creates a dock appointment in SAP LBN for the reference document TU.
When a TU is deleted in EWM, to trigger the cancellation request for the dock appointment in SAP LBN, you
must call the appointment cancellation request API. To enable this, the system uses an outbound SOAP
message from EWM to SAP LBN CPI (GenericAppointmentCancellation_In).
15
1. Download the WSDL file from https://api.sap.com/api/GenericAppointmentCancellation_In/overview
and create the service consumer in the backend system via transaction SPROXY.
16
Figure 15 Service Consumer (Proxy) <prefix>CO_GENERIC_APPOINTMENT_CAN
Though you can already create dock appointments in SAP LBN with reference to the freight orders in SAP
TM, creating dock appointments based on documents from external systems such as SAP TM or SAP EWM
was not standardized. With the APIs in SAP API Business Hub for SAP Logistics Business Network, freight
collaboration option, this integration is possible.
Business Process
The system calls the provider API for a dock appointment request in SAP LBN (GenericAppointment_In)
from EWM using an outbound SOAP message. An event in EWM, such as planning completion of a TU,
triggers the message creation and sends it to the cloud solution.
The system enables this through a new status Ready for LBN Appointment Planning. When this new status
is set, the system triggers the appointment request API GenericAppointment_In with a PPF action. The
scheduling condition of PPF action checks the status of the TU whenever it is saved. When it finds the new
status, it triggers the message creation and send it to SAP LBN.
17
It may not be a good idea to trigger the appointment request already when the TU is created. As TU will not
have any deliveries, carrier, dates and other prerequisite data. Also, when the first delivery is assigned, this
does not mean that the volume of the TU may remain like this. Therefore, sending the
GenericAppointment_In SOA message at TU creation, for an incompletely planned TU, will lead to lots of
messages towards LBN, that would be possibly rejected, or, if not rejected, would trigger lots of unnecessary
updates and workload, not only in the LBN system.
In this guide the simple approach is described to issue the request for Dock Appointment creation in LBN-
DAS from within the EWM Warehouse Management Monitor (Transaction /SCWM/MON).
That is, the list structures of the monitor node profiles for the Transportation Unit in WMS Monitor are
enhanced by the additional LBN-DAS fields, and new methods are created to create and send the SOA
messages for LBN GenericAppointment_In and GenericAppointmentCancellation_In.
As SAP EWM comes with an on-premise dock appointment scheduling solution already and as the TU object
in SAP EWM already consists of the Appointment Number and Loading Point fields, you can reuse the
data model of SAP EWM dock appointment scheduling. Note that if these fields in the TU are updated from
the inbound SAP LBN dock appointment (via the EWM Adapter implementation), the TU becomes invalid
and the system raises error messages.
Therefore, we recommend that you create a custom append structure for the TU database table and create a
new custom database table to map the Docking Locations and Loading Points to the EWM warehouse
number and doors.
You must define the same Docking Locations and Loading Points in LBN as well. You can only use
carrier and shipper business partners with a valid LBN ID (identification type LBN001), that are already
onboarded in SAP LBN.
Automatic Implementation
The coding is available as ABAPGit ZIP file. You can directly import the changes using ABAPGit.
If you do not want to use ABAPGit, you can extract the ZIP file and create the development objects manually
as described below.
If you do not want to implement the full scope, you must adapt the ABAPGit -ZIP first and then remove the
irrelevant files. Please refer to the manual implementation section for more details.
18
Figure 17 Class Diagram for EWM - LBN-DAS Integration
The implementation to trigger the provider API GenericAppointment_In involves the following:
Manual Implementation
Create a package for the development objects and function groups for the maintenance table and monitor
function modules or use existing ones.
Transportation Unit header must be enhanced by the SAP LBN specific appointment data mentioned below,
which comes to S/4HANA system through the Application Logic – Appointment Confirmation
LBNGenericAppointment_Out API. The EWM Adapter updates these fields in the TU header.
Create a new domain ZLBN_DO_STATUS to display the Appointment Status Codes in SAP LBN:
19
• 06 Cancelled by Operator
• 07 Cancelled by Carrier
Create a data element ZEWM_DE_APPTID using the domain /SCMTMS/BTD_ID that is used in common with
the TM integration for appointment confirmation
This Include will be visible in DB tables /SCWM/TUNIT or in the monitor list structure for the TU
/SCWM/S_WIP_SR_TU_HDR.
4. In the technical settings, set the data class to APPL0 and the size 0 (or choose a different size
category if applicable).
Maintenance View:
2. Create a Maintenance View ZEWM_V_LBN_LOCAT for the table ZEWM_LBN_LOCAT as defined above.
20
Figure 18 Mapping Table for Supply Chain Unit and (Docking) Location
Create new function modules to call the generated proxy classes of the Service Consumers generated as
described in chapter Error! Reference source not found.:
1. Before creating the function module, create a function group ZLBN_APPT and create the function
module in this function group
2. Adjust the type of lo_proxy according to the proxy class that has been generated during service
consumer generation.
Application Logic - UI Integration for LBN API Calls in EWM Warehouse Management Monitor
(Transaction /SCWM/MON)
Automatic Implementation
The coding is available as ABAPGit ZIP file. You can directly import the changes using ABAPGit.
If you do not want to use ABAPGit, you can extract the ZIP file and create the development objects manually
as described below.
However, the configuration needed for adding the calls to the dock appointment scheduling API in SAP LBN
in the EWM monitor must be done manually, as described in the manual implementation.
21
Manual Implementation
Create a function group ZLBN_EWMMON for the monitor function modules or use an existing one.
Create new function modules for the monitor methods to trigger sending appointment request and
cancellation. Copy the code from the ABAPGit zip file:
• ZLBN_MON_SEND_APPTREQ
• ZLBN_MON_SEND_APPTCANCREQ
Enhancement of TU fields in the monitor list structures for the TU Node Profiles (Appointment ID, Statuses,
Docking Location/Loading Point)
Customizing:
1. Navigate to SCM Extended Warehouse Management > Extended Warehouse Management >
Monitoring > Warehouse Management Monitor > Customize Monitor Tree
Figure 20 EWM Monitor Customizing: Standard Monitor Nodes for TUs to Add LBN-DAS Extensions
2. Navigate to SCM Extended Warehouse Management > Extended Warehouse Management >
Monitoring > Warehouse Management Monitor > Define Nodes > Node Profiles:
22
SR000003 TU /SCWM/TT_WIP_SR_TU_HDR /SCWM/WIP_TU_HDR_OUT
Outbound
TU
SR000022 TU /SCWM/TT_WIP_SR_TU_HDR /SCWM/WIP_TU_HDR_IN
Inbound TU
If you enhance the DB Table /SCWM/TUNIT using the EEW include /SCWM/INCL_EEW_TU_HDR, the
new fields will appear by standard in the monitor node profile list structure and you can use the
standard node profiles. Do not use the fields of EWM DAS.
Otherwise, you must create your own Z-node profiles and customize accordingly.
23
Request Object Class Method Method Function Module
Type
3. Navigate to SCM Extended Warehouse Management > Extended Warehouse Management >
Monitoring > Warehouse Management Monitor > Define Object Class Methods
Figure 23 Define Object Class Methods for Appointment Creation and Cancellation Request
Figure 24 New Monitor Methods Inbound TU to Call LBN APIs GenericAppointment_In and
GenericAppointmentCancellation_In
24
Figure 25 New Monitor Methods Outbound TU to Call LBN APIs GenericAppointment_In and
GenericAppointmentCancellation_In
General Information
The application logic for appointment confirmation is divided into two parts: application-agnostic and
application-specific.
The application-agnostic part receives the data from the message and determines the adapters known as
posting adapters. The posting adapters are responsible for posing the data to the corresponding application
objects.
• Generic DB Adapter
The generic DB adapter writes the appointment information from SAP LBN into a generic database
table. This table is used during TU creation on the EWM side to lookup the existing appointments
posted against the TM freight order (not covered in this cookbook).
• TM Adapter
The TM adapter writes the appointment information to the corresponding freight order. With the
provided implementation, the system updates the following data:
• EWM Adapter
The EWM adapter posts the appointment information to the corresponding EWM reference document.
The system updates the TU with the provided implementation, the appointment start and end date, as
well as the license plate number, country and driver information is updated.
25
As the TU object – by EWM standard - does not contain the fields to store LBN – DAS appointment
data, the TU header must be enhanced by those fields. This is described in chapter Application Logic
– Appointment Request / Cancellation.
In case of an error, each adapter returns an error code defining if the error is only temporary or not.
For temporary errors, the application-agnostic logic triggers an asynchronous processing of the posting-
adapter logic via bgRFC.
Prerequisites
To set an inbound destination in bgRFC, you must have setup bgRFC already.
Steps
26
Automatic Implementation
The coding is available as ABAPGit ZIP file. You can directly import the changes using ABAPGit.
If you do not want to use ABAPGit, you can extract the ZIP file and create the development objects manually
as described below.
If you do not want to implement the full scope, you must adapt the ABAPGit -ZIP first and then remove the
irrelevant files. Please refer to the manual implementation section for more details.
Manual Implementation
27
DDIC Elements – Table Types
Create a table type ZLBN_T_APPT_DOC with the line type ZLBN_S_APPT_DOC and unique, sorted primary
key and the following key attributes:
• APPT_ID
• DOC_ID
• DOC_TCO
4. In the technical settings, set the data class to APPL1 and the size 6 (or choose a different size
category if applicable).
8. In the technical settings, set the data class to APPL1 and the size 6 (or choose a different size
category if applicable).
ABAP Coding
For the manual approach, create the development objects according to the table below, switch to source
code editing mode and copy and paste the content of the corresponding file.
28
Class ZCL_LBN_APPT_POST_ <NAME>.CLAS.ABA O Only needed, if appointment
DB P information should be stored
generically in DB.
1. Before creating the function module, create a function group ZLBN_APPT and create the function
module in this function group.
29
Adapt the Inbound Agent Implementation
Open the implementing class of your service provider of the GenericAppointment_Out service and add
the following coding:
Note
If the type of the input parameter does not match the required type of the method post_soap_adapter,
you must update the signature of the method accordingly.
Setup Integration
Setup the integration with SAP LBN similar to the other integrated LBN services.
End to End process: EWM Appointment Request - Call of EWM Adapter for Appointment
Confirmation - Update Transportation Unit with LBN Appointment - EWM Appointment Cancellation
Request
Figure 26 Transaction SRT_MONI showing outgoing and incoming SOA messages for GenericAppointment_In |
GenericAppointment_Out | GenericAppointmentCancellation_In
30
www.sap.com/contactsap
The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable
for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality
mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are
all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation
to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are
cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other
countries. All other product and service names mentioned are the trademarks of their respective companies. See www.sap.com/copyright for additional trademark information and notices.