You are on page 1of 74

openSAP Modernize Integration with SAP

Integration Suite

Exercise
PUBLIC
EXERCISE: CLOUD INTEGRATION

Guidelines

The openSAP courses are very popular, and we welcome thousands of participants. The exercise described
in this document will be performed by hundreds of participants in parallel, using production tenants with
shared resources in a shared SAP Business Technology Platform (BTP) account. This means a few simple
things:

1. Use the tenant that we provide only for this exercise, and not for anything else. For further exploration
of Cloud Integration, use a free BTP trial account or a Free Tier tenant.

2. Do not share any private or personal information such as your name, email address or affiliation.

3. Please strictly follow the instructions, regarding the naming conventions you will use to name the
artifacts you will create. This ensures that you will be able to successfully complete the tasks,
without clashing with other participants.

4. Other artifacts, created by other participants, will appear in your shared account. Do not access or
delete these artifacts. Please respect the rules and allow others to have the same learnings as
you.

5. Do not delete the Solution package from the tenant.

We have done everything to make this experience enjoyable. Your openSAP tenants were pre-configured by
a competent technical BTP administrator, Cloud Integration capability is already provisioned, and you
already have all the roles and definitions you need to complete this exercise.

Preparation

This exercise is intended to guide you through the step-by-step execution of the latest enhancements that
are offered as part of the Cloud Integration capability of SAP Integration Suite. Please follow the below steps
to make sure you have the right tenants and the details to execute the exercise.

1. The SAP Integration Suite tenant URL can be obtained from the system preparation document after
enabling your SAP Integration Suite tenant using the tenant booking application.

2. Copy and paste the Process Integration Client ID and Process Integration Client Secret obtained
from the tenant booking app and keep it handy in a notepad. We would need this to run the scenario.

2
Scenario Overview

In this sample scenario we like to replicate Product with associated entities i.e. Category and Supplier from
a WebShop Application to a Northwind Application using OData V2 APIs with asynchronous
decoupling and guaranteed delivery using internal message queues and JMS (Java Messaging Service)
adapter.

We also want to ensure idempotency, meaning that no duplicate products, categories, or suppliers should
be replicated in the target Northwind application. Let's break down the scenario for better understanding.

Components Involved:

1. WebShop Application: The source application where product data resides, including categories and
suppliers. We trigger the product replication using any external REST client by just sending the
Product Id and then the interface fetches the Product details along with Supplier and Category via
exposed OData V2 API.

2. Northwind Application: The target application where you like to replicate the data. It follows the
Northwind database schema and only provide OData V2 APIs without any user interface.

3. OData V2 APIs: Both the WebShop and Northwind applications expose OData V2 APIs for data
exchange.

4. Asynchronous Messaging with JMS: Instead of directly sending data to the Northwind Application,
we publish the data to a JMS queue for asynchronous processing and guaranteed delivery.

This decouples the replication process, ensuring that data is reliably delivered even if the Northwind
Application is temporarily unavailable.

5. Check for Idempotency: Before replicating any data, we also check whether it is already replicated in
the Northwind Application using an Idempotent Process Call to prevent duplication.

For each product, category, and supplier, we check whether a corresponding record with the same
unique identifier i.e., Product ID, Category Name, and Supplier ID is already replicated in the
Northwind Application or not.

6. Data Transformation Logic: Message Mapping artifacts are already created and deployed to map
the data structure for Product, Category, and Supplier from the WebShop application to match the
Northwind database schema.

7. Scripting Logic: Reusable groovy scripts are already created and deployed that provide some utilities
for Message Processing Logs (MPL), like writing payload attachments and custom headers with
business context i.e., Product ID.

8. Completion and Monitoring: Monitor the data replication process to ensure it completes
successfully.

Cloud Integration now provides a feature where users can consume reusable artifacts such as Message
Mapping and Script Collection Artifacts across different packages. This brings a better reusability experience
for our customers and the same is also demonstrated in this exercise.

As mentioned above, the message mapping and script collection artifacts are already created as part of the
solution package and deployed on the tenant, and we just consume the same during this exercise instead of
creating it again from scratch.

3
Note:
We have also provided the solution package in the tenant and available as part of additional material as
well that you can refer to if you run into errors.

In case you like to consume and run the integration flows without creating on your own as depicted in the
following steps, kindly check the solution documentation.

4
Task 1: Create Integration Flow to replicate Products from WebShop to JMS Queue

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Explanation Screenshot

Step 1. Open the “Tenant URL for


SAP integration Suite” from the
tenant booker application as
described in the Preparation phase
above.

Step 2. Navigate to “Design” ->


“Integrations” to create a new
Integration package for this
exercise.

Step 3. Press the “Create” button


to create your own Package.

5
Explanation Screenshot
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 4. Provide the following


properties:

