Skip to Content
author's profile photo Former Member
Former Member

PI file to file BPM scénario

i want to make a file to file scenario with simple mapping inside.

if no error mapping then store file in folder1

else store file in folder2.

is there anyone who realize this

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Feb 06, 2012 at 08:56 AM

    Hi,

    Do you want the source or the result file stored in folder1 or folder2?

    For source file: this is possible. Simply use the Processing Mode = Archive in sender CC and specify folder1 as the Archive Directory, and mark Archive Files on FTP Server if you are using FTP Transport Protocol. Moreover, mark the Archive Faulty Source Files and specify folder2 as Directory for Archiving Files with Errors. No BPM required.

    For the result file: you would have to use BPM, as in the topic title, to achieve this. You would have to use a different mapping for folder2 than for folder1, to avoid the same error as in the first trial.

    Hope this helps,

    Greg

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      First complete a normal file to file scenario. With all normal settings. I am not aware of condition of error. Thus let say after mapping there is a XML as shown

      <mt_target>

      <f1>abcs</f1>

      <error>1<error>

      </mt_target>

      The mapping will decide the value of the error field. Lets say In case value of error field is 1 you need the file to be formed in directory say "/usr/folder1" similarly if the value of "error" field is zero you need the file to be formed in "/usr/folder2". .

      Now you define another mapping MM2. The source message type and target message type of MM2 will be mt_target as shown above.

      You write a UDF as shown within message mapping MM2.

      public String setDirName(String error,Container container){
       DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
       
      DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
       
      String outputDir="";
       
      if(error.equals("1"))
      {
          outputDir=""/usr/folder1";
      }
      else
      {
             outputDir=""/usr/folder2";
      }
      conf.put(key, outputDir);
      return "";
      }
      

      Now MM2 will be like this

      f1------>f1

      error-- >UDF --->root (mt_target)

      error----->error

      Now put this mapping under last message mapping in the same operation mapping. Thus the OM will contain both the first mapping where you obtained mt_target for the first time and MM2. Finally in receiver file adapter you need following changes

      1. Receiver CC has "Use Adapter-Specific Message Attributes" and Directory ticked

      2. "fail if ASMA missing" tick this.

      I hope this resolves your problem.

      Regards

      Anupam

  • author's profile photo Former Member
    Former Member
    Posted on Feb 06, 2012 at 09:28 AM

    i want to make a file to file scenario with simple mapping inside.

    if no error mapping then store file in folder1

    else store file in folder2.

    that is very simple by using Context Object/Xpath with out bpm.

    id obj:

    you have to create ONe Sender Communication channel and Sender Agreement.

    and

    Create 2 receiver Communication channels and 2 agreements

    in receiver determinitation , you have to define Context OBJect

    ex:

    emp no 10 and 12 -> Receiver 1

    otherwise -> Receiver 2

    and

    create 1 Interface determination.

    SAP PI7.1, Receiver Determination, XPATH and You!

    otherwise that is also possiable with "Receiver Determination Enhancement"

    http://www.saptechnical.com/Tutorials/XI/RecvDetermination/Enhancement.htm

    Edited by: bhavanisankar.solasu on Feb 6, 2012 3:03 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 06, 2012 at 03:28 PM

    it's work when we use BPM.

    casting the error of mapping.

    if error send the result of mapping

    and send interface source if !error

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.