Skip to Content
avatar image
Former Member

Variable substitution

Hi all,

I have problem concerning variable substition in the file receiver CC. My scenario is IDoc to file.

I just want to add the delivery no of my IDoc to the filename.

This is my config:

File Name Scheme: %VBELN%.txt

Variable substitution enabled:

Variable Name: VBELN

Reference: payload:DELVRY03,1,IDOC,1,E1EDL20,1,VBELN,1

I send following IDoc XML schema:

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

<DELVRY03>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1">

<TABNAM>EDI_DC40</TABNAM>

<MANDT>150</MANDT>

<DOCNUM>0000000000001003</DOCNUM>

<DOCREL>40B</DOCREL>

<STATUS>30</STATUS>

<DIRECT>1</DIRECT>

<OUTMOD>2</OUTMOD>

<IDOCTYP>ZINSPLOT01</IDOCTYP>

<MESTYP>ZINSLOT</MESTYP>

<SNDPOR>SAPDEV</SNDPOR>

<SNDPRT>LS</SNDPRT>

<SNDPRN>SAPDEV</SNDPRN>

<RCVPOR>A000000001</RCVPOR>

<RCVPRT>LS</RCVPRT>

<RCVPRN>SAPXI</RCVPRN>

<CREDAT>20060911</CREDAT>

<CRETIM>144527</CRETIM>

<SERIAL>20060911144527</SERIAL>

</EDI_DC40>

<E1EDL20 SEGMENT="1">

<VBELN>020000000266</VBELN>

<PLANT>BE01</PLANT>

<INSPTYPE>03</INSPTYPE>

<TYPEDESCR>In-process insp.</TYPEDESCR>

<ORIGIN>03</ORIGIN>

<CREADATE>20060731</CREADATE>

<CREATIME>121119</CREATIME>

<MATERIAL>Q56836</MATERIAL>

</E1EDL20>

...

</IDOC>

</DELVRY03>

My output file isn't processed in the specified folder.

When I look in Adapter Monitoring. I get the following error:

Message processing failed: 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:1, col:3)

Someone who can help me solve this problem?

Warm Regards,

N.Jain

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 16, 2007 at 12:37 PM

    check this

    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i --> Dynamic File Name using XI 3.0 SP12 Part – I

    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii --> Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 12:38 PM

    Just check this reference payload:DELVRY03,1,IDOC,1,E1EDL20,1,VBELN,1 is correct or not. Because if you put the Upper and lower character change then it will raise the problem.

    Warm Regards,

    vijay

    Message was edited by:

    Gangisetty Vijaya Bhaskarudu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      There is nothing new here. Whatever you have done is correct only.

      May be you check the follwoing:

      Whether you variable is populating the value or not. Pass the deafult value and try it. and one more thing like Please check the nodes and elements names with the your message structure or Data type . Both match the names with Case also. If anything is diffrent then it would make the problem.

      Warm Regards,

      Vijay

  • avatar image
    Former Member
    Aug 16, 2007 at 01:33 PM

    Nishu,

    Is it working if you remove reference to variable and replace it with constant file name? Can you please check..it might be some other error??

    Also try something like this if it is working DEL_%VAR%.txt...i will recommend you to change variable name...do not use tag name from idoc...

    where %VAR% = payload:DELVRY03,1,IDOC,1,E1EDL20,1,VBELN,1

    Try this n let us know the result.

    Nilesh

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 16, 2007 at 01:40 PM

    Hi

    The IDOC field occurencess you have mentioned is fine for what have you defined in the variable substuition, did u change the occurences of the idoc in mapping (Ext definaitaion) as far as the variable subtution is there, the filed is populating the value from IDOC, Kindly check the occurence one more time.

    Regards

    Nisar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      I have checked ur node levels and variable name also seems to be Ok.I have got the smae problem but i couldn't able to recollect the solution ,after changing the sequence ,occurence, it has been solved.

      I thnk the problem with the XMl parsing ,even the error message is saying the same.the sequence is Ok in the variable substituion.Try to test the mapping with single record.

      Regards,

      Srinivas

  • avatar image
    Former Member
    Aug 17, 2007 at 06:39 AM

    Hi Nishu,

    If variable substitution is not working, then try this code in a udf and map source VBELN to target VBELN via this udf

    function(String vbeln, Container container)

    {

    //write your code here

    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

    DynamicConfigurationKey key = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");

    String targetFileName = vbeln + ".txt";

    conf.put(key,targetFileName);

    return vbeln;

    }

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Nishu,

      In this case, what will be your output message structure??? Because in the conversion to flat file using ABAP mapping,i don't know if the output structure can be the same as input.

      When i did the same example once, i used a single output tag in the detination structure..

      Regards

      Varun

  • Aug 17, 2007 at 07:18 AM

    Hi jain

    The IDOC strucuture which have given is the sender structure right? what is the file reciver strucutre, the variable substuition which you are refering is the payload coming from the sender right? By looking into the variable substution it looks like File strucuture is also same as IDOC?

    What is your receiver strucutre? if tha payload you have mentioned in the Variable substution of the Inbound message, then it should work fine.

    regards

    Nisar

    Add comment
    10|10000 characters needed characters exceeded