Name:
openSAP_btp3_Week4_Exercise_###

Short Description:
In this exercise, we replicate
Product along with Category and
Supplier from WebShop to
Northwind application using OData
V2 test service.We'll cover Async
decoupling via JMS, Idempotent
Process Calls, Message Mapping
and Script Collection Artifacts, etc.

Version: 1.0.0

Press “Save”

Step 5. Switch to “Artifacts” tab,


then click “Add” -> “Integration
Flow”

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 6. Provide the following


properties:

Name:
WebShopToJMS_ProductReplicati
on_###

Short Description:
Product Replication from WebShop
to Northwind application by writing
it to JMS for Async Decoupling

Press “OK”

6
Explanation Screenshot

Step 7. Click on the Integration


Flow that you just created.

Step 8. Press “Edit” button to


switch to the edit mode.

Step 9. Double click on the


“Sender” participant or press the
“Restore” button on the bottom
right to expand the details menu.

Step 10. Rename “Sender” to


WebShop

7
Explanation Screenshot

Step 11. Press and drag the


“Connector” button to connect the
“WebShop” sender with the “Start”
step.

Step 12. Select “HTTPS” as


sender adapter

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 13. Switch to the


“Connection” tab of the HTTPS
Adapter in the Details section and
provide following properties:

Address: /###/products

CSRF Protected: Uncheck (False)

8
Explanation Screenshot
Step 14. In order to open the
general Integration Flow
settings, click on a white space in
the IFlow Diagram as shown in the
screenshot.

Change to “References” tab and


navigate to “Global” tab.

Click “Add References” -> “Script


Collection” to create a new Script
Collection Reference.

Step 15. Select Package


“openSAP_btp3_Week_4_Exerci
se_Solution”.

Note: Script Collection and Message


Mapping artifacts that are required for this
exercise is already created and deployed as
part of the Solution package and with this
step we just referencing the same without
the need of creating it again and again for
each participant.

Step 16. Select “SC MPL_Utils”


and press “OK”. Now you have
successfully added a Global Script
Collection as reference in your
integration flow.

Note: This Script Collection artifact contains


the following two groovy scripts:
1. MPLAttachment: to add the
payload attachment in the
message processing log (MPL)
2. MPLCustomHeader: to add the
custom header properties to store
business or payload related
information in the message
processing log (MPL)

Step 17. Select the “Start” step


and press the “+” button to create a
new flow step.

9
Explanation Screenshot

Step 18. Select “Groovy Script”


step.

Step 19. Rename the step to:


Log Request Payload

Step 20. Switch to “Processing”


tab and press the “Select” button
under Script File.

10
Explanation Screenshot

Step 21. Switch to “Referenced


Resources” and select
“MPLAttachment”.

Press “OK”.

Step 22. For Script Function enter:


logRequestPayload

Step 23. Select the “Log Request


Payload” Step and press the “+”
button to add a new flow step.

Step 24. Select “Content


Modifier” step.

11
Explanation Screenshot

Step 25. Rename the Step to:


Set Properties

Step 26. Switch to tab “Exchange


Property” and press the “Add”
button four times to create four
new entries:

Hint: Make sure to keep same order of


properties and copy values correctly as
properties are case sensitive.

Step 27. Provide the following


properties:
Entry 1
Name: Id
Source Type: XPath
Source Value: /Product/Id/text()
Data Type: java.lang.String
Entry 2
Name: ProductId
Source Type: XPath
Source Value:
/Product/ProductId/text()
Data Type: java.lang.String
Entry 3
Name: CustomHeaderName
Source Type: Constant
Source Value: Product ID
Entry 4
Name: CustomHeaderValue
Source Type: Property
Source Value: ProductId

12
Explanation Screenshot

Step 28. Before you add a new


flowstep, save the work and widen
the integration process to make
some space.
Select the “Set Properties” Step
and press the “+” button to add a
new flow step.

Step 29. Select “Groovy Script”


flow step again to add the Product
ID as custom header property.

Step 30. Rename the step to:


Set MPL Custom Header

Step 31. Switch to “Processing”


tab and press the “Select” button
under Script File.

Step 32. Switch to “Referenced


Resources” and select
“MPLCustomHeader”.

Press “OK”.

Note: This helps you to search the


message processing log (MPL) using
business contextual values like the Product
ID in this case.

13
Explanation Screenshot

Step 33. Leave the script function


empty as the default
“processData” function will be
called if no value provided.

Step 34. Select the “Set MPL


Custom Header” Step and press
the “+” button to add a new flow
step.

Step 35. Search for “send” and


choose the “Send” Step under
“External Call”.

Step 36. Rename the step to:


Send to JMS

14
Explanation Screenshot

Step 37. Place the “Receiver”


participant above the previous step
and rename it to: JMS

Step 38. Select the “Send to JMS”


