cancel
Showing results for 
Search instead for 
Did you mean: 

sending IDOC data to two different folders

Former Member
0 Kudos

Hello Experts,

I have IDOC to file scenario, when IDOC created data need to send create folder.

if same data changed then IDOC need to send to change folder in file server.

to recognize create or change in IDOC one filed contain X, if X is there then change.

i can achive this requirement using the receiver determination, i can put contion , if X then go to  Create folder Business system,

correct me if i am wrong.

Regards,

Chinna 

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chinna,

I have already done this kind of requirement.  Go with ASMA.  Create UDF in Mapping level

1. Create two parameters for tow different folder.

2. Configure this two paratmers in Interface Determination in ID(put the values as Directory names)

3. My requirement is like when Country = CA file should have go to CA folder and Country = US it file have to go to US folder.

In the below mapping I am passing first parameter when ever country = CA else I am passing the second parameter.

Trt this it should work.

Thanks,

Satish.

Former Member
0 Kudos

Hi Satish,

can you give me the UDF which u have written for the above logic.

Regards,

Chinna

Former Member
0 Kudos

Hi China,

Field1-->map with default --> equals to (X)-->if true return change else create -->udf

Execution type :single values

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

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

String DirName = ""/development/notification/"+Input+"/" ;

conf.put(key,DirName );

return Input ; //It is up to you

Regards

Venkat

Former Member
0 Kudos

Hi Chinna,

This is UDF code.  In my case I am generating both file name and directory name dynamically.  As I said in above I am passing the Folder Names using parameterzied mapping.

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

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

String vFileName = FileName1 ;

conf.put(key, vFileName);

// code for folder path

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

String vDirectory = Directory1 ;

conf.put(keyDir, vDirectory);


return vFileName ;

Thanks,

Satish.

Answers (3)

Answers (3)

rajasekhar_reddy14
Active Contributor
0 Kudos

Dynmic configuration UDF write a condition to pass directory name according to condition and map UDF to root node in mapping level. You dont need multiple receiver channels.

Former Member
0 Kudos

Hi Rajshekhar,

Thanks for the reply.

i dont have good knowledge in writing UDF. below UDF for dynamic path creation.

to pass two paths how to modify it.

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

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

conf.put(key, "/development/notification/update/"+dir );

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

DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File",

"FileName");

conf1.put(key1,dir +".txt");

return" " ;

Regards,

Chinna

anupam_ghosh2
Active Contributor
0 Kudos

Hi Chinna,

   Try this UDF. Input to this UDF is the field value(x) depending on which the target folder name will be decided. The UDF will have execution type "single value". I have assumed that the field value(x) is either "A" or "B". You need to alter the constant value("A") in the UDF if necessary.

public String TargetDirectory(String x,Container container)

{

    String dir="";

    if(x.equals("A"))

     {

           dir="change";

     }

     else

     {

         dir="create"

     }

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

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

conf.put(key, "/development/notification/update/"+dir );

return" " ;

}

You can map the output of  UDF to the root node of target XML.

Regards

Anupam

Former Member
0 Kudos

Hi,

Case1:

If target server is same and you just want to place in different folders based on some condition.

At mapping level you can configure the directory name using ASMA.

Case2:

Target side if you are using two different communication component ; then go with XPATH in RD and routing.

Case3:

Target side if you are using 1 communication component and two different servers then go with XPATH in ID and routing.

Regards

Venkat

smavachee
Active Contributor
0 Kudos