cancel
Showing results for 
Search instead for 
Did you mean: 

File name help

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member190624
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Thanks very much Hari,

It Worked _

Answers (3)

Answers (3)

iaki_vila
Active Contributor
0 Kudos

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-substitutio...:

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

zameerf
Contributor
0 Kudos

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

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

Hope this would help

Former Member
0 Kudos

Hello Zameer,

Thanks for your help,

but i have a small problem here, I have already used dynamic configuration to redirect the message to another folder when line items are missing from source Idoc,

Can you please tell me where i can map the new dynamic configuration.

zameerf
Contributor
0 Kudos

>>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?