cancel
Showing results for 
Search instead for 
Did you mean: 

Need to SUM the values in Message Mapping

Former Member
0 Kudos

Hi All,

I need to sum the values from source and populate in the target.

My source structure is

<IDOC>

<E1EDP01>

<E1EDP05>

KSCHL

BETRG

</E1EDP05>

<E1EDP05>

KSCHL

BETRG

</E1EDP05>

</E1EDP01>

<E1EDP01>

<E1EDP01>

<E1EDP05>

KSCHL

BETRG

</E1EDP05>

<E1EDP05>

KSCHL

BETRG

</E1EDP05>

</E1EDP01>

<E1EDP01>

</IDOC>

In the source E1EDP01 occurence is unbounded. E1EDP01 is the root node for E1EDP05 which is also unbounded .

In this case I need to map values from E1EDP05 to target structure

Target Structure

<InvoiceDetails>

<HeaderDetails>

<BillingInfo>

<ItemDetails>

<Identifier>

<DiscountPrice>

</ItemDetails>

<BillingInfo>

<HeaderDetails>

<InvoiceDetails>

BillingDetails is the root node for ItemDetails. ItemDetails need to come only once in the target if KSCHL(E1EDP05) in the source equals to ZAC otherwise this node should not be created.

DiscountPrice under ItemDetails is total value of BETRG. BETRG value should be Summed only if KSCHL equals to ZAC. other values of BETRG should be ignored.

So I put a CreateIF(node function) condition to ItemDetails node based on the value of KSCHL and changed the context of KSCHL to E1EDP01.

For DiscountPrice I put the Boolean Function(IF without else) to check whether KSCHL equals to ZAC and Used SUM(Statistic Function) to SUM all values of BETRG and changed the context to IDOC . But i am not getting the output.

But if i remove the condition to create node ItemDetails then the output DiscountPrice is coming.

How to get the output with the condition.

Suggest some solution handle the above problem.

Regards

Prakash

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member

Hi,

For DiscountPrice I put the Boolean Function(IF without else) to check whether KSCHL equals to ZAC and Used SUM(Statistic Function) to SUM all values of BETRG and changed the context to IDOC . But i am not getting the output.

1) For IF without else function use property to keeps - TRUE.

2) Use splitByValue function to map DiscountPrice node.

3) Use removeContext function to map ItemDetails node.

This will help u.

Regards,

Rohit

Reward points if helpful.

former_member194786
Active Contributor
0 Kudos

Hi Prakash,

Since you have already checked for the value of KSCHL in the creation of the ItemDetails node, you need not use the If condition again in the DiscountPrice node. Also check in the source input data if the field KSCHL occurs and is equal to ZAC.

Hope it helps.

Regards,

Sanjeev.

Former Member
0 Kudos

hi prakesh,

check this thread for reference

regards

chandra