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

Similar Messages

  • How to include all the fields of a Table into a Structure.

    How to include a Complete Table into a Structure.
    I want to include all the fields of KNA1 into a structure say W_KNA1(A local structure declared within a program)....How this can b acheived.
    Thanks in Advance.

    if i want to use INCLUDE STRUCTURE.....how will it work.
    TYPES : begin of ty_kna1,
                      INCLUDE STRUCTURE KNA1,
                  end of ty_kna1.
    tell me this is correct stmt.

  • 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

  • Not getting all the fields of MARA by using DDIF_NAMETAB_GET

    Hi,
    Please to solve the below issue.
    I am using the DDIF_NAMETAB_GET FM and trying to all the fields of MARA tabel but i getting only 27 records ie. 27 fields. when i look at DD03L i can 220 records but i am not sure why the output only shows 27records.
    Any help is really appreciated.

    HI,
    Chek cthis ..
    Function module              DDIF_NAMETAB_GET
    Import parameters               Value
      TABNAME                         MARA
      ALL_TYPES
      LFIELDNAME
      GROUP_NAMES                     X
      UCLEN                           00
      Export parameters               Value
      X030L_WA                           MARA                            
      DTELINFO_WA                                                      00000000000000000000000000000000
      TTYPINFO_WA                                                      00000000000000000000000000000000
      DDOBJTYPE                       TRANSP
      DFIES_WA                                                                                0000000000
      LINES_DESCR                        22 Entries
      Tables                          Value
      X031L_TAB                          0 Entries
                       Result:           231 Entries
      DFIES_TAB                          0 Entries
                       Result:           230 Entries

  • All the field must be fill

    I have a form with 2 tables
    I have here one button
    I wanna put a code in this button that when I press this button check that all the fields must be fill
    I use this code in when button press
    declare
    v_alert number;
    begin
          v_alert := Show_Alert('close');  --( do you want to close OK/Cancel)
          IF v_alert=ALERT_BUTTON1 THEN
         if :v_code is null      or :v_name is null then     
          set_alert_property('close',alert_message_text,'Please Enter Vessel Code & Name');
            v_alert := Show_Alert('close');
    end;when i put vessel code and name and then again press button
    this alert also show me??

    Moazam
    Actual it is req.
    I have 0ne form/document and I want to close this document, it means after close this doc / form we consider that now we can not enter any information and this document is competed.
    thatswhy I check with button .. one button to close this doc.. when button press first check all form text that all the text are fill or not if not fill then show the alert or mesg ..
    finally I correct this code ,, i have done this work.

  • Is there a way in Pages to show and print all the added "comments?" (those you add by highlighting text)  I'd like students to be able to view my comments on printed version of their papers.

    Is there a way in Pages to show and print all the added "comments?" (those you add by highlighting text)  I am a teacher, and I would  like students to be able to view my comments on printed versions of their papers. I know word displays the comments off to the side of the document, and those comments can be viewed all at once and printed alongside the document.

    There doesn't appear to be a way to print conmments in either Pages or Numbers in the Mavericks versions.
    Jerry

  • When I open up iphoto and click on the events tab then double click on an event, it used to show minis of all the photos in that event.  Now it shows only one photo at a time.  How do I get it back? Can you help?

    When I open up iphoto and click on the events tab then double click on an event, it used to show minis of all the photos in that event.  Now it shows only one photo at a time.  How do I get it back? Can you help?

    On the bottom bar of the window (on the left iPhoto 11, on the right in other versions) note the slider. Drag it left.
    Regards
    TD

  • Get all the field's value of addressbook entry using c++ api

    How can i get all the field values of address book entry in groupwise using c++ api.

    You should be able to do that via the Token API. There is an AddressBookGetEntry method. You could createsome sort of AddressbookEntry class that fetches (via iteration over the defined ABFields) all the innformation.

  • How do we know what are all the fields  updated in a screen?

    Hi all,
             If i am making modifications in row details of sales order screen .for eg, <b>i am changing the quantity or price for a row</b> 
             I want to write log file for the updated fields for that particular sales order.
             <b> How do we know what are all the fields are updated ?</b>     
             If we can use SBOTransaction_Notification procedure.How to write code inside that.
             Please provide code example for that.I have downloaded the sample.But i donot know how to use 'Add code to here ' part.
             Please help me to solve this.Hope  your  reply soon
    Regards,
    V.Rangarajan

    Hi, V.Rangarajan!
    When the field in the matrix is filled with some value and the user moves to another field, the et_LOST_FOCUS event occurs. So, i think you can try to handle ItemEvents and use such code (for example):
    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_LOST_FOCUS && pVal.ItemUID == "38" && pVal.BeforeAction == false && pVal.FormType == 139)
    string ChangedColumnID = pVal.ColUID;
    int ChangedRowNumber = pVal.Row;
    and write the values to your log.
    "38" - is the matrix ID in the Orders form
    "139" - is the Orders form
    Also you can access to the value, that user had put into the field.
    Hope this helps!

  • What are all the fields covered in the Raw file received from the Card Co

    Hi Experts,
    I want to know what are all the fields covered in the Raw file received from the credit card company say AMEX before uploading the data into ASP system i.e. CCD format file to be uploaded in T-Code PRCC
    Some of the fields I know:
    1.     Name of the Employee
    2.     Company ID
    3.     Credit card number
    4.     Currency
    5.     Amount
    6.     Exchange rate
    7.     Date of Transaction
    8.     Description
    9.     Document no.
    10.     Expense type
    11.     Expenses paid by company
    Waiting for a positive response from your side
    Regards,

    Hi
    The below mention is the possible values/records will be received from Banks regarding credit card expenses
    ORGANIZATION / HIERARCHY HEADER RECORD
    FIELD NAME
    RECORD TYPE
    TYPE INDICATOR
    COMPANY NAME
    COMPANY ID
    SUB COMPANY ID
    EFFECTIVE / FILE DATE
    CCF VERSION
    COMPANY NUMBER
    TRANSACTION POSTING DATE START
    TRANSACTION POSTING DATE END
    FILLER
    TRX CONTROL DATA
    ORGANIZATION / HIERARCHY DETAIL RECORD
    FIELD NAME
    RECORD TYPE
    TYPE INDICATOR
    COMPANY ID
    SUB COMPANY ID
    CORP PARENT NODE
    CORP CHILD NODE
    PAST DUE BUCKETS RECORD
    FIELD NAME
    RECORD TYPE
    TYPE INDICATOR
    COMPANY ID
    SUB COMPANY ID
    STATEMENT DATE
    AMOUNT PAST DUE
    30 DAYS PAST DUE
    60 DAYS PAST DUE
    90 DAYS PAST DUE
    120 DAYS PAST DUE
    150 DAYS PAST DUE
    180 DAYS PAST DUE
    180 PLUS DAYS PAST DUE
    PREVIOUS BALANCE
    FILLER
    TRX CONTROL DATA
    CARDHOLDER HIERARCHY RECORD
    FIELD NAME
    RECORD TYPE
    TYPE INDICATOR
    COMPANY ID
    SUB COMPANY ID
    NODE ID
    ACCOUNT NUMBER
    FILLER
    TRX CONTROL DATA
    ACCOUNT HEADER RECORD 1
    FIELD NAME
    RECORD TYPE
    TYPE INDICATOR
    COMPANY ID
    SUB COMPANY ID
    PROCESSOR
    ACCOUNT NUMBER
    ACCOUNT TYPE
    LAST NAME
    CARDH FIRST NAME
    CARDH MIDDLE NAME
    ADDRESS LINE1
    ADDRESS LINE2
    ADDRESS LINE3
    ADDRESS LINE4
    ADDRESS LINE5
    CITY
    STATE / COUNTY/ PROVINCE
    POSTAL CODE
    COUNTRY
    NATIONAL ID
    TELEPHONE NUMBER
    WORK PHONE NUM
    ID VERIFICATION CODE
    DATE OF BIRTH
    CYCLE CODE
    FAX NUMBER
    E MAIL ADDRESS
    EMPLOYEE ID
    CLIENT ID / CUSTOMER NUMBER
    CUSTOMER VAT NUMBER
    TITLE
    STMT DATE
    GENDER
    FILLER
    TRX CONTROL DATA
    MAIN TRANSACTION RECORD
    FIELD NAME
    RECORD TYPE
    TYPE INDICATOR
    COMPANY ID
    SUB COMPANY ID
    CBS TR RUN DATE
    ACCOUNT NUMBER
    TRANS DATE
    TRANS TIME
    POST DATE
    FILLER
    AUTH REQUIRED
    AUTH ID
    CONVERS DATE
    POS ENTRY
    POS COND CODE
    ACQUIRER ID
    REFERENCE NUM
    TRACE NUMBER
    FILLER
    TRANS ID
    MCC
    MCC INFO DATA
    MERCH ACCEPTOR ID
    MERCH DESCRIPTION
    MERCHANT CITY
    MERCHANT STATE / PROVINCE
    MERCHANT POSTAL CODE
    MERCH COUNTRY
    MERCHANT VAT NUMBER
    MERCH DESC FLAG
    MERCHANT REFERENCE NUMBER
    SOURCE CURRENCY
    SOURCE AMOUNT
    BILLING CURRENCY
    BILLING AMOUNT
    SETTLEM CURRENCY
    SETTLEM AMOUNT
    US DOLLAR CURR
    US DOLLAR AMT
    GB POUND CURR
    GB POUND AMT
    EURO CURRENCY
    EURO AMOUNT
    ASIA YEN CURR
    ASIA YEN AMT
    SWED KRON CURR
    SWED KRON AMT
    CANADIAN CURR
    CANADIAN AMT
    CONVERSION RATE
    DB CR FLAG
    MEMO FLAG
    CORP ACCT NO
    SALES TAX
    SALES TAX FLAG
    VAT TAX
    VAT TAX FLAG
    PURCHASE ID
    PURCH ID FLAG
    TRAN TYPE
    NO OF ADDENDUMS
    VISA_MCI TRAN CODE
    ADDENDUM KEY
    TICKET NUMBER
    MSG TYPE
    FILLER
    VAT EVIDENCE FLAG
    CUSTOMER REFERENCE NUMBER
    DISCOUNT AMOUNT
    MESSAGE ID
    SUMMARY COMMODITY CODE
    CUSTOMER VAT NUMBER
    FILLER
    TRX CONTROL DATA
    The above mentioned is Just 50% of data will be received form the banks. Still footer details have to added.
    Thanks,
    Nandagopal C
    Edited by: Nandagopal Chiranjeevi on Feb 6, 2009 5:40 AM

  • In the component overview screen of CO01 I want  to disable all  the field in  screen of table control.I want to make it as output screen only.

    Hi all
      In the component overview screen of CO01 I want  to disable all  the field in  screen of table control.I want to make it as output screen only.
    Thanks & Regards,
    Rajib.

    Isn't that just exactly what transaction CO02 does? CO01 is for creating production orders so what sense does it make to have it display mode only?
    Maybe your goal is to stop then end user changing the component assignment that is automatically  detected by the system. If so, personally I think a better starting point would be PP configuration or user authorizations rather than looking to change the screen by whatever method. As we don't know what you are trying to achieve it's hard to offer much more advice maybe all you need is to change transaction to CO02

  • Is there a table/report that shows a list of the original tcodes vs tcodes?

    How to I find out the calling tcode of a transaction other than using SE93?
    e.g
    ABUM 's original tcode is AB01.
    Is there a table/report that shows a list of the original tcodes vs tcodes?

    Table TCDCOUPLES gives a list of called tcodes for a particular tcode.
    e.g
    For parameter tcode 1KEF  , called-tcodes are :
    1KE1
    1KEF
    1KEG
    OKKS
    BUT this table does not show which called-tcode is the original tcode.
    Using se93, I see that 1KEG is the original tcode.
    Is there a table that will show only the parameter tcodes vs orginal tcodes?

  • Can I Add all the fields from POOL to EXTRACT Structure in LBWE

    Dear Experts,
    Our Client is asking to add all the fields in the POOL Table to EXTRACT STRUCTURE in LBWE that is he wants to add all the fields from Right Hand Side Table to Left Hand Side Table in the Maintenance of LBWE of all the SD Data Sources. For few fields there is no data even though they are saying that in the nearer future we are going to use all most all fields.
    Like wise they are asking to add all the tables like VBAP, VBUP, VBAK, VBKD, VBUK, etc.,
    My Questions are:
    1.Is it advisable or recommended to add all the fields from POOL to Extract Structure because client desperately needs them.
    2.Is there any performance issue when we add the fields from POOL to Extract Structure at the time of extracting data from R/3 to BI.
    Regards,
    Sai Phani

    Hi Sai,
    1.Is it advisable or recommended to add all the fields from POOL to Extract Structure because client desperately needs them.
    we can add all the fields from the POOL to Extract Structure, if really your business requires to pull all the data.
    2.2.Is there any performance issue when we add the fields from POOL to Extract Structure at the time of extracting data from R/3 to BI.
    Ofcourse, there will be performance matters, because we have to extract maximum number fields data to BI side. If we have data for all the fields in R/3, we may face performance problems like load takes long time.
    Hope this helps.
    Veerendra.

  • Display all the fields in one screen shot

    Hi all,
    I am having 20 fields in the grid.
    but few fields are displaying in the grid and the scroll bar is existing to display other fields
    where as i need all the fields in on screen shot.
    let me know it .

    Hi ,
      One option would be to reduce the width of the fields in the catalog or manually after the data is displayed.
    Regards:
    Arun

  • When I upload a single file into a production in FCS I can access all the fields in the metadata set, when I upload a batch of files, I can only access a partial number of fields in the metadata set.  Does anyone know why this happens?

    When I upload a single file into a production in FCS, I can access all the fields in a metadata set.  When I upload a batch of files into the same production in FCS, I can all access part of the fields in the metadata set.  Does anyone know why this happens?

    dredcomm,
    Great answer, and it led me to where to solve the problem.  In the field definition screen there is a category drop down list.  If you choose something other than none from the category drop down list then that field won't appear in the list of fields when you attempt to batch import a group of files.
    Thanks,
    Dave

