Skip to Content
0
Former Member
Feb 04, 2014 at 08:24 PM

Simple Transformation - Format Output

845 Views

Hello guys,

I have created a transformation and I'm facing a problem to format the output of numeric attributes.

My requirement is: the decimal separator needs to be comma (",") instead dot (".") and the XML output needs to be with 2 decimals places (as is in structure definition).

My dictionary structure:

Field NameTypeLenghtDecimalsCLIENTCHAR100EMPRESCHAR140INDCNPNUMC10TICKETCHAR500ACAOCHAR80TAREFACHAR150DATENVCHAR100HORENVCHAR50USUENVCHAR150USUBPOCHAR300REQMSGSTRING00INDIDENUMC10DATPROCHAR100HORPROCHAR50NREQIDNUMC150NREQDPCHAR150MESCOMNUMC20ANOCOMNUMC40CODFOLNUMC40NROPFLCHAR60IDEMPRCHAR150VLANFLDEC112NROHRADEC32

My simple transformation:

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined">

<tt:root name="ROOT" type="?"/>

<tt:root name="RECORD" line-type="ddic:Z8H_ADP_TSK_LAUNCHES_DELETE"/>

<tt:template name="XALIAS0">

<root>

<tt:loop ref=".RECORD">

<record>

<client tt:value-ref="CLIENT"/>

<empres tt:value-ref="EMPRES"/>

<indcnp tt:value-ref="INDCNP"/>

<ticket tt:value-ref="TICKET"/>

<acao tt:value-ref="ACAO"/>

<tarefa tt:value-ref="TAREFA"/>

<datenv tt:value-ref="DATENV"/>

<horenv tt:value-ref="HORENV"/>

<usuenv tt:value-ref="USUENV"/>

<usubpo tt:value-ref="USUBPO"/>

<reqmsg tt:value-ref="REQMSG"/>

<indide tt:value-ref="INDIDE"/>

<datpro tt:value-ref="DATPRO"/>

<horpro tt:value-ref="HORPRO"/>

<nreqid tt:value-ref="NREQID"/>

<nreqdp tt:value-ref="NREQDP"/>

<mescom tt:value-ref="MESCOM"/>

<anocom tt:value-ref="ANOCOM"/>

<codfol tt:value-ref="CODFOL"/>

<nropfl tt:value-ref="NROPFL"/>

<idempr tt:value-ref="IDEMPR"/>

<vlanfl tt:value-ref="VLANFL"/>

<nrohra tt:value-ref="NROHRA"/>

</record>

</tt:loop>

</root>

</tt:template>

</tt:transform>

My output:

<root>

<record><client>134566</client>

<empres>0000000</empres>

<indcnp>1</indcnp>

<acao>Gravar</acao>

<tarefa>EXCLUI_LAN</tarefa>

<datenv>03/02/2014</datenv>

<horenv>17:02</horenv>

<usuenv>RENAN</usuenv>

<usubpo>WEBSERVICE</usubpo>

<indide>2</indide>

<nreqid>000000000016591</nreqid>

<mescom>03</mescom>

<anocom>2013</anocom>

<codfol>0040</codfol>

<vlanfl>3635.0</vlanfl>

</record>

</root>


If anyone have suggestions, will be welcome.

Thanks in advance.