cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping issue in IDOC

monikandan_p
Active Participant
0 Kudos

Dear Experts,

          We have a scenario IDOC-PI-JDBC where we are creating Sales invoice through IDOC from ECC to PI ,We have multiple quantity from IDOC  and the remaining fields are common.

For ex:  We have same BELNR- material number and other fields are constant,except the  two  quantity fields are dynamic and we need to sum of the below two quantity fields and to send as in a single target value for both quantity fields in a one row and need to insert in DB table.

SHIPDT_GROSS_QTY,

SHIPDT_SHIP_QTY

For Ex:

Source                                                                           Target

IDOC                                                                     JDBC(DB table)                                 

SHIPDT_GROSS_QTY     20

SHIPDT_SHIP_QTY           40                                 

SHIPDT_GROSS_QTY      50     

SHIPDT_SHIP_QTY           60                           SHIPDT_GROSS_QTY   140

                                                                            SHIPDT_SHIP_QTY       180

SHIPDT_GROSS_QTY     70

SHIPDT_SHIP_QTY           80

Best Regards,

Monikandan.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Monikandan,

Now since you need to add the fields from your target structure you should use XSLT mapping over your message mapping to for the two fields SHIPDT_GROSS_QTY and SHIPDT_SHIP_QTY to get the summed amount.

Like for example the logic being:

<xsl:value-of select="sum(row/access/SHIPDT_GROSS_QTY)"/>


Similarly for second one.


Just complete the code with proper tagging it would work.



Regadrs,

Sachi


Former Member
0 Kudos

Hi Monikandan,

You can change the occurrence of the access field to 1:1 so that only one node will come. If you are not able to change the target structure, use the copy value function to create only one access node in target.

You can also use the below mapping for adding the quality to one field in target. This Sum function is available under statistic functions.

Result

Regards,

Deepak Ravi

Harish
Active Contributor
0 Kudos

Hi Monikandan,

In your example you are trying to add all SHIPDT_GROSS_QTY and SHIPDT_SHIP_QTY to one field in target.

you can achive this using simple context UDF.

input : SHIPDT_GROSS_QTY

int result = 0;

for(int i=0,i<input.length;i++)

{

result = result + input[i];

}

result.addValue("result");

please check the syntax.

regards,

Harish

monikandan_p
Active Participant
0 Kudos

Hi Harish,

For adding the quantity using the above udf fine.

But for every IDOC line items with different quantity value creates multiple access nodes.But we need single target access node contains the sum off the quantity values in DB table.

(i,e) Single row in a target side to insert in a table.

Kindly let me know how to handle in PI  mapping .

Best Regards,

Monikandan.

Harish
Active Contributor
0 Kudos

Hi Monikandan,

you can create single access node for that. map the access node with E1EDK01 ( i hope that is coming only once).

azharshaikh
Active Contributor
0 Kudos

Hi Monikandan,

Inorder to Sum the required Quantities from Source Structure you can use the Add Function in Graphical mapping (under Arithmetic) to achieve this..

Add

>>This function simply sums up the input values and produces the summation value as output

Regards,
Azhar

monikandan_p
Active Participant
0 Kudos

Hi Azhar,

   This add function we already tried but for every IDOC line items with different quantity value creates multiple access nodes.But we need single target access node contains the sum off the quantity values in DB table.

Kindly let me know how to handle in PI  mapping .

Best Regards,

Monikandan