Skip to Content
avatar image
Former Member

Any body can explain logic and Write code for UDF SAP PI, below requirement

Hi Experts , logic for IsPrimaryProduct field,Incorporate logic to compare E1AFPOL/MATNR with E1AFKOL/MATNR if matches then True else false, Coproducts are mapped only when E1AFPOL/DFREI=X

Idoc test data:

<E1AFPOL SEGMENT="1">

<POSNR>0001</POSNR>

<DFREI>X</DFREI>

<KDEIN>0000</KDEIN>

<KDPOS>000000</KDPOS>

<MATNR>000000000000010816</MATNR>

<MEINS>EA</MEINS>

</E1AFPOL>

<E1AFPOL SEGMENT="1">

<POSNR>0002</POSNR>

<KDEIN>0000</KDEIN>

<KDPOS>000000</KDPOS>

<MATNR>000000000000010817</MATNR>

<MEINS>EA</MEINS>

</E1AFPOL>

<E1AFPOL SEGMENT="1">

<POSNR>0003</POSNR>

<DFREI>X</DFREI>

<KDEIN>0000</KDEIN>

<KDPOS>000000</KDPOS>

<MATNR>000000000000010820</MATNR>

<MEINS>EA</MEINS>

</E1AFPOL>

Excepted output result:

<tem:productionOrder>

<pow:CoProducts>

<pow1:ProductionOrderProduct>

<pow1:IsPrimaryProduct>True</pow1:IsPrimaryProduct>

<pow1:MaterialNumber>10816</pow1:MaterialNumber>

<pow1:ProductionOrderId>0</pow1:ProductionOrderId>

<pow1:Quantity>0</pow1:Quantity>

</pow1:ProductionOrderProduct>

<pow1:ProductionOrderProduct>

<pow1:IsPrimaryProduct>False</pow1:IsPrimaryProduct>

<pow1:MaterialNumber>10817</pow1:MaterialNumber>

<pow1:ProductionOrderId>0</pow1:ProductionOrderId>

<pow1:Quantity>0</pow1:Quantity>

</pow1:ProductionOrderProduct>

<pow1:ProductionOrderProduct>

<pow1:IsPrimaryProduct>True</pow1:IsPrimaryProduct>

<pow1:MaterialNumber>10820</pow1:MaterialNumber>

<pow1:ProductionOrderId>0</pow1:ProductionOrderId>

<pow1:Quantity>0</pow1:Quantity>

</pow1:ProductionOrderProduct>

</pow:CoProducts>

Kindly help me and write logic for UDF.

Thanks & Regards,

Nalla Sridhar

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jul 11, 2017 at 05:23 AM

    Any particular reason you want to use UDF and not achieve it using Graphical mapping ? Although you have not mentioned E1AFKOL segment in source message, I am still guessing mapping should be pretty straight forward using node functions.

    Best,

    Vibhu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Agree with Vibhu. Take a look at the available compare and node functions in the graphical mapping editor. Unless I'm thoroughly misunderstanding what you're trying to do, I'm pretty sure you'll find the solution to this problem yourself this way.