Step. Press and drag the “arrow”
button and connect it to the “JMS”
Receiver.

Step 39. Select “JMS” as receiver


adapter.

15
Explanation Screenshot
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 40. Select the “JMS”


connected line and switch to
“Processing” tab and provide the
following details:

Queue Name:
webshop_products_###

Transfer Exchange Properties:


Check (True)

Step 41. Select the “Send to JMS”


flow step and press the “+” button
to add a new flow step.

Step 42. Select “Content


Modifier” step.

Step 43. Rename it to:


Set Response Code and Body

Step 44. Switch to “Message


Header” tab.
Press “Add” to add a new header
and provide the following details:

Name: CamelHttpResponseCode
Source Type: Constant
Source Value: 202

16
Explanation Screenshot

Step 45. Switch to “Message


Body” tab and provide the
following details:

Type: Constant
Body: Accepted

Step 46. Your final integration flow


should look like as the given
screenshot.

Step 47. Click “Save as Version”


button on top right of the window.

Step 48. Provide the following


properties:

Version: 1.0.0
Comment: initial version

Press “OK”

Step 49. Press “Deploy” and


confirm the dialog with “Yes” to
deploy your integration flow.

17
Task 2: Create Integration Flow to replicate Products to Northwind application using JMS Queue

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Step 1. Navigate to “Design” ->


“Integrations” to create a new
Integration flow for this exercise.

Step 2. Navigate to the integration


package
“openSAP_btp3_Week4_Exercis
e_xxx” that you created in Task 1
above.

Step 3. In case, edit mode is not


active, press the “Edit” button.

18
Step 4. Navigate to “Artifacts” tab
and Press “Add” -> “Integration
Flow”

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 5. Provide following details:

Name: JMS_to_Northwind
ProductReplication_###
Description: Product Replication
from WebShop to Northwind
application by reading it from
JMS for Async Decoupling

Press “OK”

Step 6. Open the Integration Flow


you just created by clicking on it.

19
Step 7. Press “Edit” button to
switch to the edit mode.

Step 8. Double click on the


“Sender” participant or press the
“Restore” button on the bottom
right to expand the details menu.

Step 9. Rename “Sender”


participant to JMS

Step 10. Press and drag the


“Connector” button to connect the
“JMS” sender to the “Start” step.

20
Step 11. Select “JMS” sender
adapter.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 12. Select the “JMS”


connected line and switch to the
“Connection” tab and provide the
following details:

Queue Name:
webshop_products_###

Note: This queue name should match with


the name that you had provided in the
previous integration flow as described in
Task 1)

Step 13. In order to open the


general Integration Flow
settings, click on a white space in
the IFlow Diagram as shown in the
screenshot.

Change to “References” tab and


navigate to “Global” tab.

Click “Add References” -> “Script


Collection” to create a new Script
Collection Reference.

21
Step 14. Select Package
“openSAP_btp3_Week_4_Exerci
se_Solution”.

Note: Script Collection and Message


Mapping artifacts that are required for this
exercise is already created and deployed as
part of the Solution package and with this
step we just referencing the same without
the need of creating it again and again for
each participant.

Step 15. Select “SC MPL_Utils”


and press “OK”.
Now you have successfully added
a Global Script Collection as
reference in your integration flow.

Note: This Script Collection artifact contains


the following two groovy scripts:
1. MPLAttachment: to add the
payload attachment in the
message processing log (MPL)
2. MPLCustomHeader: to add the
custom header properties to store
business or payload related
information in the message
processing log (MPL)

Step 16. Select the “Start” step


and press the “+” button to create a
new flow step.

22
Step 17. Select “Groovy Script”
step.

Step 18. Rename the step to:


Set MPL Custom Header

Step 19. Switch to “Processing”


tab and press the “Select” button
under Script File.

23
Step 20. Switch to “Referenced
Resources” and select
“MPLCustomHeader”.

Press “OK”.
Again, leave the script function
empty as the default
“processData” function will be
called if no value provided.

Note: As we have transferred exchange


properties to JMS in the previous integration
flow as depicted in Task 1, this means that
the properties would be available here and
we do not need to set it again.

This helps you to search the message


processing log (MPL) using business
contextual values like the Product ID in this
case.

Step 21. Click on the “process”


icon on tool palette and select
“Local Integration Process” to
add a new local process. Place it
underneath the existing integration
process.

Step 22. Rename it to


Replicate Product, Category and
Supplier to Northwind

24
Step 23. Switch back to the
“Integration Process”, select the
“Set MPL Custom Header” step
and press the “+” button to create a
new flow step.

Step 24. Search for “idempotent”


and select “Idempotent Process
Call” step under “Local Call”

Note: The Idempotent Process Call detects