Maybe you are looking for

  • User defined function to check the NULL and 0.00 value in a Amount field

    Hi Experts, I have one scenario in which i have amount field in Data type. I have to create one UDF which will do the following thing. 1. If the amount field is Null it should throw an exception in mapping. 2.If the amount field is 0.00 it should thr

  • Male to female cable

    Does a "Male connector" to "female connector" cabe exist? I need to connect my iPod to the top connector of the iPod HiFi in a remote manner. My bookshelf does not have the height to fit the iPod ON TOP of the iPod HiFi...

  • Access rules policies in Cisco Security Manager

    Hello! We've started to deploy CSM 3.01 on our network (currently we have about 20 ASA's and this list is going to have about a 100 devices). The point is that we haven't used CSM's Policy View tab to develop our security policy - we've deployed our

  • Photoshop elements plug-in

    After installing the latest upgrade to PS Elements (13.1), the plug-in for Lightroom loads the previous version of the PSE Editor (13.0).  If I load directly, I get the new 13.1 version.  Applications folder shows the new 13.1 folders and the new ver

  • Different results of an store procedure

    Hi everyone, I have a partitioned table (by day of the week) and an store procedure that selects some records from a especific partition (that one that represents "today"). Inside Oracle client I get the result I'm expecting, but when I call the proc