Doubts in query ..

Hi Genius,
              I have a doupts in Report..
      <b> budat = 01.04.2007 to 30.04.2007</b> 
      <b> matnr = a001</b>
       SELECT * FROM zs_mkpf_mseg
                    into corresponding fields of table it_opbal
                    WHERE werks =  itmat-werks
                    AND matnr = itmat-matnr
                    AND budat LT s_budat-low.
Now iam getting the opening balance..that is the closing balance of up to
30-3-2007.
My req is..between 1st month to 30th, i have to calculate the opbal of every day wise(1-4-07 to 30-4-07) for that how i should write the query statement.
please suggest me.

Hi
SELECT gjahr belnr  FROM bseg
                    into corresponding fields of table int_bseg
                    WHERE werks =  itmat-werks
                    AND budat = s_budat-low.
loop at int_BSEG.<-- loop at ur date declared internal table
read table int_bseg WITH KEY BELNR = INT_BSEG-BELNR
        GJAHR = INT_BSEG-GJAHR. <-- to read the same internal table
IF int_bseg-belnr = 'compare value'.
        total = total + int_bseg-belnr. " here goes ur coding part for date "
try like thi s
Reward all helpfull answers
Regards
Pavan

Similar Messages

  • Doubt in Query designer

    Hi all:
    I have a doubt in Query ...
    I have an infocube for GR quantities and other infocube for confimation quantities.
    In a multiprovider,i collect this two cubes.In query designer,if i given GR date as i/p,
    confirmation quantities doesnt display.IF i didnt give GR date as i/p,then both GR and Confimation
    quantities display in seperate line.In that case if i see the confirmation quantitis column,GR quantity is
    and same for GR quanitiy.
    Waiting for your inputs.
    Rgds
    MSK

    MSK,
    These two pieces of information are at different levels. GR Date is mapped only to the GR quantities cube and no mapped to the confirmation quantities cube.
    Map GR date in the multi-provider to a date in the confirmation quantities cube.
    Aneesh

  • Doubt in query statement in receiver jdbc

    HI
    Again a doubt in XML format for receiver jdbc.
    I want to execute a query
    select sum(col1) sum(col2) from tablename where startdate <= tdate.
    My payload message looks like this
    <AggregateFn action="SQL_QUERY">
      <access>SELECT sum(Weight) FROM KmFuelTrace WHERE resourceno = '$resno$' AND startdate = '$sdate1$'</access>
    - <key>
      <resno compareOperation="EQ">CHILLED_02</resno>
      <sdate1 compareOperation="LT">06/08/2007</sdate1>
       </key>
      </AggregateFn>
    I am getting a error "Data type mismatch in criteria expression" .
    I have defined the datatypes correctly with DateTrans function . I think its the problem with access statement.
    How to give the selection criteria for non-text fields. (can i use same quotes and dollar combination for date field too) . Or is there any other mistake in the xml structure

    Aarthi,
    Try the following
    <AggregateFn action="SQL_QUERY">
    <access>SELECT sum(Weight) FROM KmFuelTrace WHERE resourceno = '$resno$' AND startdate = $sdate1$</access>
    - <key>
    <resno compareOperation="EQ">CHILLED_02</resno>
    <sdate1 compareOperation="LT">06/08/2007</sdate1>
    </key>
    </AggregateFn>
    Also check what us the date format that database uses and give the similar format.
    Regards,
    Sudharshan N A
    Message was edited by:
            Sudharshan Aravamudan

  • Regarding Doubt in Query

    Hi Friends,
    I have a doubt in Oracle Query.
    Query
    SELECT ID FROM LIST;
    ResultSet
    1
    2
    3
    4
    5
    789
    In the above query the result will in seperate rows, bu i want it as
    1,2,3,4,5.............,789.
    Can anyone help me to write a query for this type of output.
    Thanks,
    Dick....

    with t as(select 1 col1 from dual
    union select 2 from dual
    union select 3 from dual
    union select 4 from dual
    union select 5 from dual
    union select 6 from dual)
    select   ltrim(max(sys_connect_by_path(to_char(col1),',')),',') col1
    from (select col1,
           row_number() over(order by col1) r1,
           row_number() over(order by col1)-1 r2
          from t)
    start with r1 = 1
    connect by prior r1=r2;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Doubts in Query & Infoset Builder

    Hi All,
    I have a problem/doubt with my query, Due to a requirement I have to place a Check box in my Selection scree of Query.
    Unfortunately when I place my Checkbox in Info-set(SQ02), Its showing check Box at first place.
    Example:
    We have a Query with selection screen fields as
    MBLNR
    MJAHR
    MATNR
    MENGE
    Now When I add a Checkbox in SQ02 & when I run the report, I am getting this Checkbox, at Top of selection screen.
    Actually I am looking to have this Check box after my selection-screen elements.
    I tried with Sequence on selection-screen, but its only working with the fields declared in Selections.
    Is there any chance like I can declare my Selection screen parameters in the position I want.
    Please advice me.
    Thanks,
    Dileep .C

    user10447332 wrote:
    (!)select * from emp where rownum>5
    it wont give o/p/what is the reason.
    if we mention rownum<=5 then it gives o/p what is the reasonIts because rownum is applied to the row at the last stage of fetch. It is applied to the row which would be displayed to the user. So after your row is ready to be shown to the requester, it is assigned rownum as 1 and then oracle checks if it is greater than 5. Since the result is false, this row is rejected and next row is given rownum as 1 and checked again. Since all rows would fail (as all rows would be assigned as rownum 1) you would get no rows selected.
    (2)
    i have two data bases. i want to import 2 tables from database1 to data base2.how to do it.
    Well you can use
    - exp/imp
    expdp/impdp
    copy commmand
    db link
    (3)i have servers at 3 locations us,uk,asia.
    if data is changed in one server.it should reflect in all servers.
    if we query from any server we have to get same result how to do it.You can use
    materialized view
    oracle streams
    3rd party tool like golden gate
    (4)
    i have data in excel file.i want to load data from excel file int o my tavble .how to do it(dont use sql loader)I only know sql loader as a way to do it
    Regards
    Anurag

  • Doubt in Query(on 28th)

    Hi all
    I wrote the following query
    SELECT COUNT(DISTINCT QUESTION_ID) AS QCOUNT,
    DECODE(((SUM(SUM(WORK_SPACE))/5)*100)/QCOUNT,<50,COUNT(DISTINCT RESPONSER_ID)) AS COUNT1,
    DECODE(((SUM(SUM(WORK_SPACE))/5)*100)/QCOUNT,>=50 AND <=60,COUNT(DISTINCT RESPONSER_ID)) AS COUNT2,
    DECODE(((SUM(SUM(WORK_SPACE))/5)*100)/QCOUNT,>=60 AND <=75,COUNT(DISTINCT RESPONSER_ID)) AS COUNT3,
    DECODE(((SUM(SUM(L.WORK_SPACE))/5)*100)/QCOUNT,>75,COUNT(DISTINCT RESPONSER_ID)) AS COUNT4
    FROM TQDB_LEARNER_RESPONSE
    Can i use QCOUNT IN DECODE Function.
    I am getting 'Missing Expression Error"
    Is thr any other alternative to write this query
    Regards.

    Hi Thanks for reply.
    I have changed my query as following.
    SELECT
    CASE WHEN (((SUM(DISTINCT WORK_SPACE)/5)*100)/COUNT(DISTINCT QUESTION_ID))<50 THEN COUNT(DISTINCT RESPONSER_ID) ELSE NULL END AS COUNT1,
    CASE WHEN (((SUM(DISTINCT WORK_SPACE)/5)*100)/COUNT(DISTINCT QUESTION_ID))>=50 AND (((SUM(WORK_SPACE)/5)*100)/COUNT(DISTINCT QUESTION_ID)) <=60 THEN COUNT(DISTINCT RESPONSER_ID) ELSE NULL END AS COUNT2,
    CASE WHEN (((SUM(DISTINCT WORK_SPACE)/5)*100)/COUNT(DISTINCT QUESTION_ID))>=60 AND (((SUM(WORK_SPACE)/5)*100)/COUNT(DISTINCT QUESTION_ID)) <=75 THEN COUNT(DISTINCT RESPONSER_ID) ELSE NULL END AS COUNT3,
    CASE WHEN (((SUM(DISTINCT WORK_SPACE)/5)*100)/COUNT(DISTINCT QUESTION_ID))>75 THEN COUNT(DISTINCT RESPONSER_ID) ELSE NULL END AS COUNT4
    FROM TQDB_LEARNER_RESPONSE
    Will it work for AND Condition(>=50 and <=60)
    Pls Help me

  • Doubt abt query outlines

    I am working on performance issue in my project.I want to create stored outlines for the query fetching the results.But in user_Outlines table a, under category default the outline is shown as USED .How can I make this USED for my query?
    If I have session level stored outlines under default category and some other category for same query and then when I run the query which stored outline is considered is taken by query ?Is it default one?
    Please clarify...

    I don't understand your question.
    The USED flag indicates if an outline has been employed. Unused outlines can be purged immediately. Outlines with a used status must be set to unused before they can be removed with a package procedure call. Outlines get used by executing their query.
    I personally don't use outlines. Using hints effectively is tricky, and hints can produce unexpected results when upgrading or patching database versions. I use hints when necessary but prefer to control them myself instead of letting the database do it. I might use outlines of other methods to get a query to run efficiently did not work but they wouldn't be my first choice

  • Doubt with query returning unnecessary reocrds

    Hi,
    I'm using below query to retrieve the descending security for securities in a database:
    select sre1.security_id master ,
    sre2.SECURITY_ID clone ,sa1.STREET_ADDR1 addr
    from
    SAM_REAL_ESTATE sre1, SAM_REAL_ESTATE sre2, sam_address sa1,sam_address sa2
    where
    sre1.ADDRESS_ID=sa1.ADDRESS_ID and sre2.ADDRESS_ID=sa2.ADDRESS_ID
    and sre1.security_id<sre2.SECURITY_ID
    and trim(nvl(upper(sa1.STREET_ADDR1),'Null'))=trim(nvl(upper(sa2.STREET_ADDR1),'Null'))
    and sre1.security_id in(175459876,175460893,175460770,20530359,21943331,20306795)
    and sre2.security_id in(175459876,175460893,175460770,20530359,21943331,20306795)
    order by 1 ,2;
    which is returning results like below:
    MASTER CLONE ADDR
    20306795 20530359 Waverley
    20306795 21943331 Waverley
    *20530359 21943331 Waverley*
    175459876 175460770 Temple
    175459876 175460893 Temple
    *175460770 175460893 Temple*
    Now I don't want the records selected in bold as the clone security is coming in master security while only the least record per different address should come in master list and rest of its security should come in clone
    Please suggest
    Thanks
    Deepak

    NOT TESTED
    select min(master) master,clone,addr
      from (select sre1.security_id master,
                   sre2.SECURITY_ID clone,
                   sa1.STREET_ADDR1 addr
              from SAM_REAL_ESTATE sre1,
                   SAM_REAL_ESTATE sre2,
                   sam_address sa1,
                   sam_address sa2
             where sre1.ADDRESS_ID = sa1.ADDRESS_ID
               and sre2.ADDRESS_ID = sa2.ADDRESS_ID
               and sre1.security_id < sre2.SECURITY_ID
               and trim(nvl(upper(sa1.STREET_ADDR1),'Null')) = trim(nvl(upper(sa2.STREET_ADDR1),'Null'))
               and sre1.security_id in(175459876,175460893,175460770,20530359,21943331,20306795)
               and sre2.security_id in(175459876,175460893,175460770,20530359,21943331,20306795)
             order by sre2.SECURITY_ID,upper(sa1.STREET_ADDR1),sre1.security_id
    group by clone,addr
    order by 1,2Regards
    Etbin
    It's not a Top-N query
    Edited by: Etbin on 13.8.2009 12:00

  • Doubt with Query

    Hi all,i am trying to insert data into a table using other table.But,the number of records that are getting inserted are more than what i am trying to insert.
    INSERT INTO mtl_transactions_interface
              ( attribute1,                        -- optional Column
                inventory_item_id,                  -- optional column
                 source_code,
                source_line_id,
                 source_header_id,
                process_flag,
                transaction_mode,
                last_update_date,
                last_updated_by,
                creation_date,
                created_by,
                organization_id,
                transaction_quantity,
                transaction_uom,
               transaction_date,
                transaction_type_id,
                transaction_cost)
    SELECT
            lc.file_number,
            lc.inventory_item_id,
           'DATA COLLECTION',                                        --source code
            regal.regal_inv_landed_cost_seq.nextval,                 --source line id
            regal.regal_inv_landed_cost_seq.nextval,                  --source header id
            1,                                                       --process flag
            3,                                                        --transaction mode
            lc.last_update_date,                                     --last update date
            lc.last_updated_by,
            sysdate,                                                  --creation date
            lc.created_by,
            82 ,                                                     --organization_id         
            lc.quantity_received ,                                    --transaction Quantity
            msi.primary_uom_code ,                                  --transaction UOM
            sysdate,                                                   --transaction date
            mtt.transaction_type_id,                                     --transaction type ID
            lc.landed_cost                                              --transaction cost                          
    FROM
           regal.regal_inv_landed_cost_tab lc,
           mtl_system_items msi,
           mtl_transaction_types mtt
    WHERE  
           lc.file_number = :file_number
      AND  lc.organization_id = msi.organization_id
      AND  lc.inventory_item_id = msi.inventory_item_id; 
    480 rows inserted.
    select count(*) from regal.regal_inv_landed_cost_tab
    where file_number = 'NOV612'
    COUNT(*)
    5The number of records that needs to be inserted are 5,but my query inserts 480 records.Can someone explain what's wrong with the above code.
    Thanks in advance!!

    good math...But,*mtl_system_items* and mtl_transaction_types don't have any join conditions as per my knowledge.Pls correct me if i am wrong.The table regal.regal_inv_landed_cost_tab is temporary table created by me,it has no column in common with mtl_transaction_types.So,how to correct my query so that it inserts only 5 records

  • Doubts about Query Builder tool

    Hi!
    We are using database link and the developed querys have many schemas.
    There is possible to use the Query Builder tool for multi Database schemas? How to do?
    There is possible to create query in Query Builder tool using database link? How to do?
    I would like to know about Query Builder tool in the our activies.
    *If there is more information about it(Query Builder tool) or documentations, please talk to me.
    Best Regards,
    Priscila Britto

    hi.
    try this [http://sourceforge.net/projects/sqleonardo/|http://sourceforge.net/projects/sqleonardo/]
    maybe it can help you.

  • Doubt on Query

    Hi,
    I have created EXIT but i don't know where to call that exit in the Query to calculate the age in years and please explain me the below line  also and where can i find 0DATE exit.
    How to Use a formula variable with replacement path filled by exit 0DATE
    Thanks,
    GAL

    Hi,
    In your case you should have DateOfBirth from the cube. Subtract it from current date (use can use standard SAP customer exit variable for thisThanks for your reply
    I have Date of birth but i want SYSTEM Date from where can i pull please help me
    which is the User exit and how to use customer Exit  in query
    Thanks,
    GAL

  • Doubt regarding query and subquery

    Hi guys,
    if I run the following query :
    SELECT NUM_OCORRENCIA, NUM_ENVOLVIDO FROM BO_VEIC_ACIDENTE BVA
    WHERE BVA.NUM_OCORRENCIA = BE.NUM_OCORRENCIA
    I get the following error message : ORA-00904: "BE"."NUM_OCORRENCIA": invalid identifier
    because we dropped the column num_ocorrencia.
    But if I run the same query as a subquery , like :
    SELECT COUNT(BE.NUM_ENVOLVIDO)
    FROM BO_ENVOLVIDO BE ,
    BO_TIPO_ENVOLVIMENTO BTE
    WHERE BE.ID_ENVOLVIMENTO = BTE.ID_TIPO_ENVOLVIMENTO
    AND BTE.CODIGO IN ('0100','0200','0300','1302','1303','1304')
    AND (BE.NUM_OCORRENCIA,BE.NUM_ENVOLVIDO) NOT IN (SELECT NUM_OCORRENCIA, NUM_ENVOLVIDO
    FROM BO_VEICULO_ENVOLVIDO BVE
    WHERE BVE.NUM_OCORRENCIA = BE.NUM_OCORRENCIA)
    AND (BE.NUM_OCORRENCIA,BE.NUM_ENVOLVIDO) NOT IN (SELECT NUM_OCORRENCIA, NUM_ENVOLVIDO
    FROM BO_VEIC_ACIDENTE BVA
    WHERE BVA.NUM_OCORRENCIA = BE.NUM_OCORRENCIA)
    AND BE.NUM_OCORRENCIA IN (SELECT NUM_OCORRENCIA FROM BO_OCORRENCIA_POLICIAL WHERE COD_TIPO_OCORRENCIA = 1)
    AND BE.NUM_OCORRENCIA = '2006-000000406' ;
    no error message are displayed. So I want to understand why Oracle get this behavior in this query.in the last query i got the result ' 0 ' . why Oracle didn´t showed me the same error in the second option ?
    thanks,
    Felipe

    I think you need to get some coffee ;)
    It's a scope issue the table alias BE does not exist in the first query but does in the second so it can be referenced in the subqubquery.
    Hi guys,
    if I run the following query :
    SELECT NUM_OCORRENCIA, NUM_ENVOLVIDO FROM
    BO_VEIC_ACIDENTE BVA
    WHERE BVA.NUM_OCORRENCIA = BE.NUM_OCORRENCIA
    I get the following error message : ORA-00904:
    "BE"."NUM_OCORRENCIA": invalid identifier
    because we dropped the column num_ocorrencia.
    But if I run the same query as a subquery , like :
    SELECT COUNT(BE.NUM_ENVOLVIDO)
    FROM BO_ENVOLVIDO BE ,
    BO_TIPO_ENVOLVIMENTO BTE
    E BE.ID_ENVOLVIMENTO = BTE.ID_TIPO_ENVOLVIMENTO
    AND BTE.CODIGO IN
    ('0100','0200','0300','1302','1303','1304')
    AND (BE.NUM_OCORRENCIA,BE.NUM_ENVOLVIDO) NOT IN
    (SELECT NUM_OCORRENCIA, NUM_ENVOLVIDO
    FROM
    BO_VEICULO_ENVOLVIDO BVE
    WHERE
    BVE.NUM_OCORRENCIA = BE.NUM_OCORRENCIA)
    AND (BE.NUM_OCORRENCIA,BE.NUM_ENVOLVIDO) NOT IN
    (SELECT NUM_OCORRENCIA, NUM_ENVOLVIDO
    ROM BO_VEIC_ACIDENTE BVA
    WHERE
    BVA.NUM_OCORRENCIA = BE.NUM_OCORRENCIA)
    AND BE.NUM_OCORRENCIA IN (SELECT NUM_OCORRENCIA FROM
    BO_OCORRENCIA_POLICIAL WHERE COD_TIPO_OCORRENCIA =
    1)
    AND BE.NUM_OCORRENCIA = '2006-000000406' ;
    no error message are displayed. So I want to
    understand why Oracle get this behavior in this
    query.in the last query i got the result ' 0 ' . why
    Oracle didn´t showed me the same error in the second
    option ?
    thanks,
    Felipe

  • Small doubt in query

    Hi
    SQL> CREATE TABLE char_test (col1 CHAR(10));
    Table created.
    Elapsed: 00:00:00.03
    SQL> INSERT INTO char_test VALUES ('qwerty');
    1 row created.
    Elapsed: 00:00:00.00
    SQL> SELECT col1, length(col1), dump(col1) "ASCII Dump" FROM char_test;
    COL1 LENGTH(COL1)
    ASCII Dump
    qwerty 10 Typ=96 Len=10: 113,119,101,114,116,121,32,32,32,32
    Elapsed: 00:00:00.02
    SQL>
    Please explain the bolded one. 10 Typ=96.
    Thanks in advance.
    -SATHYA

    Hi,
    CHAR datatype is always blank padded if you are storing any value less than the specified length.
    See the below link:
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/datatypes.htm#BABGIHIJ
    Regards

  • Doubt in query

    hi i have 2 columns updatelocation, updatedate
    updatelocation, updatedate
    aaa 27-nov-08
    aaa 26-nov-08
    aaa 25-nov-08
    aaa 23-nov-08
    i want to chech in last 30 days which date is missing .like above 24 date is missing.
    but i cant give where updatedate is null.
    how to check last one month.

    CREATE TABLE TEST_VAL
    ID VARCHAR2(10 BYTE),
    DT TIMESTAMP(6)
    select id,dt+1 from
    select id,dt,to_char(dt,'dd') num1
    ,lead(to_char(dt,'DD'),1,0) over ( order by dt) num2
    from test_val where trunc(dt) &gt;= trunc(systimestamp-30) order by dt
    where num2 -num1 !=1;

  • Plz clear this doubt abt query and subquery

    hi
    can a sql statement display data from a table that is referred in it's subquery without including the table in the from clause..
    please give an example for this
    thank u
    rajiv

    Have you tried it yourself?
    It would be much quicker than waiting for a forum answer.

Maybe you are looking for

  • Can I merge my old iTunes account with my new iCloud account?

    I think I recall Apple maybe mentioning something like this before, but I've got an Apple ID from years ago with a @gmail.com that I don't use anymore a iCloud account I use all the time.   It's not a huge deal to log in and log back out with my othe

  • Appel Mail still Crashing after several measures

    Mac Book Pro unibloc 2.8 Ghz 10.5.8 Mail 3.6; 4 IMAP accounts During downlaoding messages Mail was regularly crashing. As drastical measure I - replaced the whole mail folder from a TimeMachine backup - replaced the whole prefs folder - deleted the e

  • Are there any trial versions of quicktime pro 7 ?

    After bying i new camera i found out it produces mp 4 that can´t be imported to either Iphoto or Imovie. However they opens in quicktime. I have tried testversions of ImTOO videconverter Ultimate 6 and Bigasoft movie converter and they successfully c

  • 10g form compilation error

    Hi all, I created a form in Oracle form builder 10g.. I uploaded the fmb to server. Say file name is XX_TEST.fmb These are the steps i followed for compilation. 1). emrenv betsyd9 2)cd /betsyd9ap/betsyd9appl/au/11.5.0/resource 3)export FORMS60_PATH=/

  • Agentry Client on Windows Surface

    Hi Experts, We wanted to run the Service Manager App in Windows Surface Pro 3. I have installed the WPF Client in the surface but I am not able to run it. I used the same client that was used in the laptop ( using Windows 7 ). I could not find any Se