How to sum up the quantity

hi
Below is my code....
i want to sum up the  B~ERFMG (Quantity) for 261,262,201,202 movement type
how to do this ?
select A~MBLNR
         A~BLDAT
         A~XBLNR
         B~CHARG
         B~WERKS
         B~LIFNR
         B~MATNR
         B~ERFMG
         B~ERFME
         B~aufnr
         B~BWART
    into table IT_MKPF
    from MKPF as A inner join MSEG as B on A~MBLNR = B~MBLNR
    where B~MATNR in S_MATNR
    and   B~WERKS = P_WERKS
    and   B~CHARG in S_CHARG
    and   A~BUDAT in S_BUDAT
    and   B~BWART in ('101' , '351' , '261' , '262' , '201' , '202' ).

Hi,
Change your code like this and check
select A~MBLNR
         A~BLDAT
         A~XBLNR
         B~CHARG
         B~WERKS
         B~LIFNR
         B~MATNR
       SUM(  B~ERFMG )
         B~ERFME
         B~aufnr
         B~BWART
    into CORRESPONDING FIELDS OF table IT_MKPF
    from MKPF as A inner join MSEG as B on A~MBLNR = B~MBLNR
    where B~MATNR in S_MATNR
    and   B~WERKS = P_WERKS
    and   B~CHARG in S_CHARG
    and   A~BUDAT in S_BUDAT
    and   B~BWART in ('101' , '351' , '261' , '262' , '201' , '202' ).
Regards,
Vikranth

