Skip to Content
avatar image
Former Member

File name help

Hi experts,

I am a kind of stuck with target file name, The interface is Idoc to XML

I want my target file name like shown below

Company.I.yyyymmddINVNO.xml

INVNO is the invoice number from source Idoc.

Can any one please help me in accomplishing the above.

Thanks,

Sridhar

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 25, 2012 at 09:28 AM

    Hi Sridhar ,

    In communication channel -> adapter specific attributes check file name also and use the following udf .

    public String Dynamic(String FileName, String Date,String invo, Container container) throws StreamTransformationException{

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

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

    String myFileName = "" ;

    myFileName = FileName + "_" + Date +invo+".xml";

    conf.put(key, myFileName);

    return myFileName;

    }

    1st parameter for this UDF is constant(i.e, Company.I. ).

    2nd parameter is Date (use current date function and specify date and time format )

    3 rd parameter invoice number from Input payload.

    Don't forget to map udf to any node , then only ur dynamic configuration will work.

    Let me know the result.

    Regards

    Hari.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2012 at 06:04 AM

    Please refer the below blog and achieve your file name with dynamic configuration.

    http://scn.sap.com/community/pi-and-soa-middleware/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

    Check Code the Dynamic Configuration part, particularly point 3 Q &A and points to remember.

    Hope this would help

    Add comment
    10|10000 characters needed characters exceeded

    • >>I have already used dynamic configuration to redirect the message to another folder when line items are missing from source Idoc,

      Do you have some condition in mapping to execute your current dynamic configuration code only when line items are missing?

      And whether the new requirement for file name is only when you have line items?

  • avatar image
    Former Member
    Sep 25, 2012 at 07:00 AM

    this is very basic Question , u need to check SCN before posting this kind of Basic Question anyhow refer below logic:

    Company.I.yyyymmddINVNO.xml

    if company is not a field

    Conatant(Company.I.) + currentdate (standard date function) -> Concat -> invoice source field + concat -> constant(.xml) + Concat -> dynamicconf udf -> Target node .

    dynamicConf udf:

    public String dynamicConf(String a, Container container) throws StreamTransformationException{

    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

    conf.put(key,a);

    return "";

    oi ID on receiver communication channel:

    Enable ASMA Properties on Advance tab and

    Enable File name

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi sankar,

      I know this is a basic question but i have a problem here, I have mentioned above. Sorry i thing i was not clear.

      I will explain it clearly;

      I have already got a Dynamic configuration applied for Target node.

      The Dynamic configuration is meant to redirect the target file to different folder whenever line items are missing from the source Idoc.

      Now my question is how do i apply the new dynamic configuration.

  • Sep 25, 2012 at 07:07 AM

    Hi Sridhar,

    To get the dynamic file name you could use a variable substitution too if you have the parameter in the header or in payload.

    Check Former Member blog

    http://scn.sap.com/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi:

    To acces to payload only need to put in the table for example:

    var1 payload:root_element,1,second_tag,1

    You build the path to reach the tag that contains the desired value.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded