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: 
former_member607993
Contributor
PRIMARILY AND IMPORTANTLY STAY SAFE ALONG WITH YOUR BEAUTIFUL FAMILY.

BE HYGIENE AND RESPONSIBLE !!!

 

Over to the content below ▶️

Abstract:

This blog will elucidate about SAP NetWeaver Business Process Management(BPMN) scenario with HTTP Technical Error handling, Business Error Handling, Retry, Reprocessing, Email Notification and Ticketing.

1. Introduction to NetWeaver BPM:


SAP NetWeaver Business Process Management(BPMN)enables you to quickly automate and flexibly optimize your business processes – from simple workflows to integrated processes that span applications and organizational boundaries. It also offers the ability to increase collaboration and alignment between business and IT through business process modeling capabilities, using a standard business process modeling notation (BPMN) that is understandable by both IT and the business. IT can augment these agreed-upon models to connect to the right systems (with the help of the SAP NetWeaver PI component) and to the right people involved in the business process to streamline execution. The end result is increased visibility and auditability. Business process management is an attempt to provide that holistic view.


Figure 1. BPMN attempts to align business strategy with IT execution by adding insight and flexibility to efficient automation.


One of the most important innovations of BPMN is strengthening the link between strategy and execution (Figure 1). 

  • Strategy is primarily a business concern, execution an IT concern. Historically, their central goals have not been perfectly aligned. 

  • On the execution side, IT focuses on efficiency, security, and reliability, all critical to keeping the core business operating smoothly.


2.  Business Process Lifecycle:


Prior to BPMN we had such models but employed them purely for business process analysis. They could identify gaps between strategy and execution and suggest changes in the IT domain in the form of “business requirements,” but could not make those changes happen any faster. To be implemented, they would first have to be translated into IT models – using a different modeling “language” – and from there into code. The net result was frequent loss of agility and imperfect business-IT alignment.

BPMN attacks these problems by creating a new modeling language shared by business and IT, and by generating implementation from the models themselves. These executable models describe more than just the workflow. They include also the forms in the task user interface, the business rules, and other components of the process implementation, all created using graphical tools within a unified design environment. Thus besides a new management discipline and a new set of software tools and technologies, BPMN represents a new business-IT interaction style, one based on direct collaboration and shared modeling artifacts.

The business process lifecycle can be described as: Design, Model, Execute, Monitor, and Improve.


Figure 2. Business Process Lifecycle




  • Design: The Design involves the analysis of existing processes (as is) and design of the new (to be) processes, including the mapping to application and information architectures. 

  • Model: The model step comprises the translation of the high-level process model (UML or BPMN 2.0 describing the process at an abstract level) to the more detailed and executable model modeled in BPMN 2.0.

  • Execute: During execution (runtime), the process is executed by the BPM software platform in charge of interpreting the BPMN 2.0 source code into an orchestrated software program.

  • Monitor: During monitoring, running (or completed, independent of the status) business processes on the BPM platform are observed. The monitoring of the processes depends on how the business wants to collect and analyze the process data (real time, near real time, or based on historical data). Real-time monitoring is also called Business Activity Monitoring (BAM).

  • Improve: This step is intended to be a continuous process on its own and uses the design and monitoring steps as input.


3.  Prerequisites:


Please make sure the below components and its libraries are binded in NWDS.

  1. Install the latest version SAP NetWeaver Developer Studio 7.5.

  2. Java SE - 1.8

  3. SAP JAVA EE 5 Libraries

  4. Visual Composer/WebDynpro UI/SAP UI


NWDS Configurations:

  • In NWDS, check if a proper connection is established between NWDS and PI Server


( Go to Windows –> Preferences –> PI Tools Configuration –> Connections).Provide the system name, host and port.

  • Add SAP PI system to be used for deployment, monitoring, control and debugging( Go to Windows –> Preferences –> SAP AS JAVA). Specify PI hostname and instance number and select a default system for deployment.

  • For more details: Refer NWDS Configurations



4.  Data Flow Architecture:


Integration between Google cloud platform and Cloud based workforce management system via EAI Middleware SAP PO.

Figure 3. Data flow Architecture




4.  BPMN Process Flow:


Below is the BPM Process flow so lets take a trek at each activity in detail. 🙂

(Start, Automated activity, Uncontrolled Merge, Exclusive choice gateway, Embedded sub process, mapping, Inclusive choice gateway, End).