if a message ID has already been
successfully processed and stores the
status of the successful process in
the idempotent repository. If there is
duplicate execution with the same message
ID (for example if there’s a retry by the
sender system), the called subprocess can
either be skipped or the message is marked
as a duplicate. You can then decide how to
handle the duplicate in the subprocess.

Step 25. Rename it to Idempotent


Product Replication

Switch to “Processing” tab and


provide the following details:

Local Integration Process: Select


“Replicate Product, Category
and Supplier to Northwind”

Message ID: ${property.ProductId}

Skip Process Call for Duplicates:


Uncheck (False)

25
Step 26. Go to your Idempotent
Process “Replicate Product,
Category and Supplier to
Northwind” and widen the object
to allow space for more steps.

Select “Start 1” and press the “+”


button to add a new step.

Step 27. Select “Content


Modifier” step.

Step 28. Rename the step to:


Set Properties

Step 29. Switch to “Exchange


Property” tab and press the “Add”
button twice to create two new
entries and provide the following
details:
Entry 1
Name: CustomHeaderName
Source Type: Constant
Source Value: Is Product
Duplicate

Entry 2:
Name: CustomHeaderValue
Source Type: Property
Source Value:
CamelDuplicateMessage

26
Note: This custom header helps us to filter
the message processing logs where the
product id is duplicate
CamelDuplicateMessage property is
provided by the platform

Step 30. Select the “Set


Properties” Step and press the “+”
button to add a new flow step.

Step 31. Select “Groovy Script”


step.

Step 32. Rename the Step to:


Set MPL Custom Header

27
Step 33. Switch to “Processing”
tab and press “Select

Step 34. Switch to “Referenced


Resources” and choose
“MPLCustomHeader”.

Press “OK”

Step 35. Select the “Set MPL


Custom Header” step and press
the “+” button to create a new flow
step.

Step 36. Search for “Router” and


choose “Router” under “Routing”

28
Step 37. Rename the step to:
Check duplicate

Step 38. Add a new “End Event”


and place it under the router.

Step 39. Select the “Check


duplicate” router, press and drag
the “arrow” button and connect it
to your “End” event

29
Step 40. Rename the Route to:
Duplicate

Hint: Make sure that Condition ends with a


single quote: ‘

Step 41. Switch to “Processing”


tab and provide the following
details:

Expression Type: Non-XML


Condition:
${property.CamelDuplicateMessag
e} = 'true'

Step 42. Select “Route 1” and


rename it to: New

Step 43. Switch to “Processing”


tab and check “Default Route”

30
Step 44. Select the “Check
duplicate” router step and press
the “+” button to add a new flow
step.

Step 45. Search for “Request” and


choose “Request Reply” under
“Call”.

31
Step 46. Rename the step to:
Get Product Details

Step 47. Select the “Receiver”


participant and rename it
to: WebShop

Place it underneath the Local


Process.

Step 48. Select the Request Reply


step “Get Product Details”, press
and drag the “arrow” button and
connect it to the “WebShop”
Receiver.

32
Step 49. Select “OData” as
receiver adapter and protocol as
“OData V2”

Step 50. Switch to “Connection”


tab and provide the following
details:

Address: https://refapp-espm-ui-
cf.cfapps.eu10.hana.ondemand.co
m/espm-cloud-web/espm.svc

Authentication: None

CSRF Protected: Uncheck (False)

Step 51. Switch to “Processing”


tab and provide the following
details:

Operation Details: Query (GET)


Resource Path: Products
Query Options:
$select=ProductId,Name,ShortDes
cription,Price,CategoryName,Suppl
ierId,Supplier/SupplierId,Supplier/C
ity,Supplier/Country,Supplier/Email
Address,Supplier/HouseNumber,S
upplier/PhoneNumber,Supplier/Pos
talCode,Supplier/Street,Supplier/S
upplierName&$expand=Supplier&$
filter=ProductId eq
'${property.ProductId}'

33
Step 52. Select the “Get Product
Details” step and press the “+”
button to create a new flow step.

Step 53. Search for “Groovy” and


select “Groovy Script” under
“Transformation”.

Step 54. Rename the step to:


Log Product Details

Step 55. Switch to “Processing”


tab and press “Select”

34
Step 56. Switch to “Referenced
Resources” and select
“MPLAttachment”.

Press “OK”

Step 57. As “Script Function”


enter: logProductDetails

Step 58. Select the “Log Product


Details” Step and press the “+”
button to add a final flow step.

Step 59. Select “Request Reply”


step.

35
Step 60. Rename it to: Replicate
Entities

Step 61. Create a new “Receiver”


participant and place it below the
process

Step 62. Rename it to: CI

Step 63. Select the “Replicate


Entry” step, press and drag the
“arrow” button and connect it to
the “CI” receiver.

36
Step 64. Select “ProcessDirect”
receiver adapter.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 65. Select the


