cancel
Showing results for 
Search instead for 
Did you mean: 

SAP DM - how we empty the global variable

03-17-2026 11:26 AM
ankit12 Active Participant
572 views 4 comments
0 Likes
SAP Managed Tags
Labels
GenAI Assisted Content
Subscribe

Hi All,

we have some questions about global variable as below:

  1. what are possible ways to empty/reset the global variable in SAP DM.
  2. if the global variable is defined at production connector, if production connector restarts, will it reset the global variable.

Please help us to resolve these doubts regards production connector. quick response will be appreciated. 

Regards,
Ankit Gupta

0 Likes

Accepted Solutions (0)

Answers (3)

Answers (3)

MarcelWolf
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi,

there are two straightforward ways to empty a Global Variable in SAP Digital Manufacturing:

Option 1: Script Task

Add a Script Task to your production process and assign an empty value matching the variable's data type:

  • String: Global.myVariable = "";
  • Number: Global.myVariable = 0;
  • Boolean: Global.myVariable = false;
  • Object / complex type: Global.myVariable = null;

Note: Global Variables do not support expressions directly — the reset must be done inside a Script Task, not in a condition expression field.

Option 2: Write Global Variable Service Step

In the Production Process Designer, add a Write Global Variable service step to your automation sequence and set the value to "" (empty string) or 0 depending on the variable's data type. No scripting needed.

A few things to keep in mind:

  • Global Variables persist across process instances and are not automatically cleared when a process completes — you need to explicitly reset them as shown above.
  • There is no "delete" button in the UI; the approaches above simply overwrite the value with an empty/default state.
  • If you want to avoid stale data, a good practice is to place the reset step as the first step in your process so it always starts clean.

Hope this helps!

MikeS67
Product and Topic Expert
Product and Topic Expert
0 Likes

You delete a global variable from within the Production Process Designer (the app where you manage your production process design). Here’s how:

  1. In the design header section, click the number under Global Variable to open the global variable list.
  2. Locate the global variable you want to remove and initiate its deletion.
  3. If the global variable is used elsewhere in your production process, the system will automatically detect this and display a warning message that lists where it’s in use.
  4. At that point, you can review the Dependencies (by clicking the Dependencies option in the Where-Used column) to see its usage details.
  5. Decide whether to cancel or continue with the deletion. If you continue, note that the related read/write global variables service in any production process using that global variable will show an error—and that service will no longer be usable.
ankit12
Active Participant
0 Likes

Hi @MikeS67 ,

Thanks for response, however the question is once the global variable is defined and it contains the values then how we can empty the global variable without deleting it.

is there any function where we can reset/empty the global variable.

Regards,
Ankit Gupta

MikeS67
Product and Topic Expert
Product and Topic Expert
0 Likes

You delete a global variable from within the Production Process Designer (the app where you manage your production process design). Here’s how:

  1. In the design header section, click the number under Global Variable to open the global variable list.
  2. Locate the global variable you want to remove and initiate its deletion.
  3. If the global variable is used elsewhere in your production process, the system will automatically detect this and display a warning message that lists where it’s in use.
  4. At that point, you can review the dependencies (by clicking the Dependencies option in the Where-Used column) to see its usage details.
  5. Decide whether to cancel or continue with the deletion. If you continue, note that the related read/write global variables service in any production process using that global variable will show an error—and that service will no longer be usable.