cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file naming when downlaoding the file to target directory

Former Member
0 Kudos

Dear friend,

My requirement is in the Adapter type File, File Name has to be dynamically generated. (i.e., each time the file name will be different according to the input name from the IDoc field). Can someone help me in this regard ???

Thanks in advance,

Jose Augastine

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

The dynamic filename generation concept is as follows.

In your filename field. just give a variable with % symbols. (eg: %file% ).

Now, under the option Variable Name Substitution, you can give how the value has to be created.

It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.

For the former, your give

message:interface_name ,etc

and for the payload part you give,

Payload: "your element root which u wanna acecss"

Just check this link out,

http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

And read the contents under variable substitution and it will help you understand the concepts better.

If you have any clarifications, do get back,

Regards,

Bhavesh

Former Member
0 Kudos

Dear Bhavesh,

Thanks a lot for the information.

Regards,

Jose Augastine

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Jose,

If you don't want to carry the filename in the payload (for example you don't want to define an extra field in the destination message) you can use the Adapter specific message attribute FileName.

You have to set the corresponding key-value pair in the the DynamiConfiguration segment of the SOAP Envelope Header.

You can use the following user defined function with the following input parameters :

namespace = "http://sap.com/xi/XI/System/File"

key = "FileName"

value = map this input from your IDoc field containing the file name

public String setDinamicConfiguration(String namespace,String key,String value,Container container){

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

DynamicConfigurationKey keyValue = DynamicConfigurationKey.create(namespace,key);

conf.put(keyValue,value);

return value;

}

Best regards,

Bela

Former Member
0 Kudos

Dear Bela,

Thanks 4 the info.

Regards,

Jose Augastine