How to get the sum in BSEG table using select statement

hai all
i made the internal tale "itab1" .. i want to get the som  feild of  DMBTR in BSG table my code is here but its not working gave som error massage (Aggregate functions and the addition DISTINCT are not supported in field lists for pooled and cluster tables.)  plz tel me how should i do it..... i want to get the som of that feild....          
loop at itab1
     SELECT sum( DMBTR  ) from bseg INTO itab1-DMBTR141_45
         where GJAHR = itab1-GJAHR
         and   BELNR = itab1-BELNR.
endloop.
regard
nawa

SELECT BELNR GJAHR SHKZG DMBTR
             from bseg
             INTO table it_bseg
             for all entries in itab1
             where GJAHR = itab1-GJAHR
               and BELNR = itab1-BELNR.
loop at it_bseg.
    IF it_bseg-shkzg = 'H'.
      it_bseg-dmbtr = it_bseg-dmbtr * ( -1 ).
    ELSE.
      it_bseg-dmbtr = it_bseg-dmbtr.
    ENDIF.
    MODIFY it_bseg.
endloop.
loop at it_bseg.
READ TABLE itab1 with key belnr = it_bseg-belnr
                           gjahr = it_bseg-gjahr.
if sy-subrc = 0.
collect it_bseg into it_bseg_amount.
endif.
endloop.
U can use the collect statement
Regards
Gopi

