cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Filename from source Idoc

Former Member
0 Kudos

Hi All,

I need to give the filename from the field in the source idoc. the field value need to be picked up as below

ZSSV_GENERIC_IDOC

-IDOC

--Z1SSV_ITEMS_SUMMARY

---HOST_FILENAME

Note: - represent the level in the datastructure.

here the value of HOST_FILENAME need to be given as filename. I check the Variable Substitution but I hope we can give only the values from message: and payload:

Please let me know how to give this valueas filename.

my filename need to be as

HOST_FILENAMEmatmastimestap.dat

Regards,

Dhill

Accepted Solutions (0)

Answers (2)

Answers (2)

justin_santhanam
Active Contributor
0 Kudos

Dhil,

Check the below code if its feasible to you rather than going for variable substitution.

input --->UDF -


>Root node of target.

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

DynamicConfigurationKey key = DynamicConfigurationKey.create(

"http://sap.com/xi/XI/System/File",

"FileName");

String fname =input+"MATMAS";

conf.put(key,fname);

return "";

In receiver comm.channel check the checkbox for ASMA -Filename.

Creation mode - AddTimestamp.

Hope it helps!!!

Best regards,

raj.

Former Member
0 Kudos

Hi Raj,

Thank you very much, I am able to generate filename successfully but only issue is... as I am having 2 receiver file the timestamp is getting differ by milliseconds and hence my target system is not processing....

<b>Example:

CHANGE matmas20070820-073135-197.dat

CHANGEackmatmas20070820-073137-896.dat</b>

Can you please help me on this.

Regards,

Dhill

Former Member
0 Kudos

Dhil,

In this case, like Host file name assign current date-time to one of the field using Date function and you can refer this payload field while creating file name.

So file name would be something like this <HostFileName>+ %varDateTime%

where varDateTime ---> Payload -->DateTime.

Hope this will help.

Nilesh

justin_santhanam
Active Contributor
0 Kudos

Dhil,

The timestamp will be obviously different btw to file creation. How u need the timestamp? Could u tell us the format...

Best regards,

raj.

Former Member
0 Kudos

If you want to give same timestamp for both the file then concatenate your timestamp and filename in UDF.

Former Member
0 Kudos

Hi Raj,

The timestamp need to be as yyyymmddhhmmss. can u tell how to specify this and where to specify this.

Regards,

Dhill.

Nileash: I will try your option in the meantime

justin_santhanam
Active Contributor
0 Kudos

Dhil,

One more thing are the two files getting generated as the output of one message mapping? I mean u are creating two files in Multimapping option!! Could you please clarify this.

What is the actual scenario?

Best regards,

raj.

Former Member
0 Kudos

Hi Raj,

The actual scenario is idoc to 2 file. One with idoc details and other is acknowledgement file with content value as "1".

I used 2 message mapping, 2 interface mapping. I doubt whether I can perform this with single mapping itself. because the content of the file is different.

let me know if any more details required.

Regards,

Dhill

Former Member
0 Kudos

Hi Nilesh,

I tried with this option but it is missing in terms of seconds :-). the output is as

CHANGEmatmas20082007083713.dat

CHANGEackmatmas20082007083714ack.dat

Regards,

Dhill

Former Member
0 Kudos

Ohh...Got it...you have two different mappings...

Your file is generated in sequence..means idoc detail file first and then acknowledgement file?

If so I think you can declare one global variable in message mapping, read date time ( in first file mapping where you are assigning to target) and assign to delcare global variable and then try to use same variable in your secong mapping...

Hope this will help.

Nilesh

justin_santhanam
Active Contributor
0 Kudos

Nilesh,

I thought of suggesting the same, but Global variables variable can't be used across mapping.

Best regards,

raj.

Former Member
0 Kudos

ah...haaa..

you are right Raj...How about Global Container..

Check out this link ...hope it will help ..

Look at this as well...

Nilesh

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

Go thru this blog...

<a href="/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i File Name using XI 3.0 SP12 Part - I</a>

<a href="/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii File Name using XI 3.0 SP12 Part - II</a>

Regards

Santhosh

[url=; Use a Good Subject Line, One Question Per Posting - Award Points[/url]