Sum of all order amts

I want to be able to find the sum of all order amts from an itab that I read. The total needs to be 12 digits left filled with zero and decimal dropped
data: totalorderamt(12) type n value 0.
in the loop should it be
totalorderamt = totalorderamt + totalorderamt ?
is there a sum function that i can use ?

Hi,
You can use SUM function within loop.
LOOP AT ITAB.
   AT LAST.
     SUM.
   ENDAT.
ENDLOOP.
TOTALORDAMT = ITAB-ORDAMT.
Regards,
Ferry Lianto

Similar Messages

  • Help using oracle syntax "SUM(col1) over (order by col2)" using ODI

    Hi all
    I want to load data from oracle to ESSBASE using ODI, and I know oracle have such syntax sum(col1) over (order by col2,col3) which can get the accumulation data, e.g
    Oracle data table
    col1, col2, value
    A 2009-1 10
    A 2009-2 10
    A 2009-3 10
    And the essbase need
    col1 col2 value
    A 2009-1 10
    A 2009-2 20
    A 2009-3 30
    However after i try this in ODI, error occur:
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 32, in ?
    java.sql.SQLException: ORA-00979: not a GROUP BY expression
    and the original generated SQl by ODI :
    select 'HSP_InputValue' "HSP_Rates",MAP_KMDZ_TABLE.BUD_DYKM "Account",MAP_MONTH.ESS_MONTH "Period",MAP_YEAR.ESS_YEAR "Year",'Actual' "Scenario",'Draft' "Version",TEMP_LIRUN.CURRENCY "Currency",MAP_COMPANYCODE.ESS_COMPCODE "Entity",substr(MAP_KMDZ_TABLE.BUD_BUSINESSOBJECT,1,80) "BusinessObject",'Route_NoRoute' "Route",MAP_TRANSPORT.ESS_TRANSPORT "Transport",substr(MAP_KMDZ_TABLE.BUD_BUSINESSACTIVITY,1,80) "BusinessActivity",substr(MAP_KMDZ_TABLE.BUD_CHANNEL,1,80) "Source",'NoCounterparty' "Counterparty",sum(TEMP_LIRUN.DATAVALUE) over (order by MAP_KMDZ_TABLE.BUD_DYKM,MAP_YEAR.ESS_YEAR,MAP_MONTH.ESS_MONTH,TEMP_LIRUN.CURRENCY,MAP_COMPANYCODE.ESS_COMPCODE,MAP_TRANSPORT.ESS_TRANSPORT,MAP_KMDZ_TABLE.BUD_BUSINESSACTIVITY,MAP_KMDZ_TABLE.BUD_BUSINESSOBJECT,MAP_KMDZ_TABLE.BUD_CHANNEL) "Data" from ETL_DEV.TEMP_LIRUN TEMP_LIRUN, ETL_DEV.MAP_KMDZ_TABLE MAP_KMDZ_TABLE, ETL_DEV.MAP_MONTH MAP_MONTH, ETL_DEV.MAP_YEAR MAP_YEAR, ETL_DEV.MAP_COMPANYCODE MAP_COMPANYCODE, ETL_DEV.MAP_TRANSPORT MAP_TRANSPORT where      (1=1) And (TEMP_LIRUN.COSTELMNT=MAP_KMDZ_TABLE.SAP_ZZKM)
    AND (TEMP_LIRUN.FISCYEAR=MAP_YEAR.SAP_YEAR)
    AND (TEMP_LIRUN.FISCPER3=MAP_MONTH.SAP_MONTH)
    AND (TEMP_LIRUN.COMP_CODE=MAP_COMPANYCODE.SAP_COMPCODE)
    AND (TEMP_LIRUN.WWHC=MAP_TRANSPORT.SAP_WWHC) Group By MAP_KMDZ_TABLE.BUD_DYKM,
    MAP_MONTH.ESS_MONTH,
    MAP_YEAR.ESS_YEAR,
    TEMP_LIRUN.CURRENCY,
    MAP_COMPANYCODE.ESS_COMPCODE,
    substr(MAP_KMDZ_TABLE.BUD_BUSINESSOBJECT,1,80),
    MAP_TRANSPORT.ESS_TRANSPORT,
    substr(MAP_KMDZ_TABLE.BUD_BUSINESSACTIVITY,1,80),
    substr(MAP_KMDZ_TABLE.BUD_CHANNEL,1,80)
    I know ODI think sum.. over must append group by , however it's not! How to solve this problem.
    Thank All for your attention
    SOS!
    Ethan

    Hi Ethan,
    In my exeprnc I faced a similar kind of situation.
    Two work arounds.
    1. Write one procedure and execute the same using ODI procedure.
    2. Customize a Km and use that KM in your interface.
    I guess in your query Group by function is not needed. (if this is the case you can achive this by a smple customization step in KM)
    for example : your current KM will generate a query like this:-
    select x,y, sum(x) over (order by y) as sumx FROM TestTable group by x, y
    and you need a query like this
    select x,y, sum(x) over (order by y) as sumx FROM TestTable
    go to your KM (duplicate the KM which you are using and rename _withoutGroup )
    remove the group by function from select query
    (remove the API function <%=snpRef.getGrpBy()%> from insert into i$ table step)
    please let me know if you need more help on this
    regards,
    Rathish

  • How to get last row and sum of all columns in one query

    Hi ,
    is there a way to get last record for a column and sum of all record for another column in the same query.
    Best Regards ,

    You should define your requirements properly for volunteers to help here..
    Your data is not good enough to provide you accurate solution. Reason being you dont have a proper column which differentiates between first and last entry.
    The solution becomes easy based on your desgin.
    I have introduced a grouping column called "id" and a time column called "time_of_insert" (only this way you can confidently say that you can differentiate between first and last (also a fool proof solution) --- you may optionally use sequence(instead of date though if you say you may end up inserting two rows at the same time, then probably sequence would be a better choice to differentiate rather than a timestamp field) etc...)
    With your sample data something like this can be done to achieve your desired result.
    WITH dataset AS
            (SELECT 1 id,10 used, 8 remain,systimestamp+1/24 time_of_insert FROM DUAL
             UNION ALL
             SELECT 1 id, 1, 7,systimestamp+2/24 FROM DUAL
             UNION ALL
             SELECT 1 id,2, 5,systimestamp+3/24 FROM DUAL
             UNION ALL
             SELECT 1 id,1, 0,systimestamp+4/24 FROM DUAL
             UNION ALL
             SELECT 1 id,0, 0,systimestamp+5/24 FROM DUAL
             UNION ALL
             SELECT 1 id,1, 4,systimestamp+6/24 FROM DUAL)
    SELECT *
      FROM (SELECT SUM (used) OVER () sum_all,
                   FIRST_VALUE (remain)
                      OVER (PARTITION BY id ORDER BY time_of_insert DESC)
                      last_row
              FROM dataset)
    WHERE ROWNUM = 1;
    Output:
    SUM_ALL       LAST_ROW
    15                  4
    Cheers,
    Manik.

  • How to total sum of all low bid

    CALCBTOT     CALL     LETTING     VENDOR
    70,526     001     97101502     M018         
    63,960     001     97101502     S201         
    72,289     001     97101502     S498         
    21,100     001     97102401     A620         
    19,129     001     97102401     B0020        
    36,000     001     97102401     H330         
    26,424     001     97102401     J0008        
    3,328,419     002     97102401     C470         
    3,426,462     002     97102401     C480         
    3,495,741     002     97102401     E110         
    0     003     97102401     M577         
    465,280     003     97102401     R0026        
    1,359,124     004     97102401     E130         
    1,365,660     004     97102401     P272         
    I would like sum the low bid from the above table.  for example call 001  has 7 vendors submitted their bid. I just want to get the low bid out of the 7 vendors and add with the low bid with call number 002, 003 and 004. can you shed some light how I can do this.
    thank youEdited by: 893601 on Nov 15, 2011 12:56 PM

    I did a running total kind of thing but I got the result is the same as Solomon.
    /* Formatted on 11/15/2011 4:16:42 PM (QP5 v5.149.1003.31008) */
    WITH sample_data AS (SELECT 70526 CALCBTOT,
                                001 CALL,
                                97101502 LETTING,
                                'M018' VENDOR
                           FROM DUAL
                         UNION ALL
                         SELECT 63960,
                                001,
                                97101502,
                                'S201'
                           FROM DUAL
                         UNION ALL
                         SELECT 72289,
                                001,
                                97101502,
                                'S498'
                           FROM DUAL
                         UNION ALL
                         SELECT 21100,
                                001,
                                97102401,
                                'A620'
                           FROM DUAL
                         UNION ALL
                         SELECT 19129,
                                001,
                                97102401,
                                'B0020'
                           FROM DUAL
                         UNION ALL
                         SELECT 36000,
                                001,
                                97102401,
                                'H330'
                           FROM DUAL
                         UNION ALL
                         SELECT 26424,
                                001,
                                97102401,
                                'J0008'
                           FROM DUAL
                         UNION ALL
                         SELECT 3328419,
                                002,
                                97102401,
                                'C470'
                           FROM DUAL
                         UNION ALL
                         SELECT 3426462,
                                002,
                                97102401,
                                'C480'
                           FROM DUAL
                         UNION ALL
                         SELECT 3495741,
                                002,
                                97102401,
                                'E110'
                           FROM DUAL
                         UNION ALL
                         SELECT 0,
                                003,
                                97102401,
                                'M577'
                           FROM DUAL
                         UNION ALL
                         SELECT 465280,
                                003,
                                97102401,
                                'R0026'
                           FROM DUAL
                         UNION ALL
                         SELECT 1359124,
                                004,
                                97102401,
                                'E130'
                           FROM DUAL
                         UNION ALL
                         SELECT 1365660,
                                004,
                                97102401,
                                'P272'
                           FROM DUAL)
      SELECT TO_CHAR (low_bid, '$999,999,999') low_bid,
             TO_CHAR (call, '009') call,
             TO_CHAR (SUM (low_bid) OVER (ORDER BY call), '$999,999,999')
                running_total
        FROM (  SELECT MIN (CALCBTOT) low_bid, call
                  FROM sample_data
              GROUP BY call)
    ORDER BY call
    LOW_BID     CALL     RUNNING_TOTAL
          $19,129      001           $19,129
       $3,328,419      002        $3,347,548
               $0      003        $3,347,548
       $1,359,124      004        $4,706,672

  • Report - to show sum of all the fields in a table

    Hi,
    I have a requirement that for a particular materil ex: SALT i should show the sum of  qunatity i.e TMENGE , LMENGE, MMENGE.
    for a particular material  there is a condition on bais of  which the values will be divided.
    IF IT_PROD2-BWART  = '103','104','
    IT_PROD2-MENE GOES TO TMENGE,
    SIMILARLY FOR  201','202','261','262',
    IT_PORD2-MENGE GOES TO LMENGE
    FOR IT-PROD2-BWART = 551','562'
    IT_PROD2-MENGE GOES TO MMENGE.
    So i should insert sum of all the qunatiy lmege, tmenge, mmenge into it_prod3 and display it.
    i should disply only single reocrd for a particular material.
    but i am getting all the reocrods for mutiple dates i.e for date 2007.05.01 i am getting 10 records for SALT and for date 2007.05.02 again different records whre single date is repeating and materil is repating and so on   i want only single material and all the values should be sum.
    below is my code.
    SELECT werks_i AS werks
             SUM( menge_i ) AS menge
             matnr_i AS matnr
             budat  bwart_i AS bwart
             FROM  wb2_v_mkpf_mseg2
             INTO CORRESPONDING FIELDS OF TABLE it_prod2
             WHERE budat IN s_budat
             AND matnr_i IN ('PULPIMPORT','PULPLOCAL','SULPHUR','ZINC',
    'ZINCOXIDE','CHARCOAL','SALT','LIGNITE','STEAMCOALLCV','STEAMCOALHCV',
    'LDO','FURNACEOIL')
             AND bwart_i IN ('103','104','201','202','261','262','551',
    '552')
             GROUP BY werks_i menge_i matnr_i budat  bwart_i.
    SORT it_prod2 BY budat matnr.
      date1 = s_budat-low.
      date2 = s_budat-high.
      WHILE date1 LE date2.
        it_totstk1-month1 = date1.
        date1 = date1 + 1.
        APPEND it_totstk1.
      ENDWHILE.
    sort it_prod2 by matnr budat.
    LOOP AT it_totstk1.
        LOOP AT it_prod2. " WHERE budat EQ it_totstk1-month1.
          tdat = it_prod2-budat.
       if ( it_prod2-matnr = 'PULPIMPORT' OR it_prod2-matnr = 'PULPLOCAL') .
    elseif ( it_prod2-matnr ='STEAMCOALLCV' OR it_prod2-matnr =
    'STEAMCOALHCV' ).
            tmatnr = 'STEAM COAL HCV'.
          else. tmatnr = it_prod2-matnr.
          endif.
          IF it_prod2-bwart EQ '103'.
            tmenge = tmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '104'.
            tmenge = tmenge - it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '201'.
            Lmenge = Lmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '202'.
            Lmenge = Lmenge - it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '261'.
            Lmenge = Lmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '262'.
            Lmenge = Lmenge - it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '551'.
            Mmenge = Mmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '552'.
            Mmenge = Mmenge - it_prod2-menge.
          ENDIF.
       ENDLOOP.
        it_prod3-budat = tdat.
        it_prod3-matnr = tmatnr.
        it_prod3-tmenge = tmenge.
        it_prod3-lmenge = lmenge.
        it_prod3-mmenge = mmenge.
        APPEND it_prod3.
        CLEAR : tmenge,tdat,tmatnr,lmenge, mmenge.
      ENDLOOP.
    <b>points will be rewarded</b>
    Thanks & Regards,
    Sunil kumar.

    data: sumf type i.
    select sum( kbetr ) from  konv into sumf where kinak <> 'A' group by konv.
    write: sumf.
    Message was edited by:
            Ramu

  • Word Templates: Show all ordered Items

    Hi,
    I created a webservice in CRM 7.0 which would give back all ordered items.
    Now I want to make a list of these and create a Word Document out of it. I use the "Create from template" button in the attachment component.
    The order number etc is shown but I dont know how I can make a list of all items ordered.
    Can somebody tell me how I can achieve this?
    Thanks.

    All catch is to insert table in the correct level of xml schema.
    1. So you first need to insert elements to the template until you reach the element that you want to use in the table. For example if you want to display items of orders, this level would be Transactionhistoryofheader - Btdocflowall - Item
    2. After that you would insert table with 2 rows and as many columns as you need.
    3. The first row of the table is used for column headers. You can type in freely any text you want to display in column headers.
    4. The second row of the table is for the entries themselves. In the second row you have to add elements from the xml schema that are in the lower part of the element under which you inserted table. For example, under Transactionhistoryofheader - Btdocflowall - Item are then next nodes Btorder - Administrationheaderoneorder - Description. So in this case in first column will be displayed descriptions of all entries.
    5. At runtime rows are added dynamicly depending on actual number of entries.
    Regards.

  • Sum of all line items and display at the bottom of the page

    Hi ABAPers,
    I am displaying line items in the main window based on PO number ....and I've a coloumn Total amount.
    My requirement is after the line items , the  grand total which is the sum of all line items has to be displayed.
    Is this possible. If so, can anybosy help me in that.
    thanks in advance

    Hi ,
    It is possible.
    For that u have to do  following
    take one variable of same type on which you want to calculate total  ... declare in global variable
    double click in the table  goto the calculation tab in that give the variable on which u want to calculate total
    print in the total in the  footer of the table ..
    Hope you resolve your problem
    Let me know any concerns......

  • Numbers formula for "sum of all cells above this row"

    Is there a way, using the cell formulas in Numbers, to say "sum of all the cells above this row"?  I'm trying to make a ledger of sorts, and I want to have a column that is "how much you've spent so far" for each entry, which is the sum of all the "Price" cells for that row and above.
    Is this possible?  Thank you in advance for your help!

    Hi Alexander,
    You could start with a table like this:
    To get started,
    Cell D2 =C2
    Then to continue,
    Formula in D3 (and Fill Down)
    =D2+C3
    Row 10 is waiting for you to fill in details... .
    Regards,
    Ian.

  • KKBC_ORD for all orders in a plant

    Hi,
    Is there any report in CO-PC which would give me the information I can get in KKBC_ORD but for all orders in the plant at one run?
    My problem is that, I require to see the actual, target and plan activity quantities for particular production cost centers by month. I have found such information only in KKBC_ORD, but it can only be run for one order at a time. I wonder if there is any similar report, which can be run for whole plant or is there an easy way to create such report in ABAP as a copy of KKBC_ORD.
    Thank you for help,
    Karol

    Hi Karol,
    Have tried to run report "S_ALR_87013127 - Order Selection "
    Using this report you can see the plan and actual of orders in one plant.
    Please try, hope this would help you
    Irhasni

  • Mass Cancel/ Mass change of a product across all orders

    Dear Friends,
    We have a typical requirement at our client:
    1.How to cancel a product across multiple orders (Mass Cancel) ?
    2.How to change a product acorss multiple orders (Mass change in all orders)
    They had a issue with one of the product and to be cancelled due to legal requirements..but we have had the orders ready, which include other materials also.
    We now want to change one Material across all orders..how to do this? Same is the case wtih Mass Cancellation requirement.
    I request you to help us on this.
    Thanks
    Ravi
    Edited by: Ravi Prasad on Nov 24, 2008 4:38 PM

    Dear Ravi
    1)  To cancel in mass, you have to create a recording in LSMW and upload the text file
    2)  To change a material in multiple sale orders, go to VA05, input the material code and execute.  There from top menu bar, click on "Edit -- Mass Change -- New Material"
    thanks
    G. Lakshmipathi

  • I have a dynamic table that calculates the sum of all rows, no issue.  I'm struggling with pulling out a subtotal though.  I would like to have a check box in each row  that flags those rows and gives the sum of their total.  Any help would be greatly app

    I have a dynamic table that calculates the sum of all rows, no issue.  I'm struggling with pulling out a subtotal though.  I would like to have a check box in each row  that flags those rows and gives the sum of their total.  Any help would be greatly appreciated.

    Here's something I threw together rq. The script is in the change event for the checkbox in the table. (Of course, you'll have to modify it to suit the names of your fields.)
    var rows = xfa.resolveNodes("tblAmounts.Row1[*]");
    var subtotal=0;
    for (i=0; i<rows.length; i++) if (rows.item(i).cbAdd.rawValue == 1) subtotal = subtotal + rows.item(i).nfAmount.rawValue;
    nfSubtotal.rawVlaue=subtotal;

  • Message Mapping - Sum of all Element1.Field1 where Element1.Field2 = X

    Hi!
    Has everyone an idee of how to do the following message mapping ?
    My input message is :
    E1EDP01
       E1EDP26
          QUALF = 001
          BETRG = 5
       E1EDP26
          QUALF = 003
          BETRG = 3
       E1EDP26
          QUALF = 002
          BETRG = 5
       E1EDP26
          QUALF = 003
          BETRG = 3
    I want to get the sum of all E1EDP26.BETRG where E1EDP26.QUALF = "003".  There can be more than one E1EDP26 with field QUALF = "003".  So expected result is 6.
    Thanks in advance,
    Laurence

    Input structure :
    INVOIC02 1.1
         IDOC 1.1
              E1EDP01 0..999999
                   E1EDP26 0..20
                        QUALF 0..1
                        BETRG 0.11
    Output structure :
    root 1..1
         GoodsDeclaration 1..1
              Invoice 0..1
                   ExchangeRate 0..1
                        exchangeRate 0..1
                        currrency 1..1
                        exchangeDate 0..1
                   invoiceAmount 0..1
    The target field root/GoodsDeclaration/Invoice/invoiceAmount must be mapped with the sum of fields BETRG belonging to nodes E1EDP26 with field QUALF = "003".
    Sample :
    <INVOIC02>
         <IDOC>
              <E1EDP01>
                   <E1EDP26>
                        <QUALF>001</QUALF>
                        <BETRG>5</BETRG>
                   </E1EDP26>
                   <E1EDP26>
                        <QUALF>003</QUALF>
                        <BETRG>1</BETRG>
                   </E1EDP26>
                   <E1EDP26>
                        <QUALF>002</QUALF>
                        <BETRG>5</BETRG>
                   </E1EDP26>
                   <E1EDP26>
                        <QUALF>003</QUALF>
                        <BETRG>2</BETRG>
                   </E1EDP26>
              </E1EDP01>
         </IDOC>
    </INVOIC02>
    In this case, target field root/GoodsDeclaration/Invoice/invoiceAmount must have the value 3 :
    <root>
         <GoodsDeclaration>
              <Invoice>
                   <ExchangeRate>
                        <exchangeRate/>
                        <currrency/>
                        <exchangeDate/>
                   </ExchangeRate>
                   <invoiceAmount>3<invoiceAmount>
              </Invoice>
         </GoodsDeclaration>
    </root>
    Laurence

  • Sum of all values in a list

    Hi,
    I am having a list which has item and corresponding price.I wanted to do sum of all the prices in the list object.how can i do that?
    Thanks in advance
    rk

    I am having a list which has item and corresponding
    price.I wanted to do sum of all the prices in the
    list object.how can i do that?and what have you tried so far?....
    In case you haven't figured out yet, here we try to nudge you to do as much for yourself as possible... even to figure out the solution on your own. To do so will make the solution your own forever.

  • How best to implement a standard fuel surcharge on all orders?

    Due to the rising cost of fuel, our company is considering applying a small standard fuel surcharge to all orders, irrespective of destination, route or order value.
    What do you consider the most efficient way to be of applying this and what configuration is needed for your suggested solution?
    Thank you for your answers. Points will be posted.

    It would be a fixed percent (say 2.50%) on the sale value.  So what you can do the following:-
    a)  Create a condition type in V/06 with both Condition Class and Calculation type as "A". Maintain some access sequence for this condition type.
    b)  In V/07, for this access sequence, maintain the required combination for which you want to maintain condition record
    c)  Assign this condition type to your pricing procedure V/08
    d)  Next maintain the required percent in VK11 for this condition type
    e)  Now create a sale order and see how it works.
    thanks
    G. Lakshmipathi

  • Totals column that is the sum of all the data columns

    In a Report, I have several data columns, and then I want a totals column that is the sum of all the data columns. So for every row, the totals column will show the total of the data columns. How do I do this?
    Thanks, Wayne

    One way, create CF_total:
    function CF_totalFormula return Number is
    n number;
    begin
    select sum(coll) + sum(nvl(col2, 0)) + sum(col3)..... into n
    from tbl;
    return n;
    exception
         when others then
         return null;
    end;
    Another way, if you have SUMCOL1, SUMCOL2, ....:
    function CF_totalFormula return Number is
    begin
    return :SUMCOL1 + SUMCOL2 +.....;
    end

