cancel
Showing results for 
Search instead for 
Did you mean: 

Filename required in the file field

Former Member
0 Kudos

Hi,

I have an IDOC-File scenario..

The file name in the target directory is of the format DLXXXXXX.DAT

where:

XXXXXX - Is the sequence number of the generated file in the target directory.

I am implementing this using the 'Add Counter Mode' in the Communication Channel.

My question - How can I have this file name to be populated in one of the fields in the file? Is it possible?

Thanks...

Amit

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

>>How can I have this file name to be populated in one of the fields in the file

well to add some field in the file you need to do it in message mapping (via UDF),but the thing is that any UDF in Message mapping will not always give you same counter as 'Add Counter Mode' ,hence you will have a different counter in filename and in the content of file.

a better approach would be to use Message ID,this is unique for both adapter engine and Integration engine,just write a UDF and populate the message ID in message mapping and in file construction mode in the receiver file adapter select "add message ID"

Second option would be to use variable substitution,in this case write a UDF and populate a field in message mapping with a counter,now do a variable substitution and use this field to name your file as per the counter.but in this case ,file construction mode won't be "Add counter",it will simply be "Create"

Thanx

Aamir

Edited by: Aamir Suhail on Jul 1, 2008 8:28 AM

Edited by: Aamir Suhail on Jul 1, 2008 8:30 AM

Former Member
0 Kudos

Hi Amit,

You won't be able to copy the number of the receiver file adapter's counter into the message (unless doing some additional and typically foolish efforts - e.g. reading the file in again or use an OS command for it).

This is because the counter will be triggered just before writing the file - at this point, mapping is already completed. Hence, you will need to do it in the mapping and then use the field value as the basis for the file name.

Aamir has put it together already (the variable substitution should do the job in your case) - just a small addition:

There is also a counter functionality available as a standard function, so you don't need to write a UDF. Of course, if you are not restricted to sequence numbers, you should stick to his advise to use the message ID; and then, you have to use a UDF again.

Best regards,

Dennis