“ProcessDirect” connected line,
switch to “Connection” tab and
enter the following details:
Address:
replicate_entities_###

Step 66. Your final integration flow


should look like as the given
screenshot.

37
Step 67. Click “Save as Version”
button on top right of the window.

Step 68. Provide the following


properties:

Version: 1.0.0
Comment: initial version

Press “OK”

Step 69. Press “Deploy” and


confirm the dialog with “Yes” to
deploy your integration flow.

38
Task 3: Create Integration Flow to replicate entities data to Northwind application

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Important Info: To write data to


the Northwind OData V2 Service,
you need a unique endpoint.

Step 1. Request a unique endpoint


by opening this link and press
“Browse the Full Access (Read-
Write) Service”

Step 2. You will be redirected to a


URL with a unique ID. Copy the
whole URL to your notepad as it
will be required later in this
exercise.

Step 3. Go back to SAP Integration


Suite tenant and navigate to
“Design” -> “Integrations”.

39
Step 4. Navigate to the integration
package
“openSAP_btp3_Week4_Exercis
e_xxx” that you created in Task 1
above.

Step 5. In case, edit mode is not


active, press the “Edit” button.

Step 6. Navigate to “Artifacts” tab


and Press “Add” -> “Integration
Flow”

40
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 7. Provide following details:

Name: Northwind
Category_Supplier_Product_Entity
Replication_XXX
Description: Category, Supplier
and Product entity Replication to
Northwind using OData V2 test
service

Press “OK”

Step 8. Open the Integration Flow


you just created by clicking on it.

Step 9. Press “Edit” button to


switch to the edit mode.

Step 10. Double click on the


“Sender” participant or press the
“Restore” button on the bottom
right to expand the details menu.

Step 11. Press on the “Sender” tile


and rename it to: CI

41
Step 12. Press and drag the
“Connector” button to connect the
“CI” sender with the “Start” step.

Step 13. Select “ProcessDirect”


sender adapter.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 14. Switch to “Connection”


tab and provide the Address that
you had maintained in the Process
Direct adapter in Task 2, Step
Error! Reference source not
found.

replicate_entities_###

Step 15. Select the “Start” flow


step and press the “+” button to
add a new flow step.

42
Step 16. Select “Content
Modifier” step.

Step 17. Rename the step to:


Set Properties

Step 18. Switch to “Exchange


Property” tab and press the “Add”
button twice to create two new
entries and provide the following
details:
Entry 1
Name: CustomHeaderName
Source Type: Constant
Source Value: Product ID

Entry 2:
Name: CustomHeaderValue
Source Type: XPath
Source Value:
/Products/Product/ProductId/text()
Data Type:
java.lang.String

Note: This helps you to search the


message processing log (MPL) using
business contextual values like the Product
ID in this case.

43
Step 19. In order to open the
general Integration Flow
settings, click on a white space in
the IFlow Diagram as shown in the
screenshot.

Change to “References” tab and


navigate to “Global” tab.

Click “Add References” -> “Script


Collection” to create a new Script
Collection Reference.

Step 20. Select Package


“openSAP_btp3_Week_4_Exerci
se_Solution”.

Note: Script Collection and Message


Mapping artifacts that are required for this
exercise is already created and deployed as
part of the Solution package and with this
step we just referencing the same without
the need of creating it again and again for
each participant.

Step 21. Select “SC MPL_Utils”


and press “OK”. Now you have
successfully added a Global Script
Collection as reference in your
integration flow.

Note: This Script Collection artifact contains


the following two groovy scripts:
1. MPLAttachment: to add the
payload attachment in the
message processing log (MPL)
2. MPLCustomHeader: to add the
custom header properties to store
business or payload related
information in the message
processing log (MPL)

Step 23. Select the “Set


Properties” flow step and press
the “+” button to add a new flow
step.

44
Step 24. Select “Groovy Script”
step.

Step 25. Rename the step to:


Set MPL Custom Header

Step 26. Switch to “Processing”


tab and press “Select”

45
Step 27. Switch to “Referenced
Resources” and select
“MPLCustomHeader”.

Press “OK”.

Step 28. Widen the area of the


Integration process to make
some more space for additional
steps. And put the “End” step in
the middle right.

Step 29. Select the “Set MPL


Custom Header” step and press
the “+” button to create a new flow
step.

Step 30. Search for “sequential”


and choose “Sequential
Multicast” under “Routing”

Note: You can use the Multicast step to


send copies of the same message to
multiple routes. You can send copies to all
routes at once using Parallel Multicast or in
an order of your choice using Sequential
Multicast.
In this case we use sequential multicast as
we like to replicate the associated entities
i.e., Category and Supplier first and then
finally replicate the Product by linking it with
the already created Category and Supplier.

46
Step 31. Select “Branch 1“and
rename it to Category

Step 32. Press “Save”

