cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic target Directory

Former Member
0 Kudos

Hi All

I have a scenario in which all my master IDOCS should flow form R3 to XI and form XI to the FTP Server's respective Folder loaction.

The Folder option is storewise , so for example for ST01 , the corresponding WP_PLU should be placed at ST01 folder location in the ftp server.

there is an UDF written foe file naminf convention:

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

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

Calendar cal = Calendar.getInstance();

Date date = cal.getTime();

String s = date.toString();

String a1 = s.substring(8,10);

String b = s.substring(4,7);

String b1="a";

if(b.equals("Jan"))

{b1="01";}

if(b.equals("Feb"))

{b1="02";}

if(b.equals("Mar"))

{b1="03";}

if(b.equals("Apr"))

{b1="04";}

if(b.equals("May"))

{b1="05";}

if(b.equals("Jun"))

{b1="06";}

if(b.equals("Jul"))

{b1="07";}

if(b.equals("Aug"))

{b1="08";}

if(b.equals("Sep"))

{b1="09";}

if(b.equals("Oct"))

{b1="10";}

if(b.equals("Nov"))

{b1="11";}

if(b.equals("Dec"))

{b1="12";}

String c = s.substring(24);

String sDate = a1b1c;

String e = s.substring(11,13);

String f = s.substring(14,16);

String g = s.substring(17,19);

String sTime = efg;

String d = a.substring(9,25);

String Idoc = d;

String RecieverFilename = "WPDBBY_"Idoc"_"sDate"_"sTime".txt";

//<Receiver Filename> ; //you have to give the filename that has to be generated in the receiver adapter.

conf.put(key, RecieverFilename);

return a;

Could any1 please help how to add the directory to it,please let me know the code as i am not a JAVA developer

regards

Prajna

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

Hi,

add this extra code

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

String Dirname = "";

//write logic to generate a dynamic directory and make sure that this directory exists in FTP

//(or) the Receiver file channel Channel has access rights to create the folder.

conf.put(DIR_NAME, Dirname );//now put that Dirname value generated here

Also Make sure that in the receiver file channel Adapter Specific message Attributes is checked along with FileName & Directory.

Thanks,

Gujjeti.

Edited by: Praveen Gujjeti on Nov 21, 2008 1:07 PM

Answers (3)

Answers (3)

Former Member
0 Kudos

HI Gujjeti,

there is a fillale(site) field in all my idocs which i will be sending to the respective folders in my ftp server , so how do i place it my original code of the UDF

Thanks,

Prajna

Former Member
0 Kudos

Hi Prajna

Code given above you can directly add to your UDF. If it just require to set the directory. Else provide info on how you want to set directory.

You can use Dynamic configuration to create the directory and filename dynamically using variable substitution at receiver adapter. But provide more info to help you on this.

Thanks

Gaurav

Former Member
0 Kudos

Hi praveen

thanks for your reply, but i want the full code, as i am not a JAVA developer, so could you please paste the code for directory creation

this help would be vary appreciated.

regards,

Prajna

former_member181985
Active Contributor
0 Kudos

can you provide me the business logic for generating Dynamic directory name. I mean using which input fields from the source structure you manipulate and generate a dynamic directory name.

Just give me a flow chart, as it is language neutral....

thanks,

Gujjeti.