Skip to Content
avatar image
Former Member

Idoc to file problem with DynamicConfiguration

HI SAP Guru's

I have a iDoc to File scenario and the output file requirement is bit tricky.

output file should be xx_Region_iDoc Number_YYYYMMDDHHMMSS

I been through couple of blogs but non of them mentioned about the iDoc all of them showed the about the FileName in FileAdapter.

I believe it is only possibly via Dynamic configuration.

I need to extract E1EDKA1/LAND1, DOCNUM from Source IDoc Structure and then concat it with Date and generate the output file name.

I cannot even get the iDoc Number i.e. DOCNUM via Dynamic Configuration.

I was trying this method but it didn't work.

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

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/IDoc","DOCNUM");

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

-


Can somebody please let me know how to achieve this and how?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    Jun 19, 2010 at 09:22 AM

    Hi,

    I have used Dynamic Configuration in one of the IDOC TO FILE scenario and its perfectly working fine. Just cross chk ur configurations.

    Under ESR : use the code provided by Ramkumar .

    Under ID: make an entry of Dynamic configuration module under File Receiver communication channel module tab(give correct details like parameter name and value) and chk ASMA(under Advanced mode).

    It will surely work.

    Thanks

    Amit

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Amit Srivastava

      Hi Amit Srivastava,

      I am facing same issue.. could you please share the screen shots with me. it would be helpful for me to learn this configuration and fix this issue.  Please mail it to  vinothbe@hotmail.com

      many thanks..

      Vinoth

  • Jun 15, 2010 at 04:17 PM

    /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

    manipulate the filename by writing the UDF and having the input field as the IDoc number from the EDIDC segment

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 15, 2010 at 05:13 PM

    Hi,

    I was trying this method but it didn't work.

    Have you selected the option ASMA in receiver File channel? Your code looks fine.

    Regards,

    Neetesh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Could you please tell me how to do variable substitution in ID.

      I have done the UDF but don't know what to do in ID except ASAM

  • Jun 15, 2010 at 06:45 PM

    Hi

    you should create an UDF which receive 3 parameters.

    1) the IDoc Number (DOCNUM) > get the IDoc number from the segment EDIDC >DOCNUM

    2) CurrentDate,-->StandarFunction currentDate

    3)Region (LAND1)

    In your UDF create in a variable you file name concatenating all parameters values.

    then call this code:

    String fileName ="";

    fileName="xx_" + REGION + "_" + DOCNUM + "_" + CURRENTDATE;

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

    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/IDoc",fileName);

    String ourSourceFileName = conf.get(key);

    return ourSourceFileName;

    Hope it helps

    Rgds

    RP

    Edited by: Rodrigo Alejandro Pertierra on Jun 15, 2010 3:46 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      Did you select the "Adapter specific message attributes"?

      In ID part

      if not got to receiver File adapter > Advanced > Adapter specific message attributes

      select the Filena option.

      Regards

      Ramg

  • avatar image
    Former Member
    Jun 15, 2010 at 07:33 PM

    Hi,

    First of all I believe dynamic configuration will not work for Idoc adapter. I haven't tried it yet, but I am wondering how u can read idoc sender adapter parameter using Dynamic configuration. As suggested, write a UDF to override the file name.

    Regards,

    Farooq

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2010 at 10:53 AM

    Hi,

    If I am not wrong, you can achieve it by using both Dynamic configuration and Variable substitution.

    For Variable substitution refer: /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi

    Regards,

    Abid

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2010 at 11:15 AM

    Hi,

    If you are using PI 7.1 , then you can use the global variable. Concatenate the Land and Docnum from the IDoc segments and map it to a Gloabl variable.

    Then map the global variable as the input to the UDF to Dynamically generate the Filename along with the Timestamp.

    Enable Variable substutution in ID and use this output as the variable to create the Filename.

    Regards,

    Sarvesh Desai

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Iqbal,

      If you are using PI 7.1, see the below comments suggested by Sarvesh:

      If you are using PI 7.1 , then you can use the global variable. Concatenate the Land and Docnum from the IDoc segments and map it to a Gloabl variable.

      Then map the global variable as the input to the UDF to Dynamically generate the Filename along with the Timestamp.

      Enable Variable substutution in ID and use this output as the variable to create the Filename.

      In case of PI 3.0 /7.0, see the below comments suggested by Farooq:

      First of all I believe dynamic configuration will not work for Idoc adapter. I haven't tried it yet, but I am wondering how u can read idoc sender adapter parameter using Dynamic configuration. As suggested, write a UDF to override the file name.

      >> Please can somebody tell me the different between Dynamic Configuration & Variable Substitution

      Variable substitution allows you to name your target file dynamically with some value in the message payload.

      Dynamic configuration means at runtime we are changing the values.

      Variable substitution requires you to have the filename as part of your target payload.

      As long as you have no issues with having the file name as part of your payload when you transfer it to your target system, variable substitution can be used.

      Regards,

      Abid

  • avatar image
    Former Member
    Mar 24, 2015 at 10:48 PM

    I am having a similar issue. The idoc coming in from the source has multiple segements and i need to create the file at the target server based on the field - FILTER2 value.

    So far I have tried variable substitution and ASMA but still not able to create multiple files from PI.

    Can you please share the screenshot with me as well ?

    mradul0489@gmail.com

    Add comment
    10|10000 characters needed characters exceeded