Step 33. Next you must add a


Number Range for the Category
ID. Therefore, navigate to
“Monitor”-> “Integrations” and
then select “Number Ranges” tile.

Note: The Northwind Service expects an


Integer as category id, while our source
(WebShop) is providing a string. By using a
Number Range, we can generate
incrementing Integer ids in Cloud
Integration.

47
Step 34. Click the “Add” button to
create a new Number Range
object.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 35. Provide the following


details:

Name: CategoryIDNRO_###
Description: NRO to auto
increment Category ID while
creating the Categories on
Northwind
Minimum Value: 3
Maximum Value: 999

Press “OK”

Step 36. Navigate back to the


Integration Flow that you were
created in this Task and in case,
edit mode is not active, press the
“Edit” button.

Press the “+” button on the


Category Branch to add a new
step.

Step 37. Select “Content


Modifier” step

48
Step 38. Rename the step to:
Set Properties

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 39. Switch to “Exchange


Property” tab and press the “Add”
button four times to create four
new entries and provide the
following details:
Entry 1
Name: CategoryID
SourceType: Number Range
Source Value:
CategoryIDNRO_###

Entry 2
Name: CategoryName
Source Type: XPath
Source Value:
/Products/Product/CategoryName/t
ext()
DataType:
java.lang.String

Entry 3
Name: EntityName
Source Type: Constant
Source Value: Categories

Entry 4
Name: EntityMappingName
Source Type: Constant
Source Value: ref:MM_Category

49
Step 40. Select the “Set
Properties” flow step and press
the “+” button to add a new flow
step.

Step 41. Select again “Content


Modifier” step.

Step 42. Rename the step to


following value:
Construct Category Payload

Step 43. Switch to “Message


Body” tab and set the following
values:

Type: Expression
Body:
<?xml version = "1.0" encoding = "UTF-8"
?>
<ProductCategories>
<ProductCategory>
<CategoryID>${property.CategoryID}</Cate
goryID>
<CategoryName>${property.CategoryName
}</CategoryName>
</ProductCategory>
</ProductCategories>

50
Step 44. Add a new “Local
Integration Process” and place it
underneath the main Integration
Process.

Note: A local integration process is required


for implementing idempotency and helps to
modularize generic steps.

Step 45. Rename the process to:


Product, Category and Supplier
Replication to Northwind

Step 46. In the main Integration


Process, select the Content
Modifier step just created and
press the “+” button to create a
new flow step.

Step 47. Search for “idempotent”


and choose “Idempotent Process
Call” under “Call”.

51
Step 48. Rename the name to:
Idempotent Category Replication

Step 49. Switch to “Processing”


tab and press the “Select” button.

Step 50. Choose the Local


Integration Process you just
created.

52
Step 51. Enter the following
properties.

Message ID:
${property.CategoryName}

Note: An Idempotent Process Call makes


sure, that for each Message ID (=Category
Name), the Local Integration Process is
called only once. Check this link for more
information.

Step 52. Now select the “Start 1”


step in the Local Integration
Process and press the “+” button to
add a new flow step.

Step 53. Search for “Message”


and choose “Message Mapping”
under “Transformation”

Step 54. Rename it to:


Dynamic Message Mapping

53
Step 55. Navigate to “Processing”
tab and provide the following
details:

Reference Type: Dynamic


Expression:
${property.EntityMappingName}

Note: Message mapping for Category,


Supplier and Product has been already
created and deployed as part of the Solution
package. With dynamic reference type, you
can choose the mapping during the runtime.

Step 56. Select the “Dynamic


Message Mapping” flow step and
press the “+” button to add a new
flow step.

Step 57. Search for “Request” and


choose “Request Reply” under
“Call”

Step 58. Rename the step to:


Create Entity

54
Step 59. Click on the “Receiver”,
participant and place it next to the
process and rename it to:
Northwind

Step 60. Click on the “Create


Entity” step and press and drag
the “arrow” button and connect it
to the “Northwind” Receiver.

Step 61. Select “OData” as


receiver Adapter and Protocol as
“OData V2”

Step 62. Switch to “Connection”


tab and provide the following
details:

Address:
<Northwind URL that you have
obtained in step 2>
Proxy Type: Internet
Authentication: None
CSRF Protected: Uncheck (False)

55
Step 63. Switch to “Processing”
tab and provide the following
properties:

Operation Details: Create (POST)


Resource Path:
${property.EntityName}

Step 64. Now let’s go back to the


main Integration Process and
select the “Sequential Multicast
1” step and press the “+” button to
add a new flow step.

Step 65. Search for “Filter” and


choose “Filter” under
“Transformation”

Step 66. Drag and drop the


“Filter” step underneath the
existing flow steps and rename it
to: Filter Supplier Payload

56
Step 67. Switch to “Processing”
tab and provide the following
details:

XPath Expression:
/Products/Product/Supplier/Supplier
Value Type: Node

Step 68. Select the “Branch 1”


and rename it to: Supplier

Step 69. Click on the “Filter


Supplier Payload” flow step and
press the “+” button to create a
new flow step.

Step 70. Select “Content


Modifier” step.

57
Step 71. Rename the step to:
Set Properties

Step 72. Switch to “Exchange


Property” tab and press the “Add”
button three times to create three
new entries and provide the
following details:
Entry 1
Name: SupplierId
Source Type: XPath
Source Value:
/Supplier/SupplierId/text()
Source Type:
java.lang.String

Entry 2
Name: EntityName
Source Type: Constant
Source Value: Suppliers

Entry 3
Name: EntityMappingName
Source Type: Constant
Source Value: ref:MM_Supplier

Step 73. Select the “Set


Properties” flow step and press
the “+” button to add a new flow
step.

Step 74. Search for “idempotent”


and choose “Idempotent Process
Call” under “Call”.

58
Step 75. Rename the name to:
Idempotent Supplier Replication

Step 76. Switch to “Processing”


tab and press the “Select” button

Step 77. Choose the Local


Integration Process that you
created before.

Step 78. Enter the following


properties.

Message ID:
${property.SupplierId}

Note: An Idempotent Process Call makes


sure, that for each Message ID (=Supplier
ID), the Local Integration Process is called
only once. Check this link for more
information.

Step 79. Press and drag the


“Connector” button to connect the
“Idempotent Supplier
Replication” step with the “End”
step.

59
Step 80. Let’s add one last branch
to the sequential multicast for the
product replication. Click on the
“Sequential Multicast 1” step and
press the “+” button.

Step 81. Select “Content


Modifier” step.

Step 82. Drag and drop the


content modifier underneath the
existing steps. You can also
change the shape of the incoming
arrow via drag and drop.

Step 83. Click on “Branch 1” and


rename it to: Product

60
Step 84. Click on the “Content
Modifier” step and rename it to:
Set Properties

Step 85. Switch to “Exchange


Property” tab and press the “Add”
button three times to create three
new entries and provide the
following details:
Entry 1
Name: CategoryName
Source Type: XPath
Source Value:
/Products/Product/CategoryName/t
ext()
Data Type: java.lang.String

Entry 2
Name: EntityName
Source Type: Constant
Source Value: Products

Entry 3
Name: EntityMappingName
Source Type: Constant
Source Value: ref:MM_Product

Step 86. Select the “Set


Properties” flow step and press
the “+” button to add a new flow
step.

61
Step 87. Search for “enrich” and
choose “Content Enricher” under
“External Call”

Step 88. Rename the step to:


Enrich Category ID

Step 89. Switch to “Processing”


tab and provide the following
properties:

Aggregation Algorithm: Enrich

Original Message
Path to Node: Products/Product
Key Element: CategoryName

Lookup Message
Path to Node:
Categories/Category
Key Element: Name

62
Step 90. Select the “Northwind”
receiver participant, press and
drag the “Connector” button to
connect the “Northwind” receiver
to the “Enrich Category ID” step.

Step 91. Select “OData” as


receiver Adapter and Protocol as
“OData V2”

Step 92. Rename the Channel to:


OData_Enrich

Step 93. Switch to “Connection”


tab and provide the following
details:

Address:
<Northwind URL that you have
obtained in step 2>
Proxy Type: Internet
Authentication: None
CSRF Protected: Uncheck (False)

63
Step 94. Switch to “Processing”
tab and provide the following
properties:

Operation Details: Query (GET)


Resource Path: Categories
Query Options:
$select=ID,Name&$filter=Name eq
'${property.CategoryName}'

Step 95. Select the “Enrich


Category ID” flow step and press
the “+” button to add a new flow
step.

Step 96. Search for “Process” and


choose “Process Call” under
“Call”

Step 97. Rename the step to:


Product Replication

Step 98. Switch to “Processing”


tab and press “Select” button.

64
Step 99. Choose the Local
Integration Process that you
created before.

Note: In this, we just made a normal


process call instead of Idempotent Process
call because we had already checked for
Product duplication in the parent integration
flow.

Step 100. Press and drag the


“Connector” button to connect the
“Product Replication” with the
“End” step.

Step 101. Your final integration


flow should look like as the given
screenshot.

Step 102. Click “Save as Version”


button on top right of the window.

65
Step 103. Provide the following
properties:

Version: 1.0.0
Comment: initial version

Press “OK”

Step 104. Press “Deploy” and


confirm the dialog with “Yes” to
deploy your integration flow.

With this you have implemented


the entire scenario, let us now test
the scenario.

66
Task 4: Test your scenario

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Step 1. Switch to “Monitor” ->


