cancel
Showing results for 
Search instead for 
Did you mean: 

issue in Dynamic file name

Former Member
0 Kudos

hi experts,

My scenario is IDOC to Flat file in which IDOC is converted to a flat file using XSLT mapping and sent to FTP location.

but the file name should be a field value of IDOC. FOr that i m using variable subtitution at receiver channel.

My IDOC structure is

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

thanks

Former Member
0 Kudos

thanks

varun_k
Contributor
0 Kudos

Hi Jaideep Baid,

As you are doing IDOC to FLAT FILE, and if u want to use Variable Substitution, Always remember that Variable Substitution should be defined for Target Structure.

As receiver is FLAT FILE and you want to fetch the Value from the Source Structure, then Use Dynamic Configuration and Enable ASMA

Regards,

Varun

Edited by: Varun Reddy on Mar 13, 2009 10:48 AM

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

You can either store the filename in a field in the receiver message and use variable substiution or use the Dynamic configuration UDF to set the filename. To do dynamic config using xslt refer this http://help.sap.com/saphelp_nw04/helpdata/en/43/03fe1bdc7821ade10000000a1553f6/content.htm

Thanks,

SaNv...

Former Member
0 Kudos

hi Experts,

My scenario is IDOC to Flat file in which IDOC is converted to a flat file using XSLT mapping and sent to FTP location.

but the file name should be a field value of sender IDOC. For that i am using Variable subtitution at receiver file channel.

My IDOC structure is :-

<SHPMNT04>

<IDOC Begin="">

<EDI_DC40 Segment="">

<TABNAM>

<MANDT>

<DOCNUM>

<>......

here DOCNUM should be file name of receiver flat file.

I am giving file name is

output%var%_.txt

In Variable substitution table values are

variable name-------var

reference -


payload:SHPMNT04,1,IDOC,1,EDI_DC40,1,DOCNUM,1

But i m getting error is :--

Could not process due to error: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Caught SAXException while parsing XML payload: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 45, 44, 49(:main:, row:3, col:9)

Please help me out.

Thanks

Jaideep Baid

santhosh_kumarv
Active Contributor
0 Kudos

Hi Jaideep,

You can use Variable substitution only from the values from the receiver payload. If you requirement is to set the file name from the sender payload then the only option is using Dynamic Configuration.

You can create a UDF to set the file name using dynamic configuration and call this Java UDF from XSLT mapping program. Refer this link to call a Java function from XSLT mapping http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm.

Thanks,

SaNv...

Former Member
0 Kudos

hi santhosh,

My output structure is Flat file, So i can't use variable substitution.

SO i will have to take from source structure.

Let me please tell if there is any way..

Thanks

Jaideep

jyothi_anagani
Active Contributor
0 Kudos

Hi,

Store that field name into a STRING in Source side variable ,and mapp that variable to target side variable and use Variable Substituation...

Thanks.

Former Member
0 Kudos

hi jyothi,

As my output file is FLAT file which has no XML structure, So i can not pick value from receiver file.

I will have to fetch from sender IDOC.

Thanks

Jaideep

former_member750652
Contributor
0 Kudos

Hi Jai,

The following thread speaks the same issue, As your case also deals with flat file on target side with XSLT mapping .This link will help you out.Refer the reply by micheal.

Thanks,

Ram.

Former Member
0 Kudos

hi ram,

Thanks for your response.

I tried same thing my req. is to retrive a fiels value from input IDOC and append that value in output flat file name.

I tried below code in my XSLT mapping:--

<!--xsl:param name="UniqueID">
		<xsl:value-of select="/SHPMNT04/IDOC/EDI_DC40/DOCNUM"/>
	</xsl:param-->


	
	<xsl:template match="IDOC">
		<!-- change dynamic configuration -->
    <!--xsl:variable name="dynamic-conf"  
        select="map:get($UniqueID, '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, 'syng204rydtm.')" />
    <xsl:variable name="dummy" 
        select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" /--> 
		<xsl:apply-templates/>
	</xsl:template>

Error i got is :--

avax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Illegal number of arguments or types of arguments in a call of function 'map:get'. at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:251)

Please help me out.

Thanks

Jaideep Baid

Shabarish_Nair
Active Contributor
0 Kudos

the best is to enhance your existing XSLT mapping to accommodate Dynamic configuration;

store the docnum in a variable and set that value as the filename.

ref:

http://help.sap.com/saphelp_nw04/helpdata/en/43/03fe1bdc7821ade10000000a1553f6/content.htmmake sure

make sure you have declared;

<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">

Former Member
0 Kudos

hi Shabarish,

I have modified code as u told.

<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:http://testdevsyngenta.com" 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:variable name="UniqueID">
		<xsl:value-of select="/SHPMNT04/IDOC/EDI_DC40/DOCNUM"/>
	<xsl:variable-->

	<xsl:template match="/">
		<!-- change dynamic configuration -->
    <!xsl:variable name="dynamic-conf"  
        select="map:get($UniqueID, '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, 'syng204rydtm.')" />
    <xsl:variable name="dummy" 
        select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" /> 
</xsl:template>

Still I m getting same error

Call XSLT processor with stylsheet MM_SHPMNT04_To_FlatFile.xsl.

TransfromerException during XSLT processing:

javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Illegal number of arguments or types of arguments in a call of function 'map:get'.

Please help me out

Thanks

Jaideep

Shabarish_Nair
Active Contributor
0 Kudos

are you testing this end to end?

please note that the values will get filled only during runtime and not via an independent test.

Former Member
0 Kudos

yes Sabharish

Former Member
0 Kudos

actually error i m getting is function map:get

Illegal number of arguments or types of arguments in a call of function 'map:get'

Thanks

Jaideep Baid

siddhesh_pathak4
Contributor
0 Kudos

Please verify the parameters that you are passing in function call map:get.