Skip to Content

Message mapping multiple files from one source based on content

Hi, Hopefully someone can help. I am working on PI7.1 SP20. I have a need to generate multiple files from a single source message based on the content of contractorCode. ECC->PI->Outbound to server location. The location and the communication component (system) for all these files is the same. So I only have a single set of ID, RD etc. I have worked through various blogs. My message mapping target is 1:unbounded. My operation mapping target is 1:unbounded. I have tried both receiver rules and local rules in my receiver determination - these fail with "no receiver could be determined". I have investigated the extended button in RD, but get "no suitable data found" when I try to attach the associated operation mapping. I have modified my mapping to contractorCode->SplitByValue(ValueChange)-> ns0:messages (ns0:messages being the extra root node that appeared when I changed my MM target to 1:unbounded). I would be grateful if someone could point me in the right direction. Many thanks, Elizabeth

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

9 Answers

  • Best Answer
    Mar 01, 2017 at 02:41 PM

    Hi Elizabeth,

    Based on the payload sample you have supplied I see two issues that I have highlighted in this image. The first is that the source root XML node for the message does not match your message mapping and the second potential problem would be the existence of the ContractorCode with quotes included. I think those can be kept but the XPath condition would have to reflect that in the routing definition.

    Regards,

    Ryan Crosby

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Elizabeth,

      For any fields at the same level as ContractorCode that you want to pass to the target you would have to use the sortByKey and give ContractorCode as the key while ensuring you have the sort parameters as the sort function. The file names should appear in the payload if you do something like what I have shared but the actual file writing would only work if you use variable substitution - you cannot use dynamic configuration for instance on a message split scenario.

      Regards,

      Ryan Crosby

  • Feb 20, 2017 at 10:31 AM

    Hi Elizabeth!

    Let's start with providing us your source structure and condition for receiver determination.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22, 2017 at 01:58 PM

    Hello Evgeniy, I attach screen shots. The receiver rules do not work individually, the data comes out in a single file as per "if no receiver found, process as follows" Many thanks Elizabeth source.png receiverrules.png messagemapping.png

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22, 2017 at 02:18 PM

    Hi Elizabeth!

    First, if you want multiple messages to be produced at mapping output, map your ContractorCode element to your target message root node, not to Messages or Message1.

    Second, use RemoveContexts function or change context of your ContractorCode elements to put it all in one context without context changes.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22, 2017 at 03:06 PM

    Hi Evgeniy,
    I have done that but it has made no difference
    If the field contents are in quotes would that make a different to the receiver rule?

    59601853,"AR","20160107967260001"

    59601856,"SLS","20160107967261001"

    the conditions are without quotes. Though I have tried it without

    (ContractorCode = SLS)

    I also attach a new screenshot of my mapping change you suggested. messgemapping2.png

    Thanks in advance, Elizabeth

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22, 2017 at 04:36 PM

    You can create Multi mapping to achieve this. Don't need to make any change at RD or Channel level.


    Regards,

    Nabendu.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 01, 2017 at 02:21 PM

    Hi Elizabeth,

    Have you ever done 1:n mapping scenario complete end to end in this version before, if not could you please try it with some simple interface without any complex mapping and routing conditions.

    I believe it is some patch issue for 1:n mapping .

    Thanks,

    Avinash

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Avinash,

      I have just tried doing 1:n mapping without any routing conditions. I borrowed another communication component. It looked like it would have done a second copy, but needed a new receiver agreement to work fully. Is that what you would expect? Using only the original communication component, even multiple times within the RD still only produces one copy. Seems a bit of a long winded way round to use multiple CComponents. Unless, as you say we have a patch issue.

      Thanks for your input.

      Elizabeth

  • avatar image
    Former Member
    Mar 22, 2017 at 05:30 PM

    Hi Elizabeth,

    You are getting the error as "No Receiver could be determined", so you need to test your RD conditions with one line item first and then go for multiple items.

    Place a file with 1 line item and don't change the MM or OM from 0-Unbound.

    Please open the RD condition and show the XPATH exactly for both the conditions.

    With Regards,

    Nazeer

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Nazeer,

      I have tried with XPATH and with Context Object
      I have tried with single value, both expected values and also with a single line saying "where not equal to XX" (XX is not an expected value), including with and without quotes for each, and with ORs when I did a group statement (I did ANDs too, but got my logic sorted after that).

      Attached screenshot is latest attempt with XPATH, where not equal XXxpath-example.png

      This attempt is flagged to error if no receiver found - it doesn't error. A file comes out...but it is still the original single file, with the old file name, derived via ABAP rather than split and renamed within the mapping.

      To be honest, we are now looking at doing this task in the abap program. Perhaps we don't have a compatible version for this function.

      Thanks Elizabeth

  • Mar 22, 2017 at 05:11 PM

    Hi Ryan,

    Yes, I've got that, I can see my sortbyKey working for the extra fields - great.

    We do have variable substitution for the file names already. But I can see via the payload that the FileName tag is retaining the old version of the file name JobCosts..... (from the ABAP program) rather than taking the new version SomeFileNameAR that I derive from the mapping you suggested. The new file name IS WORKING when I run in test mode via the mapping/test tab. Any suggestions for that please?

    I am not sure how that can be, because my mapping no longer maps source to target for FileNode/FileName.

    I attach screen shots. So near and yet so far.... It's driving me mad. Its obviously something stupid. Is there a cache I can refresh to make sure I am using the latest mapping? Thanksfilename-variablesubstitution.png

    Add comment
    10|10000 characters needed characters exceeded