IDOC to File, variable substitution on outbound message XML tag attributes

My scenario is IDOC to FILE using XSL mappings.The target format is 2 XML tags (header, line) with the data stored in the attributes of each tag.
EG. <header attr1=one attr2=two attr3=three><line attr1=one attr2=two /></header>
The name of the file is dictated by an outbound attribute value in the header tag.
Can I get access to it the attribute in the target message in the CC_FILE using variable substution. ?
Currently I am not using content conversion as the XSL produces the file format needed, so I would pefer not to change the outbound message format/structure as this is going to an external party. I would prefer not to change the outbound format as this would need content conversion to strip the unwanted/information/processing node that is used for this purpose (file naming).
The name is a calculation of fields in the IDOC and is not explicit dictated (business logic is applied in the mapping to get the file name), so I would prefer to use the attribute of the resulting XML to keep the "business logic" in the XSL..
Things that cannot be changed.... 1. Must use XSL.for mapping. 2. Format cannot be changed of the outbound message. 3. Would prefer not to involved content conversion to keep formatting/node structure in the XSL mapping.
I have seen some reference to this being possible on the forums but nothing solid from what Ive read.
Something like var1 = payload:/Header/@attr1 in variable sub to get at the attribute
Any comments ?
Thanks in advance.
One final piece of info. its on a PI 7.1 system.

I think its best explained by my other thread Link:PI 7.1 Access to Dynamic Configuration through Java Class .
Thanks for the link I have already implemented based on that link but the one crucial difference is that it is implemented using a static method with no reference to the actual object (payload) for Dynamic configuration. It seems that without the 7.0 API which isnt available in 7.1 by default XSL with java extentions is limited to static methods. If you could read the other thread it certainly is possible I'm mistaken.

