Skip to Content
avatar image
Former Member

checking if source node exists in IDoc

Dear All,

I am checking if the source Idoc node exists using node function exists . I have an issue when passing the source values to the output node.

For eg in a shipment idoc SHPMNT05 . I am checking if source E1EDT43 segment exists if it does not then I need to create as many E1EDT43 segments in the target as there are E1EDL37 segments in the source. In PI my mapping is as below.

                               then E1EDT43   

E1EDT43 - exists - if                          --> target E1EDT43

                              else E1EDL37

If there are 2 E1EDT43 segments in the source it produces the corresponding 2 E1EDT43 segments in the target but if  E1EDT43 segments does not exists in the source and there are 2 E1EDL37 segments in the source it produces only 1 E1EDT43 segment in the target.

Can you please advice as to how I can produce 2 E1EDT43 segments in the target when there are 2 E1EDL37 segments in the source?

Thanks for your help.

Teresa

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 16, 2013 at 03:15 AM

    Hello,

    Easiest solution would be to use duplicate subtree:

    1. Edit the mapping

    2. On your target field, right-click E1EDT43 and then select duplicate subtree

    3. Use the first condition on the first E1EDT43 (ifWithoutElse)

    4. Use the second condition on the second E1EDT43 (ifWithoutElse)

    Hope this helps,

    Mark

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 16, 2013 at 03:34 AM

    Hi Teresa,

    You need to use UDF for this. Suppose when 2 values of Source are coming 2 contexts (<exists> true, true) are created, but for when no source exists only 1 false (<exists> false) is generated, thats why irresepctive of everything it will always pass 1 'E1EDL37' to Target 'E1EDT43' when Source 'E1EDT43' does not exist.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Sen,

      I created the UDF in PI . For the UDF I have two inputs var1 and var2 and one output.

      In mapping as below I am confused with the ELSE condition as to how to use the two inputs of the UDF. Can you please let me know,

      IF E1EDT43 exists then output of (IF..ELSE)----> target  E1EDT43

           ELSE --->    

      Thank you.