Similar Messages

  • How to get all values from an interval using select statement

    Hi,
    Is it possible to write a select statement that returns all values from an interval? Interval boundaries are variable.
    something like this:
    select (for x in 1,1024 loop x end loop) from dual
    (this, of course, doesn't work)
    The result in this example should be 1024 rows of numbers from 1 to 1024. These numbers are parameters, so it is not possible to create a table with predefined values.
    Thanks in advance for your help,
    Mia.

    For your simple case, with a lower boundary of 1, you can use:
    SELECT rownum
    FROM all_objects
    WHERE rownum <= 1024For a set of number between say 50 - 100, you can use something like:
    SELECT rownum + (50 - 1)
    FROM all_objects
    WHERE rownum <= (100 - 50 + 1)Note, that all_objects was used only because it generally has a lot of rows. Any table with at least the number of rows in your range will work.
    TTFN
    John

  • How to get the data from Pooled Table T157E.

    Hi Experts,
    How to get the data from Pooled Table T157E.
    Any help.
    Thanks in Advance,
    Ur's Harsha.

    create some internal table similar to T157E and pass all data as per SPRAS.
    After that use internal table in your program as per the requirement.
    Regds,
    Anil

  • How to update the data in sqlserver table using procedure in biztalkserver

    Hi,
    Please can any one answer this below question
    how to update the data in sqlserver table using procedure in biztalkserver
    while am using executescalar,typedprocedure getting some warning
    Warning:The adapter failed to transmit message going to send port "SendtoSql1" with URL "mssql://nal126//MU_Stage2?". It will be retransmitted after the retry interval specified for this Send Port. Details
    Please send me asap....
    Thanks...

    Hi Messip,
    A detailed error would have helped us to answer you more appropriately but
    You can follow the post which has step by step instructions, to understand how to use Stored Procedure:
    http://tech-findings.blogspot.in/2013/07/insert-records-in-sql-server-using-wcf.html
    Maheshkumar
    S Tiwari|User
    Page|Blog|BizTalk
    2013: Inserting RawXML (Whole Incoming XML Message) in SQL database

  • How 2 get the path of a file Using jsp

    how 2 get the path of a file Using jsp
    i have tried getPath...but i'm geting the error
    The method getPath(String) is undefined for the type HttpServletRequest
    any idea how 2 get the path of a file

    You need ServletContext#getRealPath().
    API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)

  • How to get the form name which is used in standard tcode like me23n in sap

    how to get the form name which is used in standard tcode like me23n in sap
    Moderator message: four out of four threads locked, please read and understand the following before posting further:
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers]
    Edited by: Thomas Zloch on Nov 18, 2011 1:32 PM

    how to get the form name which is used in standard tcode like me23n in sap
    Moderator message: four out of four threads locked, please read and understand the following before posting further:
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers]
    Edited by: Thomas Zloch on Nov 18, 2011 1:32 PM

  • How to find the number of fetched lines from select statement

    Hi Experts,
    Can you tell me how to find the number of fetched lines from select statements..
    and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
    Thanks in advance
    santosh

    Hi,
    Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
    For ex:
    data: itab type mara occurs 0 with header line.
    Select * from mara into table itab.
    Write: Sy-tabix.
    This will give you the number of entries that has been selected.
    I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
    Hope this helps,
    Sudhi
    Message was edited by:
            Sudhindra Chandrashekar

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • How to get the sum total of just one row in the dashboard

    How do I get the sum total of one row in the compound layer results. This is 11g
    Does anyone know?
    may be sales, I need the total at the bottom of the row..
    thx
    Chuck

    I fnd the answer,
    in the table view, click edit then nxt to the columns and measures there is total sum icon. Click that, and choose after

  • How to get the value from Advanced table

    Hi,
    In the Advanced table have 2 LOV fields, I need LOV field value dynamically in the controller to validate the save button, if iam not selected any value in lov save button will not allow to save the data. In the table i am using 'Add another row'. How to get the lov field value in the process form request??? and how to do this requirement
    Thanks
    Naresh

    1. You can specify required property on LOV field to "yes". For events where you wish to disable the client side validations, set the property disable client side validation to "true".
    2. If above behavior is not what you are looking for, then you need to handle in AM and not CO.
    a. Call an AM method from CO.
    b. In that AM method, get handle of VO.
    c. Iterate the VO Rows and check for your validation rules.
    -Prince
    http://www.princekapoor82.blogspot.com

  • How to get the script of a table or view in SQL Developer?

    Dear friends/expert,
    Could you tell me how to get the script for a view or a table easily in SQL Developer like pressing F4 in TOAD?
    I found that I can press SHIFT+F4 for a view in SQL Developer and get the script of the view in Details Tab. But how to move the script to SQL worksheet to edit? It is very easy to do in TOAD.
    And I didn't find a way to get the script for a table till now. Is there any way to do that?
    Thanks in advance.
    Best regards,
    Ning

    1. Although the team might put a lot of effort in keeping track on the forum, a lot of posts still go by without answer.
    2. If you have an enhancement request, log it at the announced SQL Developer Exchange, so others can vote to add weight on the issue. Be clear and detailed in the explanation.
    3. Given the structure of the application, I guess it won't be easy (maybe impossible) to add the functionality you are asking. Do you have a suggestion on how to access the info?
    4. If your request gets accepted, still another year or two may go by until the functionality gets added. For sure you'll be better off writing a user defined extension or report (querying DBMS_METADATA.GET_DDL).
    Hope that helps,
    K.
    Edited by: -K- on 12/01/2009 09:37

  • How to get the 'link' between two tables

    hi pple
    i need to find out HOW two tables are related.
    sample tables:
    SHIPS ( HULL_ID [PK] , VESSEL_NAME, GROSS_TONNAGE )
    EQUIPMENT ( E_ID [PK] , HULL_ID [FK frm SHIPS], DESC )
    PARTS ( PART_ID [PK] , E_ID [PK, FK frm EQUIPMENT], MANUFACTURER_ID)
    --> SHIPS and PARTS are some how related thro' EQUIPMENT.
    i need to get this relationship:
    Ships --> Equipment (E_ID) --> PARTS
    currently, i can get the direct parent and child tables of a given table using:
    SELECT lpad ( ' ', 2 * ( LEVEL - 1 ) ) || table_name as Child_Tables
    FROM ALL_CONSTRAINTS
    START WITH R_CONSTRAINT_NAME in
    select constraint_name
    from all_constraints
    where table_name = '%table_name%'
    and constraint_type = 'P'
    CONNECT BY PRIOR CONSTRAINT_NAME = R_CONSTRAINT_NAME ;
    To get ALL parents:
    SELECT lpad ( ' ', 2 * ( LEVEL - 1 ) ) || table_name as Parent_Tables
    FROM ALL_CONSTRAINTS
    where owner = 'CHARTUSER'
    START WITH CONSTRAINT_NAME in
    select constraint_name
    from all_constraints
    where table_name = '%table_name%'
    and constraint_type = 'R'
    CONNECT BY PRIOR R_CONSTRAINT_NAME = CONSTRAINT_NAME ;
    what i need to do is:
    1) get children & parents of SHIPS
    2) for each element of (1), get children, parents till i get PARTS
    3) so, i will get EQUIPMENT and then, PARTS.
    this wud be very expensive. my appln is in Java and i will need to call these functions - that makes it more complex. is there any simpler way out?
    and my main problem is to find out WHAT attributes line two tables. this wudnt be a big deal if it were just simple parent-child tables. but, how do i find out the attributes that link PARTS and SHIPS table?
    any ideas? -please help.
    thanks in advance
    --$uDhA

    Dear Srikanth,
    This tables can be used once we come to know whether its a customer or vendor line item but in our case we using the GL account as reference have to knock off the entries.How we come to know that aginst the GL whether its a customer or vendor line item.. Then it should route to this table.
    Suggest me if any options are there.
    Regards,
    Balaji.c

  • How do I get the rowcount of target table using Sunopsis API in ODI 10g ?

    Hi guys,
    Actually I want to send an alert mail once interface is run from a package. I have included OdiSendMail alert which sends a mail once interface is run.
    Could anyone please tell how to get the no of rows inserted in the target table from Sunopsis API.
    I tried using <%=odiRef.getNbRows( )%> but this did not work for me. Since I'm a beginner, could you please help me out
    This is my ODI send mail format
    " Data population has been completed successfully at <%=odiRef.getSysDate( )%>
    Total rows in target table are: <-- need some API code --> ''
    Regards,
    Clinton
    Edited by: LawrenceClinton on Feb 25, 2013 8:53 PM

    Hi
    Create project variable with below details
    Variable_name: Total_Row_Count
    Variable Type: Refresh Variable
    Definition Tab:
    Datatype: Numeric
    Action: Not Persistent
    Refreshing Tab:
    Schema: provide your Work Repository Schema and be
    SELECT log.nb_row
    FROM snp_step_log log, snp_scen_step step
    WHERE log.nno = step.nno
    AND step.scen_no =( SELECT scen_no FROM snp_scen_step WHERE step_name='<%=odiRef.getPrevStepLog( "STEP_NAME" )%>' )
    AND log.sess_no = '<%=odiRef.getSession( "SESS_NO" )%>'low code
    AND step.step_name = '<%=odiRef.getPrevStepLog( "STEP_NAME" )%>'
    Note: Add this variable after interface step in your package (after the interface any where you can place), you can add this variable before ODISendEmailNotification Step in your package
    Call this varciable *#Total_Row_Count* in ODISendEmail Notification
    eg:
    Data has been populated successfully at <%=odiRef.getSysDate( )%>
    Total no of rows populated are : *#Total_Row_Count*
    It will work
    Regards,
    Phanikanth
    Edited by: Phanikanth on Feb 28, 2013 1:13 AM
    Edited by: Phanikanth on Feb 28, 2013 1:14 AM

  • How to get the data in a table in horizontal order

    when i execute the command "select empno from emp" i would get the output in vertical order
    How to get the output in horizontal order

    Did you search in the forum before posting your question? Every week similar question like yours is being posted. Anyway find below the query.
    SELECT LTRIM(MAX(SYS_CONNECT_BY_PATH(EMPNO,';')),';')
    FROM
    SELECT EMPNO,ROW_NUMBER() OVER(PARTITION BY 1 ORDER BY 1) CURR,ROW_NUMBER() OVER(PARTITION BY 1 ORDER BY 1)+1 NEXXT
    FROM EMP
    START WITH CURR=1
    CONNECT BY CURR = PRIOR NEXXT
    Regards,
    Mohana

  • Newbie ques : How to get the list of all tables in the database

    Hi,
    I'm very new to Oracle (using Oracle8i currently). I wanted to know if there is a way to get the list of all tables in the database. Like in mySQL you can use the command " show tables" to get the list of all the tables.
    Any help will e greatly appreciated. Please "cc" any reply to [email protected] also.
    thanks
    Deven

    Hi
    Select table_name, owner from all_tables;
    will give u all the tables in the database.
    all_tables, dba_tables, user_tables
    all_objects, dba_objects, dba_objects
    there are many, more tables. login as system and query the tab and try to describe the tables.
    Thanks
    Malar

Maybe you are looking for