Similar Messages

  • IDOC 2 File, Variable Substitution help required

    Hi guys,
    I'm doing an IDOC to file scenario. I want to make the target directory and the file name to be updated dynamically.
    I don't want to modify the pay load in any way so as to include any extra tags to represent the file name and directory parameters..
    After going through various blogs I have a slight idea that may be this can be achieved by setting these parameters in the message attributes..But i don't know how can i modify the message attribute in the receiver...
    Please can any one help me in achieving this scenario??

    use the idea based upon the blog - /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    use the code specified in your mapping and alter it to get your file name dynamic.
    Ref: http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm

  • Variable substitution in error message

    I'm trying to create a document that contains generic error messages in a module used by different projects. I intended to share the messages by including them as a variable substitution within the error message e.g.:
    Error("%message_dob_in_future%") but all I get out in the error message is the stuff between the quote marks (i.e. %message_dob_in_future%).
    I presume that variable substitution doesn't work in error or warning messages? If not, any chance of including it in the future?

    Hi Matthew
    You should be able to use a screen label to achieve the same functionality. Just add the label to the screen on which you want it to appear, substitute in the attribute value, and format it to look like an error.
    Does that help?
    Fiona

  • IDOC to File (BYpass)-- Error or Warning  :  " Message Branched. "

    HI all,
    Iam trying idoc to file scenario(bypass)
    my idoc is triggered succesfully and it is reaching to the receiver system.
    but the problem is in SXMB_MONI ,it is not showing my Receiver service details and showing with different symbol like " <b>>></b>  " with message as " MESSAGE BRANCHED".
    what might be the problem....???
    Also Idoc reaching to the receiving system very lately.
    Pls suggest me ASAP..
    Thanks in Advance.
    Regards,
    Vijji

    In the receiver determination, do you have multiple receivers, i.e , is the same idoc being sent to multiple receivers ?
    If yes, then the message branch is used to split the source message so that it can be send to differetn targets. You will find multiple entires below the Slit Message Entry one for each receiver.
    Regards
    Bhavesh

  • Validation of outbound FIle with respect to outbound Message type

    Hi Experts,
       I have file system at outbound side and defined the Data Type, Message Type for this. Now a want to validate the outbound file against the Message type structure i have defined. Now if the file is not validated against Message type, i want to create the log file that will explain what were the errors in the outbound file and move the file to other archive else send it to inbound system.
    Plz suggest the solution.
    Thanks and regards,
    Vishal

    This is the best document for starting on Adapter Modules,
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75a6a">How To Create Modules for the J2EE Adapter Engine</a>
    Example Adapter Module,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/e9/61e1407e858031e10000000a1550b0/content.htm
    Regards
    Bhavesh
    PS : Do a search on SDN. For instance, look into the How To gudies Section on the XI home page.You will find most of the documents available here.

  • File to file with out message mapping and using variable substitution

    Hi,
    Can any one send me a scenario where we can have file to file scenario with out message mapping and where i can use variable substitution.
    As of now i am using integrate configurations where i cant use variable substitution as the message does not reflect in integration engine. I need to populate time stamp between <filename><timestamp>.txt.pgp
    I am as of now using configuration scenario.
    The time stamp always writes before the last file extension.
    Let me know your thoughts?
    Thanks,
    Chandra.

    Hi Chandra,
    u can use the Variable substitution even without IR contents also(Mapping....).
    in the receiver communication channel just specify the path u want to access for a value...
    eg: filename                             payload:mt_name,1,records,1,name,1
    and in th file name give it as %filename%.txt... or vt ever ur requirement
    Babu

  • How  we can mention varible substitution for diffrent message payloads

    Hi,
    How  we can mention varible substitution for diffrent message payloads,
    My sceanrio like following,
    According the Outbound idoc message,based on the condition the messages to be split into 9 diffrent files.The sender message may or may not satisfied the condition to one or two messages or  all messages.
    I done the mapping 1:N multimapping in messagemapping & Interface mapping too.
    In reciever file adapter i put the variable substiution like as fallows.
    Variable            Refrence
    Name--            -
    Filename -- payload:message_type_1,1,Segment1,1,Segment2,1,Field_1,1
    <b>How we can mention variable substitution for remaining messages in the same communication channel.my message type names are diffrent for all 9 messagetypes.</b> Any ideas pl forward..,
    When i am testing this scenario,able to processing a one file but the file is not placed in the specified target & gives the follwing error:
    'Conversion configuration error: Unknown structure 'ns1:message_type_2' found in document', probably configuration error in file adapter (XML parser error)'.The file is
    In this case Idoc data satisfied the one message condition only.
    If any ideas & suggestions ..?

    Hi Anjan
    You could always put the "FileName" and "Directory" names into the Dynamic Configuration using a UDF in the map - possibly using a value mapping table to determine the correct values. Then simply reference "%Directory%" and "%FileName%" in the file adapter.  This way you do not have to reference payload variables and you set the names in the map. You will need to tick the box for "use adapter specific message attributes" in the file adapter. you UDF code will look something like
    String dir = "/path";
    String fil = "filename.txt";
    DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    conf.put(key,dir);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    conf.put(key,fil);
    - Stephen

  • Query reg Variable Substitution with enhanced interface mapping

    Hi All,
      The scenario is IDoc to file using enhanced interface determination (message split based on some conditions) and the output file name should be based on a field value in the  IDoc. So, I've tried using Variable Substitution Option in the receiver file adapter. But it's failing with the error 'com.sap.aii.adapter.file.varsubst.VariableDataSourceException'. 
    My question is does Variable Substitution works with Enhanced Interface Determination? Bcoz the outcome of interface determination is a main and sub payload.
    IDoc Payload
    <?xml version="1.0" encoding="utf-8" ?><HR_HRMD_A07><IDOC BEGIN="Constant"><E1PLOGI SEGMENT="Constant">
    <E1PITYP SEGMENT="1"><E1P0000 SEGMENT="1"><ENDDA>99991231</ENDDA></E1P0000></E1PITYP></E1PITYP></E1PLOGI></IDOC></HR_HRMD_A07>
    Variable Substitution XPATH, which I've mentioned is payload:HR_HRMD_A07,1,IDOC,1,E1PLOGI,1,E1PITYP,1,E1P0000,1,ENDDA,1
    Thanks in advance.
    Regards,
    Joe.

    Hi,
    It was the problem with the capital letters for the variable field. We changed it to small letters, then the issue is resolved.
    Thanks,
    Joe.

  • Problem in variable substitution

    Hi experts,
    I need help for a strange problem:
    I have a proxy to file scenario in which I create an xml file; I need to use a field of the mapping to create filename.
    In Receiver CChannel I have used variable substitution, but in message monitoring I got this error:
    Delivery of the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: Folio: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: Folio.
    FileName Scheme is: DM65_%Folio%.xml
    In variable substitution I have used this reference:
    Folio =    payload:MT_MexicanElectronicInvoice_MyFirm,1,CABFAC,1,Folio,1
    This is the payload of the message that ends in error:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_MexicanElectronicInvoice_MyFirm xmlns:ns0="urn:MyFirm-EDICOM:MexElectronicInvoice">
    - <CABFAC>
      <IdLabel>CABFAC</IdLabel>
      <Version>3.0</Version>
      <Folio>2100000003</Folio>
      <FecHac>16-11-2011 17:11:17</FecHac>
      <FPago>Advance payment</FPago>
      <Subtotal>9.976,00</Subtotal>
      <TotalFac>11.568,16</TotalFac>
    What is the problem? wrong reference?
    thanks
    Fabio

    Hi,
         Everything looks fine.
    Make sure that there is no extra space after your "%Folio%" under the Variable Substitution.
    Make sure that "Adapter Specific message Attributes" is unchecked in the CC.
    You can do a change in message mapping to create a header field<occurence: 1> map to a constant and call it in var substitution.
    As Mickael suggested above make sure using only lowercase on your variant name  %folio% instead of %Folio%.
    For 1:N muti-mapping with variable substition go through the below links:
    Re: 1: N File Scenario..
    Using Variable Substitution
    i hope it will help you.
    regards,
    ganesh.

  • How to eliminate empty tags in out put XML file in IDOC to File scenario

    Hi Experts,
    I am doing IDOC to File scenario.
    My Out put XML is in to FTP is as below
    <ITEMS>
        <item>
              <A>asdf<A>
              <B>GHIJ<B>
        </item>
        <item>
              <A>123<A>
              <B>G098<B>
        </item>
    </ITEMS>
    <ITEMS/>   -
    > Means no data
    <ITEMS/> -
    > Means no data
    <ITEMS>
        <item>
              <A>yyy<A>
              <B>zzz<B>
        </item>
        <item>
              <A>arrr<A>
              <B>Ghhh<B>
        </item>
    </ITEMS>
    Now I want to eliminate tages <ITEMS/> in out out put XML file ( PIwhich writes in File server).
    1) Is there any setting in communication channel to do this
    2) Is there any settings in Mapping proram to suppress parent tag if child tags are not available.
    I want output as below .
    <ITEMS>
        <item>
              <A>asdf<A>
              <B>GHIJ<B>
        </item>
        <item>
              <A>123<A>
              <B>G098<B>
        </item>
    </ITEMS>
    <ITEMS>
        <item>
              <A>yyy<A>
              <B>zzz<B>
        </item>
        <item>
              <A>arrr<A>
              <B>Ghhh<B>
        </item>
    </ITEMS>
    Thanks,
    Subbu

    items->mapwithdefalut(just empty in the value)-> euqals(check with empty constant)->not->createif->target node
    and make sure that as Ravi kanth said ...occurance is  min is 0 at target side
    Regards,
    Prasad.
    Edited by: PRASAD KONDA on May 21, 2009 1:50 PM

  • Checking .txt file with valid XML tags

    hey guys,
    I've a .txt file which conatins info with XML tags. I've to check whether the file contains valid tags or not!
    a tag should start with "<" and end with ">", there shouldn't be space between characters after "<" e.g.
    a tag should be like "<name>" or "</name>" not "< name>" or  "< /name>" nor "<name" or "</name"nor "name>" or  "/name>"Here is an example of a well formed XML document:
    <root>
    Some text <nextTag> more text  <secondTag> stuff </secondTag> </nextTag> more text again
    </root>Here is an example of XML .txt file:
    <students >
         <student>
              <name> John </name>
              <name> Doe </name>
              <address> 98 Pine St.</address>
         </stdnt>
    </students>I also have to make sure that no text appears before and after the root tag! Please help me, i'm trying to figure out but my alogrithm just doesn't work! Thanks in advance!!!

    What's the purpose of those requirements? If you
    wanted to check whether the file was well-formed XML
    then you would just need to run it through an XML
    parser. But some of the things you plan to reject are
    actually well-formed XML. I don't see the point of
    that.basically, it's my assignment. In the assignment our task is to check the .txt files to make sure that all XML tags are valid. The problems i mentioned in my first post, i've figured those out, eventually. There're few other things which i've to also make sure for example no text appearing before and after the root tag
    Can someone please tell me how i can check following cases:
    text<root> or </root> text  (both are invalid XML files)

  • Variable substitution in receiver comm channel idoc - file

    Hello all,
    I have a error message in mys sytem XI for creating a file because I would like a file name create dynamically and use an info in this idoc providing system SAP.
    And this variable substitution I put file name schema %var1% and variable substitution
    var1 payload:ZBBPIV01,1,IDOC,1,E1BIVHD,1,IV_ID,1 and I have this message error
    and I set Disable security checks in my communication channel
    <b><?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIAdapterFramework</SAP:Category>
      <SAP:Code area="MESSAGE">GENERAL</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.MessagingException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var1: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var1</SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack />
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error></b>
    Thanks for your help

    Hi,
    <b>ZBBPIV01,1,IDOC,1,E1BIVHD,1,IV_ID,1</b>
    Check if the target XML Contains a Field called <b>IV_ID</b> and does it have any value?.
    Btter option is to use Adapter Specific Attributes and the code excert in this link,
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Regards
    Bhavesh

  • Error during variable substitution: idoc to file

    Hi Friends,
    I have a got a issue which is Idoc to file scenario.
    Iam getting the following error.
    Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: date_processing
    Could you please tell me waht could be the reason for the same?
    as per my analysis, I observed that the field date_processing has been declared

    Hi Sandeep ,
    If the variable ’date_processing’ refers to an element in XML schema, Please check  if you have added  the prefix payload: to the information under Reference.
    The reference then comprises a pseudo path description in the form of a comma-separated list with the schema namea,na,nameb,nb,....
                Where namea,nameb,... corresponds to the element name and na,nb,... corresponds to the occurrence of the element name at the respective level in the document.
    The description begins at the root of the document and ends at the respective element.
    Also please check
    Re: Variable substitution
    Regards,
    Jyoti

  • IDoc to File - IDoc number : Variable substitution in File Adapter

    Hi,
    I have an IDoc to File scenario. I want to use the IDoc Number as part of the target filename (using variable substitution) in the File Adapter. However, the target flat file does not have a field where I can store the IDOC number. I know the IDoc number is also stored in the message header ( under the IdocInbound tab), but is there any way I can access this in the variable substitution?
    Failing this, if I have the Idoc number in the target XML, is there any way I can skip it in the flat file generated?
    example...
    XML looks like this...
    <Root>
    <Record>
       <IdocNum>99999</IdocNum>
       <HeaderRecord>
       </HeaderRecord>
       <LineRecord>
       </LineRecord>
       <LineRecord>
       </LineRecord>
    </Record>
    </Root>
    But the flat file should be..
    HeaderRecord...
    LineRecord...
    LineRecord...
    Cheers
    Manish

    Hi Chandra,
    Thanks for this
    But this is standard stuff that is detailed in SAP help files (http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm)
    What I was looking for was in Sravya's blog (refer the earlier entry).
    Thanks anyway
    Cheers
    Manish

  • Receiver File Adapter:Variable substitution :FATAL  ERROR

    HI all
    as per the previous thread :
    <b>Receiver File Name Variable Substitution :payload: Fatal Error
    in our idoc to file sceanrio, we are using simple <b>graphical mapping.</b>
    for dynamic file name , variable field is at <b>Target message type</b>,So  on using <b>Variable substitution</b>, again the error is same :
    SAXException while parsing XML payload: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) .
    <b>Our XI  Component version : 2004
    WAS 6.4 SP 15</b>
    Thanks
    AR

    Ashutosh,
       There is nothing to do with your mapping programs. Its the mistake in ur reciever file adapter configuration for variable substitution.I asked u whether u changed message mapping in order to implement the UDF!!
    Did u tried checking the audit log. Ok just to see where u are going wrong, instead of using Payload :... in Variable substitution use Message:..... and give some interface name so that to check whether the file is created with Interface name.
    Juz give a try!!!
    Best regards
    raj.

Maybe you are looking for