Skip to Content

sending IDOC data to two different folders

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 

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 28, 2013 at 01:26 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member chinna chinna

      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.

  • Jan 28, 2013 at 01:03 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    Jan 28, 2013 at 11:39 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 28, 2013 at 11:56 AM

    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

    Add comment
    10|10000 characters needed characters exceeded