cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Dynamic Configuration in XSLT mapping..!!

Former Member
0 Kudos

Hi friends,

Working first time with xslt map.I am doing a Idoc to File scenario in which I need to pass Idoc number as the file name dynamically. Right now I am just trying to send some constant value 'ABCD' to go in dynamic attribute filename.

I used the code which has been provided over here.

[http://help.sap.com/saphelp_nw04/helpdata/en/43/03fe1bdc7821ade10000000a1553f6/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/43/03fe1bdc7821ade10000000a1553f6/frameset.htm]

I just changed the "Directory" with "FileName" in the code. It is not generating the dynamic attribute http://sap.com/xi/XI/System/File

This is my xsl code. Please suggest me If iam doing anything wrong.

-


<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:map="java:java.util.Map" xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration" xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">

<xsl:output indent="no"/>

*<xsl:param name="inputparam" select = "ABCD"/>*

<xsl:output method="text" encoding="utf-8"/>

<xsl:template match="/">

<!-- change dynamic configuration -->

<xsl:variable name="dynamic-conf" select="map:get($inputparam, 'DynamicConfiguration')"/>

*<xsl:variable name="dynamic-key" select="key:create('http://sap.com/xi/XI/System/File', 'FileName')"/>*

<xsl:variable name="dynamic-value" select="dyn:get($dynamic-conf, $dynamic-key)"/>

<xsl:variable name="new-value" select="concat($dynamic-value, 'subfolder\')"/>

<xsl:variable name="dummy" select="dyn:put($dynamic-conf, $dynamic-key, $new-value)"/>

<!-- copy payload -->

<xsl:copy-of select="."/>

</xsl:template>

<xsl:template match="/">

-


Waiting for your answers.

Thank you.

Deepthi.

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

The example from online helps reads a value from dyn. config. and changes the value.

When you just want to write a value, do like this:

<xsl:param name="inputparam" />

 <xsl:param name="new-value">
  <xsl:value-of select="?IdocNumer?" /> 
  </xsl:param>

<xsl:variable name="dynamic-conf" select="map:get($inputparam, 'DynamicConfiguration')" /> 
  <xsl:variable name="dynamic-key" select="key:create ('http://sap.com/xi/XI/System/File', 'FileName')" /> 
  <xsl:variable name="dummy" select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" />

Instead of ?IdocNumer? put the XPATH of that value.

Former Member
0 Kudos

Hi Stefen,

I tried the way you suggest but still I couldn't able to see the Dynamic Configuration attribute in SOAP document. I tried for Idoc number and even tried by passing just a value 'abcd' like below.

-


<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:map="java:java.util.Map" xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration" xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">

<xsl:output indent="no"/>

<xsl:output method="text" encoding="utf-8"/>

*<xsl:param name="inputparam"/>*

*<xsl:param name="new-value">*

*<xsl:value-of select="/WMMBID01/IDOC/EDI_DC40/DOCNUM" />*

*</xsl:param>*

<xsl:template match="/">

<!-- change dynamic configuration -->

<xsl:variable name="dynamic-conf" select="map:get($inputparam, 'DynamicConfiguration')"/>

<xsl:variable name="dynamic-key" select="key:create('http://sap.com/xi/XI/System/File', 'FileName')"/>

<xsl:variable name="dummy" select="dyn:put($dynamic-conf, $dynamic-key, $new-value)"/>

-


<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:map="java:java.util.Map" xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration" xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">

<xsl:output indent="no"/>

<xsl:output method="text" encoding="utf-8"/>

*<xsl:param name="inputparam"/>*

*<xsl:param name="new-value" select="abcd">*

*</xsl:param>*

<xsl:template match="/">

<!-- change dynamic configuration -->

<xsl:variable name="dynamic-conf" select="map:get($inputparam, 'DynamicConfiguration')"/>

<xsl:variable name="dynamic-key" select="key:create('http://sap.com/xi/XI/System/File', 'FileName')"/>

<xsl:variable name="dummy" select="dyn:put($dynamic-conf, $dynamic-key, $new-value)"/>

Any suggestions please.

Thanks

Deepthi.

stefan_grube
Active Contributor
0 Kudos

The only difference I see to my mapping is the line

<xsl:template match="/">

which is above the parameter statement like this:

<xsl:template match="/">

<xsl:param name="new-value">
<xsl:value-of select="/WMMBID01/IDOC/EDI_DC40/DOCNUM" />
</xsl:param>

Are you working with PI 7.1? Then you have also to set parameter "use sapxmltoolkit" in operation mapping.

Former Member
0 Kudos

Hi Stefan,

I am working on PI 7.0. I made the change which you suggested and still no use

Here is the main code. Please help me whether I am doing anything wrong.

-


<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:map="java:java.util.Map" xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration" xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">

<xsl:output indent="no"/>

<xsl:output method="text" encoding="utf-8"/>

*<xsl:param name="inputparam"/>*

*<xsl:template match="/">*

*<xsl:param name="new-value">*

*<xsl:value-of select="/WMMBID01/IDOC/EDI_DC40/DOCNUM" />*

*</xsl:param>*

*<!-- change dynamic configuration -->*

<xsl:variable name="dynamic-conf" select="map:get($inputparam, 'DynamicConfiguration')"/>

<xsl:variable name="dynamic-key" select="key:create('http://sap.com/xi/XI/System/File', 'FileName')"/>

<xsl:variable name="dummy" select="dyn:put($dynamic-conf, $dynamic-key, $new-value)"/>

</xsl:template>

<xsl:template match="/">

<xsl:apply-templates select="/WMMBID01/IDOC/E1MBXYH"/>

<xsl:apply-templates select="/WMMBID01/IDOC/E1MBXYH/E1MBXYI"/>

</xsl:template>

<xsl:template match="E1MBXYH">HEADER:<xsl:value-of select="USNAM"/>;<xsl:value-of select="BKTXT"/>

</xsl:template>

<xsl:template match="E1MBXYI">

ITEM:<xsl:value-of select="MATNR"/>&gt;WERKS<xsl:value-of select="WERKS"/>;My constant

<xsl:value-of select="/WMMBID01/IDOC/EDI_DC40/SNDPRN"/>

</xsl:template>

</xsl:stylesheet>

-


Thanks

Deepthi.

Edited by: deepthi reddy on Feb 9, 2009 12:54 AM

Former Member
0 Kudos

Hi

I am XSL newbie - so apologies if this is a silly question:

How would the XSL code look like if you only wanted to retrieve the filename and use it in your mapping? Can anyone show me an example of that

Cheers

Former Member
0 Kudos

Hi,

in ID in reciver file comm channel, have you checked the Adapter specific msg attributes and checked the FileName option...........

Regards,

Rajeev Gupta