Skip to Content
avatar image
Former Member

How to calculate the total sum value of a particular field that repeats

Hi All,

I have the following Req...File----Idoc Scenario

In the Inbound xml file i will get the Sales Order details with suppose 10 line items( 10 Orders)

Each line item represents one one SO. So totally i wil have 10 Sales Orders in this file.

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_Sales_Order xmlns:ns0="http://sap/Sales_Order">

<Header>

<COMP_CODE></COMP_CODE>

<DOC_TYPE></DOC_TYPE>

<SUPPL_VEND></SUPPL_VEND>

</Header>

<Item>

<ITEM></ITEM>

<MATERIAL></MATERIAL>

<PLANT></PLANT>

<QUANTITY></QUANTITY>

<Amount></Amount>

</Item>

In the above structure Item Segment will repeats as many no. of Sales Orders comes in a file.

In a file if there are 10 Orders means the Item segment wil repeats 10 times.

I have the Amount field in the Item Segment, each and every time that needs to be added to next Amount value that presents in the next Line Item.

Finally i will have the Another separate field caled Grand Total, and i have to get the total summation of the 10 values of the Amount field at last.

Can we achieve this using UDF or is there any way to do this

REgards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 26, 2008 at 09:34 AM

    Check with below mapping

    DISCOUNT----->EqualsS--->Constant(ZE)-------->\if
                                                   ---------->Sum---->Target
                                    AMOUNT ----->/then
    

    Change the context of DISCOUNT and AMOUNT to higher level

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 25, 2008 at 07:17 AM

    Hi,

    Use statistics function SUM, set the proper context or use

    Amount ->removeContext->SUM--->GrandTotal

    Thanks!

    Add comment
    10|10000 characters needed characters exceeded