Maybe you are looking for

  • Sring to Object Array problem

    Hi every body, I have string in following format String s= "root, new Object[]{Folder1,SubA,SubB},Folder2,new Object[]{Folder3,SubC,SubD}, new Object[]{Folder4, new  Object[]{SubE,SubSubA}}";And I want to convert in following form Object[] hierarchy=

  • No Tables in the SH schema in OBIEE

    Hi, I have a problem with my presentation services in OBIEE. I have installed the OBIEE and everything has done successfully. I have copied the SH schema in the repository and configured the files. When i open my presentation services i can able to s

  • How to call Call Contracts in SRM from webdynpro?

    Hi experts , I have requirement where in one custom developed (Z)webdynpro component offers users a Link ( Link to action ) This link should open the SAP Contract in SRM 5.0 (ITS) Please provide hints or solution how proceded ? Thanks in advance Bidy

  • Why is the email address displayed on iTunes incorrect?

    I recently had to change my email address.  I corrected it on my Apple account but the old address is still displayed on my iTunes account on my iPad. Consequently I am not able to log onto Applications on my iPad because it displays my old email add

  • Firefox keeps crashing and freezing

    I am using Windows 8.1. Firefox either crashes or freezes multiple times/day. Here are my crash reports: bp-18337875-8976-461a-918a-59d732150331 3/31/2015 2:56 PM bp-19e8ab81-f42b-4974-bf1b-a1dc62150331 3/31/2015 11:07 AM bp-aeeca8d5-ce92-4ed9-b845-7