Figure 4. BPMN Process Flow



5.  Enterprise Service Builder: Object Development


Step 1.  Article Master Request to BPM Initialization

   In the Enterprise service builder, create a new namespace and interface objects i.e. data type, message type and service interface for Outbound interface(Google Cloud Storage).Likewise create the inbound service interface & the attribute category will be abstract and interface pattern will be XI Compatible 3.0 Stateless. This is an Asynchronous mode and flow is from Google Cloud Storage to BPM via PI (AEX). Messages from AEX are processed by the Java Proxy Runtime (JPR) and a communication channel is used that is based on the SOAP adapter with XI protocol.


 

Step 2.  Batch the Articles based on Service Limit

    Create the service interfaces for outbound and inbound and interface pattern will be XI Compatible 3.0 Stateless. This is an Asynchronous mode and interface objects are created in ES Repository and Operational mapping is imported to BPM assigned to an automated activity in BPM process.


Purpose of this Mapping: In the server side there is a service limit constraint to request only 50 articles in the json payload. Below is the User defined function which assign batch number for each records based on service limit value defined in Value Mapping Group. For example: first 50 records the batch number will be '1' and next 50 will be '2' and so on.



Batch Number Mapping:


Assigns batch number for each record based on service limit value defined in Value mapping group.


Total Batch count Mapping:

Batch count refers to total count of batches. Here it is total number of batched articles and this will be required to end the Loop in the BPM Process.


Value Mapping Group:

Below diagram depicts the value mapping group for Service Limit.