Similar Messages

  • How can I see the quantity of battery cycles on Satellite U200-181?

    I have Satellite U200-181, and I use it hard, every. I want to be ready replace my battery, when it will have 400 cycles.
    How can I see the quantity of battery cycles on my laptop?

    You must not see this. You will see that capacity of the battery drops down and will be empty after short time. Nobody say that you will be able to use battery 400 cycles only. Maybe you will be lucky and the battery will have longer life time.
    My Tecra M1 is about 4 years old and still working with original battery.
    Your question is pretty unusual and I am really interested about further comments.

  • Require a function module to calculate sum of the quantity based on GRNDATE

    hi friends,
    I need to calculate the sum of the quantity based on GRN DATE and invoice date.
    the invoice date given in select-options should be captured by program and from the previous day it need to retrieve the GRN dates and corresponding quantities and i need to do the summation of all these quantities can anybody tell any function module.
    Thanks in advance.

    Try function MD_CONVERT_MATERIAL_UNIT
    the table of UOM's is MARM.
    Doug

  • How can i limit the quantity in sales order

    Dear sd gurus
    how can i restrict no of items in sales order? ex:sales
    order has been created for 10 items and all the 10 items
    quantity should be 72 not more than that and system should
    not allow to enter the quantity.where we can configure for
    this.
    thank s
    venu
    Please search the forums before posting - see [rules of engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]. You have been warned before about this. 
    Edited by: Ian Kehoe on Mar 5, 2012 5:31 PM

    Hello,
    I believe your requirement is possible in SAP Standard.
    You will have to go for ABAP Development & apply a Exit in Sales Order.
    You can use Program MV45AFZZ & apply ehtier userexit_field_modification or userexit_move_field_to_vbak or userexit_read_document or userexit_save_document
    Hope this helps,
    Thanks,
    Jignesh Mehta

  • How can i convert the quantity of one unit to other unit in BI 7?

    Hi ,
    I have developed an RFC function module in SAP BW (BI 7.0).
    For this function module I have to populate material  number and  Quantity required and UNIT.Every thing working good. If the user forgets to enter unit  or enters other unit  where Quantity in ODS is not mentioned in terms of that unit.WE have to Convert the Quantity requested into the Qunantity that exist in ODS or DATA BASE  based on the unit of measure .
    Please suggest me how can I convert the UNIT of measure of quantity?
    Thanks,
    Suresh.

    I have to do this with conversion table /BIO/PMAT_UNIT.
    IN THIS TABLE I DON'T KNOW HOW CAN I CONVERT?
    REGARDS,
    SURESH.

  • How can i add the Quantity field

    i am extracting the data from oracle to SAP BW.Now i want to add all the quantity and xtract to my infocube.
    eg:
    in Oracle
    QTY
    10
    20
    30
    in Bw i want to get
    QTY
    60
    Could any one help me on this?

    when i load to cube all key figure values will be aggregated.
    eg:
    Oracle it is
    10
    20
    30
    in cube
    60

  • How can i know the quantity of Raw materials in all 4 plants

    There are 4 manufacturing plants and i want to know the status for all the raw material in the 4 plants , Is it possible to have a consolidated report ?

    Hi vivek ,
    Thanks,, Had one more query, can i get a report where i can have the material quantity and value, across for all the plants at a starting of period and the quanity and value of the material  consumed and balance.at the end of the period
    Example; I have a raw material -COPPER ROD , Period is from 1 April2010 to 1 July 2010, I want to know what was the Quanity and Value of copper rod acorss 4 Plants, how much has been consumed (Quanity and Value) and how muchis left(Quanity & Value) as on 1 july2010
    Thanks..Gaurav

  • How to sum only the positive numbers in a Pivot table when using Power Pivot

    Hi, I have this schema:
    …and this Pivot:
    How do I get this result from PowerPivot.
    If I only use normal Excel Pivot I could use Calculated Field and get the wanted result in a snatch.
    But I guess the problem with using PowerPivot in this scenario is a context or/and a aggregation problem?
    Here is the formula I try to use (I have also tried the FILTER function but couldn’t get it right):
    TRUE DEMAND (Forecast- Stock>0) =
    CALCULATE([TOTAL DIFF (FORECAST-STOCK)],
    [TOTAL DIFF (FORECAST-STOCK)]>0)
    Here is my ExcelFile:
    https://onedrive.live.com/redir?resid=B7906DD091ACC085!357&authkey=!AJN_r_1NCP4thrE&ithint=file%2cxlsx
    Any suggestions?
    Best Regards
    Tommy

    Hi Tommy,
    sorry, a few words are not enough.
    This post does explains it in detail:
    http://sqlblog.com/blogs/marco_russo/archive/2010/01/03/how-calculate-works-in-dax.aspx
    Imke

  • How do I find the quantity of bookmarks on the bookmark menu tab?

    When I use to open the Bookmark Menu, in the past, there was a number displayed that showed the number of bookmarks. This stopped happening a week or two ago. How can I easily, automatically get this information? Thanks.

    A way to see the total Bookmarks count is to open the Bookmarks Manager (Library) and type a common character like a ':' in the search bar. If you focus the right pane and press Ctrl+A to select all found items then you will see the count.

  • How to sum the quantity in opportunity ?

    Hi all,
    On the opportunity detail page, you can add an "opportunity product revenue". For each record you define the quantity and the purchase price. When you click on the "Update opportunity Totals", the revenue field from opportunity is automatically updated with the sum of the opportunity product revenues. I would like to do the same not with the revenue but with the quantity. Is it possible to do so, or is it an other way to get the sum of the quantity ?
    Thanks for your answer.
    Regards,
    Guillaume

    You cannot perform this function within the native application and you would need to create a webservice query to complete this

  • How to cummuale the quantity

    hi
    how can i cummulate the quantity from multile records into one record from unique fields Plant,matnr,lgort.
    please help me

    Syntax Diagram
    COLLECT
    Basic form
    COLLECT [wa INTO] itab.
    Extras:
    1. ... ASSIGNING <fs>
    2. ... REFERENCE INTO dref
    3. ... SORTED BY f
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Short Forms in Line Operations.
    Effect
    COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entry corresponding to the table key. (See also Defining Keys for Internal Tables). The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa. The line type of itab must be flat - that is, it cannot itself contain any internal tables. All the components that do not belong to the key must be numeric types ( ABAP Numeric Types).
    If the system finds an entry, the numeric fields that are not part of the table key (see ABAPNumeric Types) are added to the sum total of the existing entries. If it does not find an entry, the system creates a new entry instead.
    The way in which the system finds the entries depends on the kind of the internal table:
    STANDARD TABLE:
    The system creates a temporary hash administration for the table to find the entries. This means that the runtime required to find them does not depend on the number of table entries. The administration is temporary, since it is invalidated by operations (such as DELETE, INSERT, MODIFY, or SORT). A subsequent COLLECT is then no longer independent of the table size, because the system has to use a linear search to find entries. For this reason, you should only use COLLECT to fill standard tables.
    SORTED TABLE:
    The system uses a binary search to find the entries. There is a logarithmic relationship between the number of table entries and the search time.
    HASHED TABLE:
    The system uses the internal hash administration of the table to find records. Since (unlike standard tables), this remains intact even after table modification operations, the search time is always independent of the number of table entries.
    For standard tables and SORTED TABLEs, the system field SY-TABIX contains the number of the existing or newly-added table entry after the COLLECT. With HASHED TABLEs, SY-TABIX is set to 0.
    Notes
    COLLECT allows you to create a unique or summarized dataset, and you should only use it when this is necessary. If neither of these characteristics are required, or where the nature of the table in the application means that it is impossible for duplicate entries to occur, you should use INSERT [wa INTO] TABLE itab instead of COLLECT. If you do need the table to be unique or summarized, COLLECT is the most efficient way to achieve it.
    If you use COLLECT with a work area, the work area must be compatible with the line type of the internal table.
    If you edit a standard table using COLLECT, you should only use the COLLECT or MODIFY ... TRANSPORTING f1 f2 ... statements (where none of f1, f2, ... may be in the key). Only then can you be sure that:
    -The internal table actually is unique or summarized
    -COLLECT runs efficiently. The check whether the dataset
    already contains an entry with the same key has a constant
    search time (hash procedure).
    If you use any other table modification statements, the check for entries in the dataset with the same key can only run using a linear search (and will accordingly take longer). You can use the function module ABL_TABLE_HASH_STATE to test whether the COLLECT has a constant or linear search time for a given standard table.
    Example
    Summarized sales figures by company:
    TYPES: BEGIN OF COMPANY,
            NAME(20) TYPE C,
            SALES    TYPE I,
          END OF COMPANY.
    DATA: COMP    TYPE COMPANY,
          COMPTAB TYPE HASHED TABLE OF COMPANY
                                    WITH UNIQUE KEY NAME.
    COMP-NAME = 'Duck'.  COMP-SALES = 10. COLLECT COMP INTO COMPTAB.
    COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB.
    COMP-NAME = 'Duck'.  COMP-SALES = 30. COLLECT COMP INTO COMPTAB.
    Table COMPTAB now has the following contents:
              NAME    | SALES
              Duck    |   40
              Tiger   |   20
    Addition 1
    ... ASSIGNING <fs>
    Effect
    If this statement is successfully executed, the field symbol <fs> is set to the changed or new entry. Otherwise the field symbol remains unchanged.
    Addition 2
    ... REFERENCE INTO dref
    Effect
    If this statement is successfully executed the reference to the relevant line is placed in dref. Otherwise the data reference dref remains unchanged.
    Addition 3
    ... SORTED BY f
    Effect
    COLLECT ... SORTED BY f is obsolete, and should no longer be used. It only applies to standard tables, and has the same function as APPEND ... SORTED BY f, which you should use instead. (See also Obsolete Language Elements).
    Note
    Performance:
    If you are still using internal tables with headers but, as recommended, keep your data in work areas with a different name, you do not need to assign the data to the header first in order to pass it to the internal tables. Instead, you should use the work area directly as with tables without headers. For example, "APPEND wa TO itab." is roughly twice as fast as "itab = wa. APPEND itab.". The same applies to COLLECT and INSERT.
    The runtime of a COLLECT increases with the width of the table key and the number of numeric fields whose contents are summated.
    Exceptions
    Catchable Exceptions
    CX_SY_ARITHMETIC_OVERFLOW
    Cause: Overflow in the integer field when forming totals
    Runtime Error: COLLECT_OVERFLOW
    Cause: overflow in type P field when forming totals
    Runtime Error: COLLECT_OVERFLOW_TYPE_P
    Non-Catchable Exceptions
    Cause: COLLECT on non-numeric fileds
    Runtime Error: TABLE_COLLECT_CHAR_IN_FUNCTION
    Related
    APPEND, WRITE ... TO, MODIFY, INSERT
    Additional help
    Inserting Summarized Table Lines

  • How to find the quantity of items under WIP job and under PO?

    Hi,
    How can I find the quantity of the Items that are under:
    1. WIP Jobs that are not yet completed?
    2. PO that are not yet received?
    Kindly help me. If you have proper query for it, let me know.
    Regards,
    KM

    select  e1.empno,
            e1.ename,
            e2.direct_managed_employee_count
      from  emp e1,
             select  mgr,
                     count(*) direct_managed_employee_count
               from  emp
               group by mgr
            ) e2
      where e2.mgr = e1.empno
         EMPNO ENAME      DIRECT_MANAGED_EMPLOYEE_COUNT
          7566 JONES                                  2
          7698 BLAKE                                  5
          7782 CLARK                                  1
          7788 SCOTT                                  1
          7839 KING                                   3
          7902 FORD                                   1
    6 rows selected.
    SQL> SY.

  • Sum of the line items

    Hi,
    I am working on report . I want sum of the quantity of the line items at the end of material .
    I am using AT END OF MATNR.Here i am getting problem when same material have different plants i want the closing quantity separate according to plant . AT END OF MATNR is triggering only when new material no came but i require when plant and material any one change .Can you please suggest me.
    example
    matnr plant  openingqua         grsqua    closingqty
    4000 1030  100                      1000
    4000 1030                              2000
    4000 1030                              3000        7100
    4000 1031 200                      2000        
    4000 1031                              5000          9000
    4001 1030  100                      1000
    4001 1030                              2000
    4001 1030                              3000        7100
    4001 1031 200                      2000        
    4001 1031                              5000          9000
    Like this i require in o/p .
    Regards
    Nandan

    Hi,
    In my report we have only one company code and 3780 material with plant 1030 1031 1010 .
    I require some all line items qunatities according materialno and plant .
    example
    materialno1  and plant1
    materialno1 and plant2
    materialno1 and plant3
    materialno2 and plant1
    materialno2 and plant2
    materialno2 and plant3
    Regards
    Nandan

  • Regarding alv function of summing up the values of  columns.

    hi friends:
       could you please tell me how to sum up the values of  columns.
    for example, there are columns of room rent, expense of cell phone call,
    expense of taxi fee.
    thank you very much

    hi For calculating one more coloum . try this logic
    write this piece of code in wddoinit
    data : lt_column type salv_wd_t_column_ref,
             ls_column type salv_wd_s_column_ref,
             lo_aggr_rule TYPE REF TO cl_salv_wd_aggr_rule.
    * display columns in correct order
      lr_column_settings ?= wd_this->lr_config.
      lt_column = lr_column_settings->get_columns( ).
    loop at lt_column into ls_column.
        case ls_column-id.
          when 'ROOM_RENT'.
    * aggregate field
            call method lr_config->if_salv_wd_field_settings~get_field
              exporting
                fieldname = 'ROOM_RENT'
              receiving
                value     = lr_room_rent_total.
    * create aggregate rule as total
            call method lr_field_amnt->if_salv_wd_aggr~create_aggr_rule
              exporting
                aggregation_type = if_salv_wd_c_aggregation=>aggrtype_total
              receiving
                value            = lv_aggr_rule.
          when 'CALL'.
    * aggregate field
            call method lr_config->if_salv_wd_field_settings~get_field
              exporting
                fieldname = 'CALL'
              receiving
                value     = lr_call_AVG.
    * create aggregate rule as total
            call method lr_field_amnt->if_salv_wd_aggr~create_aggr_rule
              exporting
                aggregation_type = if_salv_wd_c_aggregation=>AGGRTYPE_AVERAGE
              receiving
                value            = lv_aggr_rule.
        endcase.
    endloop.
    Regards
    Chinnaiya

  • Summing up the average field

    Post Author: jehanzeb
    CA Forum: Formula
    Dear all,
    how can we achive the following:
    I have two fields which are created using formula. My question is how can I get the grand total of those two fields. I have tried using the formula
    whileprintingrecords;numbervar myaverage;
    but this doesnt work.
    any ideas how to sum up the formula created fields?
    many thanks
    Regards

    Post Author: tsamara
    CA Forum: Formula
    Hi,
    First, are you able to sum up your fields individually at the grand total level?
    Then, if I understand your issue correctly, first do Sums of both fields and at the 'Grand Total' level and create a new Average formula.
    Good luck,
    Tony

Maybe you are looking for

  • Report Builder Layout Model Missing

    when I went to edit an existing report in 10g, I found the display of the Layout model is missing. The fields and frames are all visible in the Object Navigator but they just don't show up in the layout screen. Is there an easy way to fix this - or d

  • When I attempt to send a message the app quits immediately as I hit the send button.

    When I attempt to send a message the app quits immediately as I hit the send button. iMessage also doesn't work. I have tried restoring it and that has failed.

  • Cineware multi pass not rendering properly.

    Some screens that show my issue. Looked online can't find anything about this. My multi pass layers do not render properly in AE rendering them useless no pun intended. Please Help!! Here are my specs Running latest AE as well Some examples of my iss

  • PHOTOSHOP version 7.0----How to remove a blur from a pic?

    I've done everything to try an remove the blur from my pictures but nothig works, can someone help me? I have Windows XP and have contacted the Photoshop support phoneline but as usual they wont help me because im not willing to spend more money on t

  • Video slideshow

    I have a presentation of 20 slides. Each slide contains a full screen video of various durations I want to run the presentation in a loop, so once I hit play on slide 01 it plays it's movie for the full duration, then advances automatically to the sl