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

Similar Messages

  • 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

  • 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.

  • Inbound Delivery Idoc- Create ... help required

    Hi,
    I'm using DELVRY01 idoc to create deliveries. when i execute using test tool, the idoc gets created with error status 51 with following errors:
    Field EXIDV empty
    Message no. VL243
    Diagnosis
    A required field in the intermediate document (IDoc) is not filled. This is the field EXIDV in segment 000042.
    Field VHILM empty
    Message no. VL243
    Diagnosis
    A required field in the intermediate document (IDoc) is not filled. This is the field VHILM in segment 000039
    But these errors reflect to handling unit from segment E1EDL37 and its sub nodes which are really NOT required in my case.
    Now confused if i'm using a wrong reference of creating inbound delivery. Pls shre some thoughts on it on troubleshooting this issue.

    Hi Prabhu
    these two fields are mandatory .. fill below details
    E1EDL37-Handling unit header
    EXIDV     <XXXXXXXXXXXXX>     External Handling Unit Identification
    GWEIT     <LB>             Weight Unit Tare
    BRGEW     <000XX>                             Total Weight of Handling Unit
    VHILM     <Dummy Packing Material>     Packaging Materials
    E1EDL44-IDoc: Handling Unit Item (Delivery)
    VBELN     <Delivery nO>     Sales and Distribution Document Number
    POSNR     <900004>     Item number of the SD document
    EXIDV     <XXXXXXXXXXXXX> External Handling Unit Identification
    VEMNG     <00001>     Base Quantity Packed in the Handling Unit Item
    Dont forget to create Dummy packing material no...
    i think above mapping helps you...
    Thanks
    Ramesh

  • PCR to read the variable-Urgent help required

    Dear Experts,
    I'm trying to read a variable in a pcr and tried many ways however NOT been successful
    so far hence seeking your help
    I have a WT( 5115) in infotype 15 and I would like the amount to transferred to a varibale and read it in the
    further PCRs.
    PCR1 --> Creating the variable
    5115
    ADDWT&9TMP
    ADDWT *
    PCR2--> Reading the value of the variable
    5115
    AMT=& 9TMP( One space between & and 9TMP)
    AMT?0 -> If the variable exists?)
    =
      AMT= 5008( another wage type)
      ADDWT 5308( new wage type only for passing the value from 5008 to 5308)
      GCY PCR3( another rule to be processed if WT 5115 exists)
    However PCR2 is not getting processed at all for WT 5115.
    Please suggest to help resolving this issue.
    Thanks,
    Poonam

    Dear Remi,
    In case of retro termination following is happening-->
    For retro month( of termination) eg. 08/2014( emp retro terminated effective 27/08/2014 however termination is done in the month of 09/2014)--> PCR is running for decision PPPAR A=A and calculation is done
    For the payroll period ie. 09/2014--> PCR is running for decision operation PPPAR R=R
    Hence the PCR is running twice. I would only like the PCR to be run for the payroll period only.
    Can you suggest what changes should I make in the PCR given below-->
    ZEOF Personnel Calculation Rule  VAR 9TMP
          5008 ESB Calculation Salary
            PPPAR A    Termination in mnth?
                PPPAR R    WCenter inactive/PP?
                    PPPAR F    Term.at end of per.?
                      F
                  R
                    AMT=& 5113 Set
                    AMT?0      Comparison
                        AMT-  5008 Subtraction
                        AMT?0      Comparison
                          <
                            FILLF NRA  Fill amt/no/rate
                            ADDWTE5308 RT   Results table
                            ADDWT *    OT   Output table
                          =
                            FILLF NRA  Fill amt/no/rate
                            ADDWT *    OT   Output table
                          >
                            FILLF NRA  Fill amt/no/rate
                            ADDWTE5208 RT   Results table
                            ADDWT *    OT   Output table
                      =
                        FILLF NRA  Fill amt/no/rate
                        ADDWTE5308 RT   Results table
              A
                AMT=& 5113 Set
                AMT?0      Comparison
                     AMT-  5008 Subtraction
                     AMT?0      Comparison
                                 <
                                   ADDWTE5308 RT   Results table
                                   FILLF NRA  Fill amt/no/rate
                                   ADDWT *    OT   Output table
                                 =
                                   FILLF NRA  Fill amt/no/rate
                                   ADDWT *    OT   Output table
                                  >
                                   ADDWTE5208 RT   Results table
                                   FILLF NRA  Fill amt/no/rate
                                   ADDWT *    OT   Output table
                  =
                    AMT=  5008 Set
                    ADDWTE5308 RT   Results table
                    FILLF NRA  Fill amt/no/rate
                    ADDWT *    OT   Output table
    Please note that WT 5008 is an accural total wage type and exists in every month. However I see that there is NO retro happening for this wage type in the system in case of retro termination. Can that be an issue? Logically retro should run for this WT for Retro termination and it should not exists for the payroll period after termination??
    Thanks,
    Poonam

  • File to File Scenario. Help required

    Hi All,
    I have to make file to file scenario.
    XI will pick file from File Sender System and put file at
    File Receiver System. From there file will go to printer.
    File name has to be constant at receiveing system like "ABC.txt"
    There is one condition:
    Now suppose there is file at Receiver system and Printer gets jammed so file will not be picked from Receiver system.
    At that time XI should not send 2nd file and should wait till the
    receiving file directory is empty again.
    How to implement the above condition.
    Pls suggest.

    Hi ,
    I think in this case, you should not depend on retrial feature of File adapter. if we use it there will lot of uncertainities and sometime we might have to manual go and start the adapter if maximum retry no..is achieved. hence to tackle the situation in better way , I think on receiver side we should have two directory
    lets call it working directory and final directory.
    When we are send file from source, Xi should keep on putting created file on receiver side in working directory. I believe we should not disturb normal flow of XI here. Once files are created in working directory, there should be a scheduled program/code which should first check whether final directory ( from where printer reads the file) is empty or not. if the directory is emptry , it should copy files from working directory to final directory. In this way we won't interface with XI normal flow and we don't have to restart the adapter any time.
    Scheduled program can be in ABAP/or Java. This will be provide us more flexibility in implementing business logic on receiver as we can manipulate the files flow we want in the code.
    This is genreral mechanism has  the followed in different project. I hope this mechanis looks proper .
    Ranjeet Singh.

  • File Reading. Help required

    Hi All,
    My scenario:
    There is a txt file. Inside that txt file  value comes (like A or B)
    Based on that value I need to send it to different receivers.
    eg. If value is A then send to Receiver A or If value is B then send to Receiver B.
    Since it is very big txt file  and value position can also change, so I do not want to use File Content Conversion.At target side again I want to send same txt file. So double conversion will be done.
    So I do not want to use File Content Conversion.
    Any suggestions please.
    Regards

    Hi,
    My source txt file is:
    I want to send the same source txt file to destination in txt format..
    At destination file needs to be again txt file.
    Condition:
    If :59:/1000001642  comes at that file position then send to Receiver A
    If :58:/9000001642  comes at that file position then send to Receiver B
    Can you please tell me how to apply FCC at sender and receiver .
    Regards

  • Using FileOutputStream for File Creation. Help Required!!

    Folks,
    I am using the FileOutputStream to create a file.For this I am
    saying:
    FileOutputStream fout2 = new FileOutputStream("Name.txt");
    This creates the File in the Current directory of the IDE(JBuilder 5).
    I want to create ths File in the a logs directory,taking the
    relative path.
    So I want the File to be created as ./logs/Filename.txt??
    How do I set the relative path in the FileOutputStream ??
    Can anyone please respond?

    Yes, "." does not coincide with the classes directory, especially when starting the application from an IDE.
    Take a look at the system properties for some directories:
    System.getProperties().list(System.out);
    System.putProperty("user.dir", "...");For your means I would abuse the ClassLoader, and specify a full path, and start to patch a file name from it:
    java.net.URL u = this.getClass().getResource(".../x.gif");

  • 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 related to variable substitution

    Dear all ,
    I have a query related to variable substitution :
    The requirement is that filename should be in the following format : <b>%<store_code>%_%<Date>%</b>_master.xml .
    I have done the configuration for Store_code in the variable substitution from Payload .
    But I am facing <b>problem related to Date as the requirement is that we should not take the date from the payload</b> . We used "ADDtimestamp" in the file mode creation but it is generating file with time stamp also which doesn;t serve the purpose .
    Can somebody suggest <b>how to take the current date without taking it from payload .</b> <b>Does anyone know something about standard current date which I can assign directly to Var2 .</b>
    Thanks in advance
    Regards
    Prabhat

    Hi,
    In your mapping, have a user defined function which has a bit of Java to get the current date and time and pass back out to a variable.
    Here is a code snippet I got in Google to do this :
    import java.text.*;
    import java.util.*;
    public class Dtest {
    public static void main(String args[]) {
       SimpleDateFormat df = (SimpleDateFormat)
         DateFormat.getDateInstance(DateFormat.SHORT);
       System.out.println("The short date format is  " + df.toPattern());
       Locale loc = Locale.ITALY;
       df = (SimpleDateFormat)
         DateFormat.getDateInstance(DateFormat.SHORT, loc);
       System.out.println("The short date format is  " + df.toPattern());
    Cheers
    Colin.

  • 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

  • Reciever File Adapter - Temp File Name Scheme using Variable Substitution

    How can I create a temporary file that uses variable substitution? 
    We are having a problem with files merging when we write files using the "Use Temporary File" setting on the FIle Adapter.  So two independent files are merging into a single file.  We are not using the "Append" setting.
    We would like to use a Temp File Name Scheme that would append the message id onto the temporary file name. 
    Using variable substitution we created a msgid variable.  When added to the temporary file name using %msgid% the temporary file name is created with %msgid% in the name instead of the actual message id.  We put the variable into the "File Name Scheme" as well and the end completed file used the message id in the name.
    Any Ideas?
    Thanks,
    Matt

    HI Matthew,
    Why are you adding the message id into the temporary file??
    I understand that you want the output of the filename to contain message id .. and hence you are using variable substitution for the same.
    Temporary file name will anyways get overwritten by the actual file name (here the actual filename will be using variable substituion).
    So i suggest to achieve your scenario you can add any name in the temporary file and maintain the desired filename you require as output in the variable subsititution.
    Temporary File Name option actually acts as a lock - unlock mechanism from PI side while the file is getting written to the file server so that while PI is writting the file no third party application batch program picks it up.
    I hope this helps.
    Cheers
    Dhwani

  • Variable substitution: (delete leading zeros from file name)

    Hi All,
    I am configuring an IDOC to FILE (fcc scenario) with a requirement of using the IDOC number in the output file name. 
    Using variable substitution, I manged to get the IDOC number from incoming Idoc-control record but it comes in its entitre length with a few leading zeroes like '00000001234'.
    So my output file name looks like 'Output_000000001234.txt'  . I want it to be like 'Output_1234.txt'.
    Is it possible to achieve it ?
    Thanks
    Shirin

    Hi Shirin,
    First supress the leading zeros of IDOC number by using the following code:
    Create a user defined funciton zerosuppress and take the cache as value and take one argument input. Then put the code below:
    //write your code here
    String output = input.replaceFirst("^0+","");
    return output;
    Then use variable substitution for generating ur IDOC number in the out put file name.
    Regards,
    Vinod.

  • Variable Substitution settings for Receiver File Adapter

    Hi All,
    I wanna use variables for File Name Sheme in the File Access Parameters.I had used by enclosing the variable names within %. When i wanna substitute values for those variables, it is given in the documentation(help.sap.com) that v need to set the Enable indicator. only after setting the indiactor, v can use the variables and can then enter the values for those variables in a table. but i can't see either the indicator or the table in my editor. how can i provide the values for the variables used in file name scheme/Target Directory. and for ur information,i'm using sp12.
    any help wud b appreciated.
    thnx
    Anil

    Hi Anil,
    Please check out the following link ...
    Re: Variable substitution - Pseudo Path Variable - file adapter
    Re: Variable substitution problem
    Regards,
    Raj

Maybe you are looking for

  • Report on New vendor transfer from ECC to GTS

    Hi we have run the batch job daily basis to transfer new vendors from ECC to GTS system, my client want to know that list of the venodors(Business Partners) has been transfered today in GTS system on particular day to screening SPL. where i can see t

  • Receiver JMS Adapter Content Conversion issue

    Scenario : R/3 -->XI -->MQ(XML2Plain) Hi We are using Receiver JMS Adapter to send the Message from XI to MQ. The XML has to be converted to plain file. And Content conversion is being done. With the new development, the message type defined consist

  • Problem with Document Shredder Widget

    I am new to MAC products (have had my macbook for a week) and have downloaded the Document Shredder widget but I can't figure out how to use it or if it is working properly. Looking for insight from anyone with more knowledge and experience.

  • "the attempt to burn a disc failed.  you do not have enough access privileges for this operation"

    I just changed my password for my apple i.d. so I could purchase a  new album.  I then bought the album, put it into a playlist to burn it to a cd-rw.  And when i click ok to start the copy i keep getting this message   "The attempt to burn a disc fa

  • Can All But One IP Address be Blocked?

    I have a website where customers will be paying for purchases with a credit card via PayPal. After they complete their payment at PayPal, they are returned to a specific page on my website. On this page are Word files available for download. Is there