User Defined Function( Assigns Batch Number based on Service Limit) :
public void getBatchNumber(String[] articleList, int[] service_limit, ResultList result, Container container) throws StreamTransformationException {

//Assign PI Batch Number based on Service Limits

int k = 0;
int l = 1;
for (int i = 0; i < articleList.length; i++) {
if (k < service_limit[0]) {
result.addValue(l);

} else {
k = 0;
l++;
result.addContextChange();
result.addValue(l);
}
k++;
}

 

Step 3.  Article Master REST API Call

Create a new service interface for Outbound and inbound interface. The outbound service interface & the attribute category will be abstract and interface pattern will be XI Compatible 3.0 Stateless. This is an Synchronous mode and flow is from BPM to Workforce Management system via PI (AEX). Messages from BPE are processed using an automated activity to AEX by the SOAP XI adapter and receiver communication channel use REST Adapter to connect with the Workforce Management system.

Request Message Mapping:


Response Message Mapping:



 

Step 4.  Article Master Response to Google Cloud Storage Bucket

Create a new service interface for Outbound interface(BPM) & the attribute category will be abstract and interface pattern will be XI Compatible 3.0 Stateless and also create service interface for Inbound interface(Cloud Storage). This is an Asynchronous mode and flow is from BPM to Cloud Storage via PI AEX. Messages from BPM use message end event to complete the process and flow to AEX asynchronously and will not have an associated response message.


Technical Error Flag Mapping:

Purpose of this field is to notify Google Cloud Storage(source) if there is any HTTP technical error occurred during message processing from SAP PO to Workforce Management system.


User Defined Function( To Get Technical error flag) :
public void getTechnicalErrorFlag(String[] responseArticles, String[] articleList, String[] technicalErrorFlagValue, ResultList result, Container container) throws StreamTransformationException {

//get technical error flags by comparing response articles with list of articles

Map < String, String > articleMap = new HashMap < String, String > ();
int i = 0;
for (String key: responseArticles)
articleMap.put(key, String.valueOf(i++));


for (int j = 0; j < articleList.length; j++) {

if (articleMap.get(articleList[j]) != null) {

result.addValue(technicalErrorFlagValue[j]);

} else {

result.addSuppress();
}
}
}

 

Step 5.  Error Handling and Reprocessing

Create the interface objects i.e. new data type for Error Handling and Reprocessing to capture HTTP technical errors and another data type for mapping errors/ message exceptions. Create a new service interface for Outbound interface(BPM) & the attribute category will be abstract and interface pattern will be XI Compatible 3.0 Stateless. This will be the input to message type to below two mappings.

Step 5.1.  Send Email Notification or Ticketing

Create a new service interface for Inbound interface(MAIL). This is an Asynchronous mode and flow is from BPM to MAIL via PI AEX.

Data Type( HTTP Technical Error Notification) :


Data Type( Mapping Error Notification) :


User Defined Function( HTTP Technical Error Notification) :
//var1 - Interface
//var 2 and var 3 - Error code and Error message(502 Bad Gateway, 401 UnAuthorized, etc.)
//var4 - API name(ArticleMaster/PurchaseOrder/SalesOrder, etc.)
//var5 - No of Retries
//var6 - SID
//var7 - Error Datestamp
//var8 - Interface Namespace
//var9 - Source Ref Id
//var10 - Source XML FileName
///var11- SAP PI Message Id
///var12- BPM Process Instance Id
//var13- Article Number
//var14- Batch Number

String message = "Hello Team," + "<br><br>";

message += "The " + "<b>" + var1 + "</b>" + " interface failed due to " + "<b style=" + "color:red"+ ">" + var2 + "</b>" + " at " + "<b>" + var4 + "</b>" + " API." + "Please find the details in the table below." + "<br><br>";

message += "The number of Retries reached the Maximum limit, i.e. " + "<b>" + var5 + "</b>" + " for every " + "<b>" + "30 seconds " + "</b>" + "of wait time." + "<br><br>";

message += "Please check and resolve this issue immediately." + "<br><br>";

message += "<head>" + "<style>"+ "table, th, td {" + "border: 1px solid black;" + "}" + "</style>" +

"</head>" +

"<body>" +
"<table>" +
"<tr>" + "<th>" + "Description: " + "</th>" + "<td>" + "Technical Error Occured for " + var1 + " in " + var6 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Error Code: " + "</th>" + "<td>" + var2 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Error Status: " + "</th>" + "<td>" + var3 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Error DateStamp: " + "</th>" + "<td>" + var7 + " PST" + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Interface Name: " + "</th>" + "<td>" + var4 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Interface Namespace: " + "</th>" + "<td>" + var8 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Article Number: " + "</th>" + "<td>" + var13 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Batch Number: " + "</th>" + "<td>" + var14 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Source Ref Id : " + "</th>" + "<td>" + var9 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "No of Retries: " + "</th>" + "<td>" + var5 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "File Name: " + "</th>" + "<td>" + var10 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "PI Message Id: " + "</th>" + "<td>" + var11 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "BPM Process Instance Id : " + "</th>" + "<td>" + var12 + "</td>" + "</tr>" +
"</table>" +
"</body>" + "<br><br>";

message += "Thanks," + "<br><br>" + "<b>" + "Your PI Team" + "</b>" + "<br><br>";

return message;


Mapper(HTTP Technical Error Notification)

Technical error notifications covers all HTTP technical error codes defined below.

 

User Defined Function( Mapping Error Notification) :

//var1 - Interface
//var2 - API name(ArticleMaster/PurchaseOrder/SalesOrder, etc.)
//var3 - SID
//var4 - Error Datestamp
//var5 - Interface Namespace
//var6 - Article Number
//var7 - Batch Number
//var8 - Error Message
//var9 - Connectivity Type
//var10 - Root Error Message
//var11 - Source Ref Id
//var12 - Source XML FileName
//var13 - SAP PI Message Id
//var14 - BPM Process Log Id
//var15 - Operation Name
//var16 - BPM Process Instance Id

String message = "Hello Team," + "<br><br>";

message += "The " + "<b>" + var1 + "</b>" + " interface failed due to Mapping Exception at " + "<b style=" + "color:red"+ ">" + var2 + "</b>" + ".Please find the details in the table below." + "<br><br>";

message += "Please check and resolve this issue immediately." + "<br><br>";

message += "<head>" + "<style>"+ "table, th, td {" + "border: 1px solid black;" + "}" + "</style>" +
"</head>" +
"<body>" +
"<table>" +
"<tr>" + "<th>" + "Description: " + "</th>" + "<td>" + "Mapping Exception Occured for " + var1 + " in " + var3 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Error Datestamp: " + "</th>" + "<td>" + var4 + "PST" + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Interface Name: " + "</th>" + "<td>" + var2 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Interface Namespace: " + "</th>" + "<td>" + var5 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Operation Name: " + "</th>" + "<td>" + var15 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Article Number: " + "</th>" + "<td>" + var6 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Batch Number: " + "</th>" + "<td>" + var7 + "</td>" + "</tr>" + "</tr>" +
"<tr>" + "<th>" + "Error Message : " + "</th>" + "<td>" + var8 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Connectivity Type: " + "</th>" + "<td>" + var9 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Root Error Message: " + "</th>" + "<td>" + var10 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "Source Ref Id: " + "</th>" + "<td>" + var11 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "File Name: " + "</th>" + "<td>" + var12 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "PI Message Id: " + "</th>" + "<td>" + var13 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "PI Process Log Id: " + "</th>" + "<td>" + var14 + "</td>" + "</tr>" +
"<tr>" + "<th>" + "BPM Process Instance Id: " + "</th>" + "<td>" + var16 + "</td>" + "</tr>"+
"</table>" +
"</body>" + "<br><br>";

message += "Thanks," + "<br><br>" + "<b>" + "Your PI Team" + "</b>" + "<br><br>";

return message;

Mapper(Mapping Error Notification)


Mapping error notifications covers general errors, timeout errors, socket errors, mapping errors, runtime errors etc.

 

Step 5.2.  Stop Sender Communication Channel

NA

Step 5.3.  Write Request File for Reprocessing

Create a new service interface for Inbound interface(Cloud Storage). This is an Asynchronous mode and flow is from BPM to Cloud Storage via PI AEX.

 

6.  Integration Builder: Configuration


Step 1.  Google Cloud Storage Request to BPM Initialization via PI AEX

In the Integration directory, create a Sender business component and respective sender communication channel with ‘GOOGLECLOUD’ as sender adapter and likewise create a Receiver business component and respective receiver communication channel with ‘SOAP’ as receiver adapter. In the receiver communication channel the message protocol is XI 3.0 this web service which indeed triggers the BPM Process addressed with JPR URL.

Google Cloud Sender Communication Channel


SOAP Receiver Communication Channel


Step 2.  Batch the Articles based on Service Limit

No communication channel and Iflow ( since its a WS call within BPM).

Step 3.  Article Master REST API Call

Create a Sender business component and respective sender communication channel with ‘SOAP’ as sender adapter and likewise create a Receiver business component and respective receiver communication channel with ‘REST’ as receiver adapter.

 

SOAP Sender Communication Channel


REST Receiver Communication Channel


 

REST Custom Error Handling:


Result Handler 1 ( retrieves HTTP result)
{http_result}

Result Handler 2 ( sends customized message content for HTTP technical errors)
<?xml version="1.0" encoding="UTF-8"?>
<ns0:ArticleMasterAPIResponse xmlns:ns0="http://test.com/ArtcileMasterReplication">
<technical_error_log>
<error_code>{http_status}</error_code>
<message/>
<error_type>Technical Error</error_type>
<error_status>{http_status_text}</error_status>
<error_datestamp/>
<interface_name>ArticleMaster</interface_name>
<interface_namespace>http://test.com/ArtcileMasterReplication</interface_namespace>
<material/>
<source_ref_id/>
<pi_batch_number/>
<no_of_retries/>
<log/>
<file_name/>
<pi_message_id/>
<process_instance_id/>
</technical_error_log>
</ns0:ArticleMasterAPIResponse>

Architecture:


Note: After stop sender comm. channel (3), there is an Heart Beat (custom adapter Module development) interface which polls every 3 minutes, checks the HTTP status of End application if 200 OK it starts the sender communication channel. I will keep posted about this in next episode.

HTTP codes considered for Technical Errors: 

Below are the codes to be considered for HTTP technical errors and these are provided by End application.


Step 4.  Article Master Response to Google Cloud Storage Bucket

Create a Sender business component and respective sender communication channel with ‘GOOGLECLOUD’ as sender adapter and likewise create a Receiver business component and respective receiver communication channel with ‘SOAP’ as receiver adapter.

GOOGLECLOUD Receiver Communication Channel


Step 5.  Error Handling and Reprocessing

Create a Sender business component and respective sender communication channel with ‘GOOGLECLOUD’ as sender adapter and likewise create a Receiver business component and respective receiver communication channel with ‘SOAP’ as receiver adapter.

  Step 5.1.  Send Email Notification or Ticketing

 

Mail Receiver Communication Channel



  Step 5.2.  Stop Sender Communication Channel

SOAP Receiver Communication Channel



 

  Step 5.3.  Write Request XML File for Reprocessing

This flow is required to reprocess the message in case of HTTP technical errors.

GOOGLECLOUD Receiver Communication Channel


 

 

Have a happy Reading. Lets catchup in Episode 2 more about the BPM process Insights.

Thankyou!
Labels in this area