Skip to Content

How to use placeholders

Official product documentation:

Parameterizing Values for Provisioning Templates

You parameterize values in system provisioning templates, to execute templates multiple times with different values.
If you want to parameterize some values in the template, you must replace those values with placeholders. Each time the template is executed, you are asked to provide the actual values, the placeholders will be replaced with.


Prerequisites

  • You have exported a system provisioning template.
    For more information, see Exporting System Provisioning Templates.
  • You have identified the variable values that you want to parameterize.
  • You have read and comply with SAP Note 2077756.


Procedure

  1. In the template XML file, add your individual <placeholder> element inside the <placeHolders> element as direct child of the root element <template> as follows:

    <template>

        <placeHolders>

                <placeHolder/>

        </placeHolders>

    ...

    </template>

  2. Define the placeholder with the following attributes:
AttributeDescription
name

Name of the placeholder which replaces the parameterized values in the template XML file.

Warning:

To avoid invalid templates and problems during execution, ensure the following:

  • The name is unique and does not appear with some other semantic in the XML file.
  • The name is not a substring of an existing placeholder name.
description

Optional

The description is used by the person who edits the template. There is no technical meaning.

value

Optional

Default value which is used if nothing else is specified before template execution.

Warning:

Values are case sensitive. If the value with the same semantic appears in the XML file in different cases, provide a placeholder for each variant. The value can be an empty string and in this case all occurrences of the placeholder name are replaced with an empty string.

For example, we declare the two placeholders PLACEHOLDER-NAME-UPPER and PLACEHOLDER-NAME-LOWER as follows:

<template>

    <placeHolders>

            <placeHolder name="PLACEHOLDER-NAME-UPPER" description="upper case" value="SID"/>

            <placeHolder name="PLACEHOLDER-NAME-LOWER" description="lower case" value="sid"/>

    </placeHolders>

...

</template>

  1. Replace  the variable (parameterized) value with the defined placeholder name everywhere the value appears in the template with the same semantic.
    For example: If you want to parameterize the target SID of the system, replace all target SID occurrences in the template with a declared placeholder name. This should be done for each value that needs to be changed in future template executions.
  2. You can now import and execute the template.
    For more information, see Managing System Provisioning Templates on SAP Help Portal.

Before execution, you are prompted to specify the actual values for the placeholders. Then the placeholder names will be replaced with these values and the process execution will proceed normally.

Figure 1: Dialog prompting the user to enter the actual values for the placeholders before template execution


Execution via WebServices

You can also specify placeholder values when executing templates via WebServices.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acc="http://xml.sap.com/2007/07/acc">

  <soapenv:Header/>

  <soapenv:Body>

      <acc:executeTemplate>

        <TemplateId>template-c295ae08-4f87-11e4-83c4-000000665ce2</TemplateId>

        <Properties>

            <Properties>

              <Name>PLACEHOLDER-NAME-UPPER</Name>

              <Value>SID</Value>

            </Properties>

        </Properties>

      </acc:executeTemplate>

  </soapenv:Body>

</soapenv:Envelope>

In this case the placeholders are specified as properties in the Properties section of the executeTemplate WebService.

Tags:

No comments