Supply Chain Management Blogs by SAP
Expand your SAP SCM knowledge and stay informed about supply chain management technology and solutions with blog posts by SAP. Follow and stay connected.
cancel
Showing results for 
Search instead for 
Did you mean: 
ManoelCosta
Product and Topic Expert
Product and Topic Expert
2,007
Introduction

SAP Digital Manufacturing offers Error Codes, Error Catch and Error End capabilities in Design Production Process app to improve overall error handling capabilities.

Once an Error is properly catched via Error Catch control, Production Processes can end using Error End control and include an Error Code, which can be seen in Monitor Production Processes and Recover Production Processes apps for monitoring, debugging and retrying capabilities.

In this blog post, I will show you in detail how to implement and use SAP Digital Manufacturing ehanced Error Handling capabilities in Production Processes.

Build

First, create a new Production Process Design and a new Cloud Process in Design Production Process app.

Then, create the following flow, including "ErrorCatch" and "Error End" controls:


Select ErrorCatch control and select the specific Errors you want to Catch, like for example Error 500 Internal Server Error:


Then, click on the three dots on the top right corner, and select Manage Error Codes:


Create any Error Codes that your Production Process might need to trigger, including Business Error Codes like:


Select ErrorEnd control and define the specific Error Code you want to return for this specific error case as follows:


In addition, enable the "Show Process in Recovery List", define "Termination Mode" and "Parameter(s) Causing the Failure" parameters in case you want to send this Production Process to Recover Production Process app when it fails for retrying purposes.

Keep in mind that Recover Production Process apps will only show Production Processes executed Asynchronouslly.

Run this Production Process normally via PODs or Automatic Triggers, for example.

When this Production Process fails and the Error is properly catched by your Error Catch and therefore Error End is triggered, you should be able to see Error Code details in both Monitor Production Process and Recover Production Process apps.

Monitor Production Process

Note that status of failed Production Processes using Error End control is "Completed with Error".


Click on any failed Process Instance to see the details.


Note that the pre-defined Error Code is shown in the End step.

 

Recover Production Process

Note that "Error Description" column shows your pre-defined Error Code message.


Click on any failed Process Instance to see the details.


From the top right corner, Process Instances can be Deleted, Retried, Changed before Retried or Shared by Mail.

Conclusion

SAP Digital Manufacturing Production Processes offers comprehensive Error Handling capabilities, including Error Codes, Error Catch and Error End controls. Failed Production Processes can not only be Monitored and Debugged, but also Recovered and Retried.

Experiencing SAP Digital Manufacturing

You can have a glimpse and experience several aspects of SAP Digital Manufacturing via the Interactive Value Journeys below:






























Discrete within SAP Digital Manufacturing and S/4HANA Cloud
Process Industry within SAP Digital Manufacturing and S/4HANA Cloud
Tool Management within SAP Digital Manufacturing
Resource Orchestration within SAP Digital Manufacturing
Production Process Design within SAP Digital Manufacturing
Shop Floor Orchestration with SAP Digital Manufacturing
Time Tracking within SAP Digital Manufacturing
SAP Digital Manufacturing for Insights
Nonconformances Processes within SAP Digital Manufacturing

 

Do you like this post? Please let me know in the comments section what you think. Any feedback is highly appreciated.

Or, if you have any questions, please check SAP Community Q&A Area, or comment down below.

Thanks,

Manoel Costa
8 Comments
lukas_furmanek
Advisor
Advisor
To build on this very nice error handling block. If you want to handel different custom error codes from subprocesses or standard error codes of the services you are calling, you can add a condition after the error catch. The variable errorCode will describe have the code so you can do checks like this (here with a custom error code): 'errorCode' == "consumptionFailed"
ManoelCosta
Product and Topic Expert
Product and Topic Expert
0 Kudos
Good point, Lukas! Thanks for adding. 🙂
scb-schozs
Explorer
0 Kudos

Dear @ManoelCosta

first of all thanks for all the great stuff you create and share.

Is it possible to use the errorMessage too?
The errorCode HTTP400 isn´t usable to start an advanced errorHandling or to show any worker detailed Information on a machine Interface when using OPC UA. 
For example if a worker uses the PodPlugin Start then he gets an information if its successfull and also if its failed or already started.

I tried different ways but when using the errorCatch only the variable errorCode appears. I tried manually to use a not defined variable errorMessage as Script Input but it doesn´t work.
Otherwise i checked if i could use that input 'Service_Retrieve_Order#message' after an errorCatch. It doesn´t work too.

While debugging the ResponseBody containts the message therefore i thought that there might be a solution.

 

scbschozs_2-1710547932587.png
Thanks
Sascha

ManoelCosta
Product and Topic Expert
Product and Topic Expert

Hi @scb-schozs,
Once an errorCatch is thrown, only the service inputs and errorCode are indeed available, as depending on things like the error and the service itself, there is no guarantee that a proper response body structure is available at all. 

Br,
Manoel

robinkeimel1
Explorer
0 Kudos

Hello Manoel,

very interesting article that provides a quick introduction to error handling.

Whats a little confusing to me is the double usage of the word "errorcode".

For example the production process generates a Error with the error code "400" - and in the Business Service there is the error code "HTTP400" or "consumptionFailed" or what ever (not similar to the error code of the catch...)

... which is in my understanding more a message code then a error code ...

jborrerom
Explorer
0 Kudos

Hello, Manoel,

Thanks for the blog. I could not find more recent information about this topic, just to confirm that this is the current state of the art.

Is it posible already to achieve what @scb-schozs mentioned on their comment, as in catching not only the error code but also the error message from the service?

There are cases where the services handle not only error code but error messages in a proper way. Specially when there are errors with the same come but the message can differ.

Since the service itslef handles properly the different execptions, it would make more sense to map this information direclty as Service Output, instead of doing another handling at Production Process level, with less capability of mapping detail.

Thanks for your support on this topic again,

Juan.

ManoelCosta
Product and Topic Expert
Product and Topic Expert

Hello @jborrerom , I´m not aware of any changes or updates on this topic. Br, Manoel

Apodasch
Newcomer
0 Kudos

Hello @ManoelCosta,

I would like to ask you, if it is possible to use variable (named p_message) in error message - I would like to pass some information to the message response (custom API response) while using Error End control block:

Apodasch_1-1736444683837.png

Apodasch_3-1736444731813.pngApodasch_0-1736444663492.png

 

I would expect similar or the same functionality like for example when using POD Message where ${varName} can be used.

Thank you very much!

Apodasch