“Integrations” to check the status
of your deployed integration flows

Step 2. Select the first tile under


“Manage Integration Content”
section.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 3. Now you can see all the


deployed Integration Flows. To
search for your created flow,
provide the integration package
name that you have created in
Task 1 i.e.,
openSAP_btp3_Week4_Exercise_###

All of you Integration Flows must


have Status “Started”.
In case an error occurred during
deployment, please check the
documentation again or compare
your integration flows against the
solution package i.e.,
openSAP_btp3_Week_4_Exercis
e_Solution

67
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 4. Click on the Integration


Flow that was created in Task 1
i.e.,
WebShopToJMS_ProductReplic
ation_###

On the right side of the screen, you


will see the Endpoint of your
Integration Flow. Press the copy
button to copy the URL to your
notepad as we will require it later to
trigger the interface from any
REST client.

Note: You can use any REST client of your


choice like Postman, Insomnia but in this
exercise, we are using Postman.

Step 5. In order to call the


endpoint, open Postman and press
the “New” button to create a new
request.
Choose “HTTP” in the Popup.

Step 6. Change the HTTP


Operation to “POST” and paste
the endpoint that you had copied
in the previous step.

68
Step 7. You also need to add
Credentials. Therefore, switch to
the “Auth” or “Authorization” tab
and choose Type as
“Basic Auth”

Step 8. As Username you can add


the “Process Integration Client
ID” and as Password copy the
“Process Integration Client
Secret” that you got the tenant
booking application, see
Preparation section for more
details.

Step 9. Switch to “Body” tab and


select “raw”.

69
Step 10. Change the Content-Type
to “XML”

Step 11. Provide the following


payload:

<?xml version="1.0"?>
<Product>
<ProductId>HT-
1117</ProductId>
</Product>

Note: You can also replicate other products,


just explore the WebShop application via
this link.
Just select one Product from the list and
replace Product ID in the XML with the one
you want to replicate.

Step 12. Finally click the “Send”


button.

As response you should receive


“202 Accepted”.

70
Step 13. Jump back to the
Monitoring in the Integration Suite.
Select “Monitor” -> “Integrations”

Step 14. Click on the first tile “All


Artifacts” under “Monitor
Message Processing” section.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 15. In the “Artifact” field,


search for your Integration
Package:
openSAP_btp3_Week4_Exercise_###

Select your Integration package to


see only messages processed by
your integration flows.

71
Step 16. You should see all three
Integration Flows executed and in
status “Completed”.

In case you see Status “Retry” or


“Error”, please check the
documentation again or compare
your integration flows against the
solution package i.e.,
openSAP_btp3_Week_4_Exercis
e_Solution

Step 17. Click on the “>” icon on


the top left to expand the search
options.

In Custom Header put in following


value:

Product ID = <your ProductID>


e.g: Product ID = HT-1117

Press “Enter”.
Now the messages are filtered
based on the custom header. You
can also see all Customer Headers
of one Message on the details
page.

Step 18. To validate whether the


product data along with associated
Category and Supplier is replicated
to Northwind application or not,
enter the following URL in the
browser, you should see the details
as shown in the given screenshot.

<Northwind URL that you have


obtained in step
2>/Products(1117)?$expand=Cat
egory,Supplier

E.g.,
https://services.odata.org/V2/(S(i
bagny0nu0lgbi3gzvvvto42))/ODa
ta/OData.svc/Products(1117)?$e
xpand=Category,Supplier

72
Note: While replicating the product from
WebShop to Northwind application, we
remove the “HT-” prefix, so whenever you
search the product in Northwind, just search
it without “HT-”

Step 19. In case you see retry in


your message process logs (MPL).
Fix the issue and then you can
retrigger the process from the JMS
Queue itself.
Navigate to “Monitor” ->
“Integrations” -> “Manage Stores”
-> “Message Queues”.
Then select your queue and
message to retrigger the process
as shown in the screenshot.

Step 20. If you run the scenario


again from Step 12 by giving the
same Product ID, you will observe
that you have only two integration
interfaces in completed state and
one will have the Custom Header
Is Product Duplicate = true

This means that due to Idempotent


Process call, the duplicate product
ID is not processed further and
simply exited.

Congratulations! You have successfully completed the exercise.

73
Coding Samples
Any software coding or code lines/strings (“Code”) provided in this documentation are only examples and are not intended for use in a production system environment. The Code is only intended to better
explain and visualize the syntax and phrasing rules for certain SAP coding. SAP does not warrant the correctness or completeness of the Code provided herein and SAP shall not be liable for errors or
damages cause by use of the Code, except where such damages were caused by SAP with intent or with gross negligence.

www.sap.com/contactsap

© 2021 SAP SE or an SAP affiliate company. All rights reserved.


No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

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/trademark for additional trademark information and notices.

You might also like