Start of Content Area

Syntax documentation Parameters  Locate the document in its SAP Library structure

An ST program can contain one or more parameter declarations

 

<tt:parameter name="..." [kind="..."]
                        
[[s-val="..."][d-val="..."]]|[val="..."]/>

 

outside of a template. Use the name attribute to assign a symbolic name, which you can use to access the parameters.

The symbolic name is not case-sensitive and must be unique. The namespace also includes the data roots declared with tt:rootand the variables declared with tt:variable.

You can directly access the parameters in the context of the main template. In subtemplates, the parameters of the main template are not known.

Parameters are special variables and can be used as such. Parameters also take effect as formal parameters of an ST program (or a subtemplate):

     In tt:call (or tt:apply), a current value can be assigned to a parameter with tt:with-parameter

     With addition PARAMETERS of ABAP statement CALL TRANSFORMATION, an ABAP data object can be assigned to a parameter as a current parameter.

Use kind to specify the kind of formal parameter. Possible values for kind are:

     "in"
Input parameter – During the call, an input parameter copies the values of the assigned actual parameter. During the return, the actual parameter does not copy the current value of the formal parameter.

     "out"
Output parameter – During the call, an output parameter does not copy the values of the assigned actual parameter. During the return, the actual parameter copies the current value of the formal parameter.

     "in/out"
Input/output parameter – During the call, an input/output parameter copies the value of the assigned actual parameter and during the return, the actual parameter copies the current value of the formal parameter.

If you do not specify kind, then the formal parameter is by default an input/output parameter.

Use the additions s-val and d-val or valto assign a replacement value to any of the input parameters; specify the values as ABAP values. If no current parameter is assigned to an input parameter, it is set to the replacement value. s-val only takes effect during serialization, d-val only takes effect during deserialization, and val takes effect during both serialization and deserialization. You cannot assign replacement values to output parameters and input/output parameters.

 

Example

The transformation below demonstrates how parameters are passed to a called transformation. The same example is used for subtemplates in the tt:apply statement.

 

The transformation below has three parameters PARA1, PARA2 and PARA3.

 

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:parameter kind="in" name="PARA1" val="4"/>
  <tt:parameter kind="out" name="PARA2"/>
  <tt:parameter kind="in/out" name="PARA3"/>

  <tt:template>
    <tt:assign to-var="PARA2" var="PARA3"/>
    <tt:assign to-var="PARA3" var="PARA1"/>
    <tt:assign to-var="PARA1" val="555"/>
  </tt:template>

</tt:transform>

 

It can be called from the transformation below:

 

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:variable name="VARI1" val="1"/>
  <tt:variable name="VARI2" val="2"/>

  <tt:variable name="VARI3" val="3"/>

  <tt:template>
    <tt:call transformation="...">

      <tt:with-parameter name="PARA1" var="VARI1"/>
      <tt:with-parameter name="PARA2" var="VARI2"/>

      <tt:with-parameter name="PARA3" var="VARI3"/>
    </tt:call>
    <X1>

      <tt:write var="VARI1"/>
    </X1>
    <X2>
      <tt:write var="VARI2"/>
    </X2>

    <X3>
      <tt:write var="VARI3"/>
    </X3>
  </tt:template>

</tt:transform>

 

The result of the calling transformation is:

 

<X1>1</X1>
<X2>3</X2>
<X3>1</X3>

 

The input parameter PARA1 is changed in the called transformation, but the changed value is not passed back to the actual parameter VARI1.

The output parameter PARA2 is set to the value of actual parameter VARI3, which is passed to the called transaction, and this value is returned to the actual parameter VARI2.

The input/output parameter PARA3 is set to the value of actual parameter VARI1, which is passed to the called transaction, and this value is returned to the actual parameter VARI3.

 

 

End of Content Area