Fetching values using select query

Hi i want to get the details of belnr and bukrs using the where codn fields bukrs,anlkl,brdatu,ktansw,budat,WBS element.
1)The value of bukrs is entered in the selection screen
2)the value of asset class is optional and present in the anka
3)brdatu is already fetched and placed in a table.field brdatu is present in table j_ittaxdep
4)ktansw is entered in the selection screen and present in table j_ittaxdep
5)budat is fetched and placed in a table.
6)wbs element already fetched and  is present in prps table.
Can anyone please tell how to code.actually the values of bukrs,anlkl ktansw, are present in structure anlav,brdatu is present in structure rbada and budat is present in structure anek.By using this structure is there way to get the belnr and bukrs value.

Hi,
Hema,
things are not so flate as you are thinking.
first u understand for which application u are using these Queries.Ask ur functional guy to confirm the usage tables.Then use thsee tables to get the data into u r internal tables and for these internal tables value u have to fetch belnr bukrs fronm bseg or FI table .
so first confirm the tables the plan how to get data.
if u need my help the write me in brief?
Regards
Ricky

Similar Messages

  • Procedure to get semicolon seperated values using select query

    I have got a requirement where I need to return a string with semi colon separated values. Input will also be a semi colon separated values I need to fetch data from tables and append those values into a string seperated by a semi colon.
    Example
    CREATE OR REPLACE
    PROCEDURE GET_MAIL_IDS_FROM_ROLES
    (roleIds IN varchar, mailIds OUT varchar)
    select * from xxx where roles in (roleIds )
    Thankyou

    Haven't tested it, but this could be a start:
    CREATE OR REPLACE PROCEDURE GET_MAIL_IDS_FROM_ROLES
    (roleIds IN varchar, mailIds OUT varchar)
    type mailid is table of owner.xxx.mailid%type indexed by pls_integer;
    mail_id mailid;
    cursor c1
      select mailid from xxx where roles in (roleIds);
    begin
    open c1;
    fetch c1 bulk collect in mail_id;
    mailIds := mail_id(1);
    for i in 2 .. mail_id.count loop
       mailIds := mailIds||';'||mail_id(i);
    end loop;
    close c1;
    end;

  • To display 01 to 10 using select query

    Hi all,
    using select query...
    In where clause...,
    If u give 1 to 9 it should display 01 to 09 and
    If u give 10 it should display as 10.
    I want it in a single query .
    Thanks & Regards,
    Hariharan ST.

    Just need to build a where condition to the query posted by ascheffer -
    Something Like this -
      1  Select rn
      2  From   ( Select To_Char(ROWNUM, '09')  rn
      3           From   Dual
      4           Connect By rownum < 11
      5         )
      6  Where  (     (       Trim(rn) < 10
      7                 And '&Param' = '1 to 9'
      8               )
      9           Or (       Trim(rn) = LPAD('&Param', 2, 0)
    10              )
    11*        )
    SQL> /
    Enter value for param: 10
    old   7:                And '&Param' = '1 to 9'
    new   7:                And '10' = '1 to 9'
    Enter value for param: 10
    old   9:          Or (       Trim(rn) = LPAD('&Param', 2, 0)
    new   9:          Or (       Trim(rn) = LPAD('10', 2, 0)
    RN
    10
    SQL> /
    Enter value for param: 7
    old   7:                And '&Param' = '1 to 9'
    new   7:                And '7' = '1 to 9'
    Enter value for param: 7
    old   9:          Or (       Trim(rn) = LPAD('&Param', 2, 0)
    new   9:          Or (       Trim(rn) = LPAD('7', 2, 0)
    RN
    07
    SQL> /
    Enter value for param: 4
    old   7:                And '&Param' = '1 to 9'
    new   7:                And '4' = '1 to 9'
    Enter value for param: 4
    old   9:          Or (       Trim(rn) = LPAD('&Param', 2, 0)
    new   9:          Or (       Trim(rn) = LPAD('4', 2, 0)
    RN
    04
    SQL> /
    Enter value for param: 1 to 9
    old   7:                And '&Param' = '1 to 9'
    new   7:                And '1 to 9' = '1 to 9'
    Enter value for param: 1 to 9
    old   9:          Or (       Trim(rn) = LPAD('&Param', 2, 0)
    new   9:          Or (       Trim(rn) = LPAD('1 to 9', 2, 0)
    RN
    01
    02
    03
    04
    05
    06
    07
    08
    09
    9 rows selected.Shailender Mehta

  • Is it worth using select query on infotype tables

    Hi Experts,
    I might be posting in the wrong column, but i just need to know is it worth using a select query on Infotype tables (PAxxxx)?? or should we prefer using the function modules for data fetching?
    If select is not suggested, what is the reason for that?
    Rgds
    Prateek

    Hi ,
    Its not said that u cant write select on PAXXXX tables . Yes of couse LDB are there to fetch the data but it depends on
    the requirement when to write a select and when to consider using in LDB .
    Generally when you are looking at say 8 to 10 tables of infotypes with free selection , then LDB is suggested to fetch the data .
    if you are looking to fetch the data for say some tables for a restricted selection (where clause) then select is used .
    If i want to write a program using select only then fetching data from infotypes tables for large no of records will lead to
    more time consumption which becomes easier in LDB as they are fetched in hierarchy level based on keys .
    Normally it will be a combination of LDB and select querys  in the development scenario
    Br,
    Vijay.

  • Deafaul Value using SQL query

    Hi
    I'm trying to make a default value using Computations;
    when I create computation,
    I select
    Computation item: PXX_TEST
    computation type: SQL query
    computation Point: I tried all
    Computation: select X FROM Y WHERE X= '1'
    This is the way to get Default Value ??
    I need to display the value when the page is open
    Thanks
    MM

    MM,
    You can use the default value attribute of the item to set a value if the item's source produces a null. A computation (before/after header) can work too, but it's possible that the item source and Source Used attribute (Always/Only) are interfering with your computation so you might want to try setting Source Used to 'Only...' if you have a computation setting the item.
    Scott

  • Wildcard search for numeric values using select ?

    Hi,
    I want do wildcard search for numeric fields of the table.
    For charcter/string i have used - select * from XX_TABLE where param1 like 'SS%'. But this query doesnt work when para1 is numeric. Please let me know first whether this is possible ? if yes how to achieve it ?
    Thanks in advance,
    Shrinivas

    Hi Jack,
    The numeric field is of  8 digits, so when i give search critera as '66', it should return values 66000000, 660000, 6600 etc. so i was not able to give between some range. I also tried storing all these values in internal table and the segregate the values it contains '66*'. This worked well but requires lot of coding effort.Please suggest if you guys have any better method ?
    Thanks,
    Shrinivas

  • Oracle Forms List Items :not populating list Dynamically using select Query

    Hi ,
    I need to create a list item. And the values to be populated in the list are from Database but I'm unable to populate from database.
    Please help me out how to populate the values from database.
    In Property Pallete we have Elements in List under Functional section , In this we have to manually enter the List values but we can't use any Query to Dynamically populate.
    Thanks,
    Kiran Sanga

    When you need to fill a list with the result of a query, you'll have to do it at runtime.
    Andreas has a good blogpost about this.

  • Order mismatch in selected data using Select query

    Hello Experts,
    We are upgrading from 4.6C to ECC6. I came across a select query on a custom table, which gives different order of data from 4.6C to ECC6. Data (no. of records) is same in both the servers but order is different. Table doesn't have indexes in either 4.6C or ECC6. What would be the cause for order change?
    Further, in 4,6C, ECC6 and data bases order of the data is totally different. Select query have some conditions in where clause with select options, but in both the cases (4.6C and ECC6) I am not passing any data from the selection screen so am getting entire data from the data base.
    Thanks in advance
    Phalani

    From the SAP service market place I found that
    1. Unless we use SORT or ORDER BY clause the order of the data is not in our control.
    2. In 4.6C, two same select queries never give the result in the same order, if the primary key contains character fields.
    Thanks for your help.
    Phalani

  • Fetching value using Logical Database

    Hi
    I have some fields in my selection screen apart from the selection screen obtained from my logical database.
    Kindly let me know how to fetch data from logical database.
    My requirement is this:
    I have to select company code from T001 based on entry frm selection screen .
    with the obtained company code along with other fields from dynamic selection screen I have to fetch value from Lfb1.
    Kindly let me know how to do this
    Thanks
    Yamini

    use f.m LDB_PROCESS....
    refer demo program DEMO_LOGICAL_DATABASE

  • How to Get the Job, Cost center, Position description using select query

    Hi all,
    How to get the  Job, Cost center, Position description through select query without using the Function module?
    thanks,
    Prasad

    use adhoq query and take the report chose both text and value

  • How to sum a column value using CAML Query?

    Hi All,
    I would like to sum the column value using CAML qeury. Actually in my list, I have two column "Projects Name" and "Number of Issues". Now need to get sum of "Number of Issues" column. How to achieve in CAML Query.
    Thanks in advance!

    Hi Sam,
    it looks like you can use your current view based agregation, otherwise it is not possible(
    http://msdn.microsoft.com/en-us/library/ms467521.aspx) and you need to work on custom bit on this requirement.
    use the below link and create a view element as described and see if that works for you
    Aggregations Element
    http://msdn.microsoft.com/en-us/library/ms468626%28v=office.12%29.aspx
    Another reference
    Query Element
    http://msdn.microsoft.com/en-us/library/ms471093.aspx
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • Sender JDBC Dynamic parameter value in select query

    Hi All,
    I have a scnario where i have read only acess to a table and We cannot use stored procedures..
    Interface is JDBC to file.
    Now there is one filed in the table which holdes the system date and time.Ex filed name as Sysdate.
    now can i use  query as select * from table1 where Sysdate = x+1.
    where X is the last process Sysdate field value.. is there any work arround to store the value in a file and check dynamically every time from that file to get the value of x and after that X+1 value has to be updated back to that file..
    main aim is to eliminate duplicate entries.
    Regards
    Vijay

    Hi suraj,
    thanks for the reply i have proposed the same for the requirement but there is no acess to update the table all we have is to read only the table.. so i get out one other way round to ensure the proper data has to be flow..
    Similarly there is one more where i have datetime field value  i need to break all entires on base of time and pick the values ...
    Even i proposed if you thre is no authorization to update the flag give me in flat file so that i can split the file by uisng java mapping..
    But its was badluck i have a table with few lak entries read only aces to the table and ensure data has to be properly flow with out any duplications and miss entries.. any approach that we can achive this..
    Regards
    Vijay
    Edited by: vijay Kumar on Apr 12, 2010 1:36 PM

  • High # fetches for a select query

    Following is the tkprof output. Can anybody tell why the fetches are too high and what should be done? Thanks.
    SELECT COUNT (*)
    FROM
    ACA_PI_ALLOC_CVE A WHERE A.PRGRM_INDEX = :B2 AND A.ALCTN_CODE = :B1 AND
    TRUNC (SYSDATE) BETWEEN TRUNC (A.FROM_DATE) AND TRUNC (A.TO_DATE) AND
    A.STATUS_CID = 2 AND A.OPRTNL_FLAG = 'A' AND A.FISCAL_MNTH =
    FN_FISCAL_MONTH (SYSDATE)
    call count cpu elapsed disk query current rows
    Parse 6494 0.32 0.31 0 0 0 0
    Execute 18760 1.69 1.67 0 0 0 0
    Fetch 18760 604.39 593.07 801 22993642 0 18760
    total 44014 606.40 595.05 801 22993642 0 18760
    Misses in library cache during parse: 1
    Misses in library cache during execute: 2
    Optimizer mode: ALL_ROWS
    Parsing user id: 277 (recursive depth: 1)
    Rows Row Source Operation
    5 SORT AGGREGATE (cr=2242 pr=17 pw=0 time=302663 us)
    5 TABLE ACCESS BY INDEX ROWID ACA_PI_ALLOC_CVE (cr=2242 pr=17 pw=0 time=302541 us)
    3265 INDEX RANGE SCAN TUNE_ACA_PI_ALLOC_CVE_01 (cr=30 pr=0 pw=0 time=26431 us)(object id 1331914)

    FeNiCrC_Neil wrote:
    Thanks Enrique. Is there a way to decrease the elapsed time for the fetches?I think that Mark pointed you in the right direction. Reposting what you previously posted:
    SELECT
      COUNT (*)
    FROM
      ACA_PI_ALLOC_CVE A
    WHERE
      A.PRGRM_INDEX = :B2
      AND A.ALCTN_CODE = :B1
      AND TRUNC (SYSDATE) BETWEEN TRUNC (A.FROM_DATE) AND TRUNC (A.TO_DATE)
      AND A.STATUS_CID = 2
      AND A.OPRTNL_FLAG = 'A'
      AND A.FISCAL_MNTH = FN_FISCAL_MONTH (SYSDATE);
    call     count    cpu elapsed disk    query current  rows
    Parse     6494   0.32    0.31    0        0       0     0
    Execute  18760   1.69    1.67    0        0       0     0
    Fetch    18760 604.39  593.07  801 22993642       0 18760
    total    44014 606.40  595.05  801 22993642       0 18760
    Misses in library cache during parse: 1
    Misses in library cache during execute: 2
    Optimizer mode: ALL_ROWS
    Parsing user id: 277 (recursive depth: 1)
    Rows Row Source Operation
       5 SORT AGGREGATE (cr=2242 pr=17 pw=0 time=302663 us)
       5  TABLE ACCESS BY INDEX ROWID ACA_PI_ALLOC_CVE (cr=2242 pr=17 pw=0 time=302541 us)
    3265   INDEX RANGE SCAN TUNE_ACA_PI_ALLOC_CVE_01 (cr=30 pr=0 pw=0 time=26431 us)(object id 1331914)The query, which is executed 18,760 times, is performing 22,993,642 logical IOs and is experiencing CPU limitations (606.40 CPU seconds, about 1/3 of a second per execution) due to the number of logical IOs. The execution plan that you posted is for a single execution, using a very unselective index. In this case, the unselective index returned 3,265 rows, of which only 5 survived the other restrictions specified by the WHERE clause.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • My first PL/SQL block not working with using Select query within begin

    I am new to PL/SQL , just started with basics of BLOCKS .
    I am having a query here in executing a block .
    When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
    First of all This is my Table :
    select from try :*
    KEY      VALUE
    Key     Value
    Key1     Value1
    Key2     Value2
    Key3     Value3
    ======================
    This is the code which is not working : Please see the code and tell me what is the problem .
    DECLARE
    v_KEY    VARCHAR2(20);
    v_VALUE   VARCHAR2(20);
    BEGIN
    select key into v_KEY FROM try where v_value='Value' ;
    dbms_output.put_line(v_KEY);
    END;
    When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
    wheer when i run tis individually it worked fine :
    select KEY FROM try where VALUE='Value' ;"
    please share your ideas .as why it isn't running ??
    Edited by: user10503747 on Sep 20, 2010 3:16 AM

    Hi,
    user10503747 wrote:
    I am new to PL/SQL , just started with basics of BLOCKS .
    I am having a query here in executing a block .
    When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
    First of all This is my Table :
    select from try :*
    KEY      VALUE
    Key     Value
    Key1     Value1
    Key2     Value2
    Key3     Value3
    ======================
    This is the code which is not working : Please see the code and tell me what is the problem .
    DECLARE
    v_KEY    VARCHAR2(20);
    v_VALUE   VARCHAR2(20);
    BEGIN
    select key into v_KEY FROM try where v_value='Value' ;
    dbms_output.put_line(v_KEY);
    END;
    When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
    wheer when i run tis individually it worked fine :
    select KEY FROM try where VALUE='Value' ;"
    please share your ideas .as why it isn't running ??
    Edited by: user10503747 on Sep 20, 2010 3:16 AMInstead of:
    {code}
    select key into v_KEY FROM try where v_value='Value' ;
    {code}
    perhaps you meant something like:
    {code}
    v_value := 'Value1';
    select key into v_KEY FROM try where v_value=Value ; -- No quotes
    {code}
    Until you assign a vlue to a variable, like v_value, it is NULL, so your original statement was equivalent to
    {code}
    select KEY FROM try where NULL='Value' ;
    {code}
    In PL/SQL, a SELECT ... INTO statement must return exactly one row, or else you will get an error (either NO_DATA_FOUND or TOO_MANY_ROWS). This is different from SQL, where a query cn return any number of rows, including 0, without raising an error.

  • Using select query in Subprogram block

    Hello
    Generally confusion arises at my work place on topic that whether to use cursor or anonymous block for the SELECT statement which mostly is going to return single row. In below example we can see the following statement may be returning a single:
    "SELECT ename INTO v_ename FROM emp WHERE ID = P_ID; "
    What approach you will use and why?
    I always prefer to use Cursor in any case.
    Thanks in advance,

    In this simple case, the simplest solution, and where you have most control as a programmer is to use an explicit cursor (yes, there would be those who argue that in recent versions of Oracle your performance would be best with an implicit cursor, but in practice this will probably make no difference). Here is how I would write:
    FUNCTION Get_Ename(p_Id   emp.ID%TYPE) return emp.ename%TYPE IS
      CURSOR C1 IS
      SELECT ename
      FROM   emp
      WHERE ID = P_ID;
      v_Ret_Val emp.ename%TYPE;
    BEGIN
      OPEN C1;
      FETCH C1 INTO v_Ret_Val;
      CLOSE C1;
      RETURN v_Ret_Val;
    END;Notice, no exception handling needed, not even if there is going to be no matches and even if there are multiple rows for the ID (which I doubt you would have if the ID is the primary key).
    Packaging as a function, gives you something you can reuse and modify if needed later, without modifying all places where you perform this select.
    Hope this helps,
    Thomas

Maybe you are looking for