Need to fetch only the select statement

Hi ,
I am able to fetch all the select statements from my program if program name as my input.
I want only the select statement where we fetch the field entries like
select single from mara
select * from mara
select count(*)
select matnr from mara
like this i want to fetch i dont want to display the select-options or start-of-selection .

Hello Shwetha
If the function module <b>RS_PROGRAM_TABLES</b> (function group <b>SEA1</b>) is available on your system you can run this fm with the following parameters:
- OBJECT_TYPE = 'TRAN'   " transaction
- OBJECT_NAME = 'VA03'  " example
- OBJECT_TYPE = 'PROG'   " report
- OBJECT_NAME = 'SAPMV45A'  " example: report executed by VA03
The fm returns you a list of tables that are accessed.
Regards,
  Uwe

Similar Messages

  • Need a help in the Select statement

    How to use the table name dynamically in the Select Statement in Oracle 9.i ?

    This?
    sql>
    select *
    from &table
    old 2: from &table
    new 2: from dual
    D

    Or this..?
    sql>
    declare
    tab varchar2(31) := 'dual';
    v varchar2(10);
    begin
    execute immediate 'select * from '||tab into v;
    dbms_output.put_line(v);
    end;
    X
    PL/SQL procedure successfully completed
    jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Need help with correcting the select statement

    I have two tables mkt & error.
    The fields of mkt are
    app_id (xxx)
    c_mkt_id
    app_mkt_id
    The fields of error table are
    mkt_id
    intr_id (its in format xxx.yyy or xxx)
    xyz
    abc
    pqr
    I have to select * fields from error table such that
    ->mkt.app_id = error.intr_id (here i am using combination of sbstr & instr to get the part before "." if present)
    ->mkt.c_mkt_id=error.mkt_id
    Where ever the above two conditions match i have to replace the mkt_id field in my select * from error table query with the
    app_mkt_id field from mkt table. If the above two condtions dont match my select * from error table should return the original mkt_id present in the error table.
    I have presently developed a query(*) which selects the app_mkt_id from mkt table where ever the two conditions match.
    How should i go about using this to get my actual requirement.
    (*)=select app_mkt_id from mkt where app_id in (select case when case_when=1 then substr(intr_id, 1, instr(intr_id,'.')-1) else substr(intr_id, 1) end from (select intr_id, case when instr(intr_id,'.',1)=0 then 0 else 1 end case_when from error)) and
    c_mkt_id in (select mkt_id from error)

    you wrote:
    (*)=select app_mkt_id from mkt where ....What is this?
    If you are writing PL/SQL the syntax is:
    SELECT ....
    INTO ....
    FROM ....
    WHERE ....This seems to be school work and thus you really need to puzzle this out for yourself.

  • How to fetch the select statements

    Hi all ,
    I am able to display all the lines in the program if i give the program name as my input .
    I need to fetch only the select statements from that program . so please any one help me out to solve this problem.
    thanks
    shwetha

    before write statement just put one if condition.
    if statement cs 'select'.
      write: / statement.
    endif.
    <b><removed_by_moderator></b>
    <b><removed_by_moderator></b>
    feel free to ask any quieries my mail id
    <b><removed_by_moderator></b>
    <b><removed_by_moderator></b>

  • How to get only the selected layer data?

    Hi All,
              I'm using dissolve sample plugin. I added two layers in photoshop both of different dimensions, say 1000 * 1000 & 2000 * 2000. Now I select the layer with 1000 * 1000 dimension and click on Dissolve plugin. The preview image what is shown in dissolve plugin dialog is not just the selected layer, but also some extra pixels around the selected layer.
    Do I need to set any flag for getting only selected layer data to display in preview?
    Also I need to get only the selected area in a particular layer. When I checked FilterRecordPtr, haveMask flag is TRUE if the part of the layer is selected. But how do I get only the part of the layer that is selected for displaying preview image?
    Please let me know if the description is not clear.
    Thanks,
    Dheeraj

    Thanks Tom Ruark for the response.
    That is exactly the same thing what I'm seeing.
    1.Is there a direct way to know the bounds of the layer without the transparency grid so that I can show only the layer?
    2. If I select an area of 50*50 within a layer(1000*1000) using Rectangular Marquee tool, then I want only that selected area to be shown in preview. For this there is a haveMask flag which indicates whether or not there is selection, but the selected bounds are not available. I'm currently calculating the bounds. I just wanted to know if Photoshop SDK has any field for getting the bounds?

  • 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

  • Case sensitive statement in the select-statement

    Hi All,
    i have a table in the abap-dictionary filled with names...when i try to select them with the select-statement with condition:
    table-name_column like 'some_name'
    I have encountered some problems...the inquiry is case-sensitive. What i want to do is to read the value from the abap-dictionary table uppercase or lowercase and compare it with the needed value also translated in uppercase or lowercase.
    The only idea i have is to select all values of the dictionary table into an internal table and to translate the values there in uppercase or lowercase and then to loop trough it. But this approach would cost a lot of performance.
    Do someone has an other proposal?

    check...
    Select statement
    It would be difficult , because it is based on how data is stored in the data base , now consider the scenario of the system i am using , we can material description as 'test' or 'TEST' , 'Test' .
    If in your system there are only stored in either caps or small the you can perform the select twice .
    But i myself dont find it to be such a good solution , but you can give it a try
    There is one more solution specific to material description ,and that is in the table MAKT there is a field MAKTG , which stored the description in uppercase , so for this you can first convert the description to uppercase and then perform select on this field

  • Restricting records in the select statement

    Hi,
    I have one requirement where in i need to restrict my select statement to get only 250 records in the output table.
    Here are the select statements i am using....
        SELECT a~ebeln
                     a~lifnr
                     a~ekgrp
                     b~werks
                     b~matnr
               FROM ekko AS a INNER JOIN ekpo AS b
               ON aebeln = bebeln
               INTO TABLE i_ekko
               WHERE a~ebeln IN r_ebeln AND
                            a~lifnr IN r_lifnr AND
                            a~ekgrp IN r_ekgrp AND
                            b~werks IN r_ewerk AND
                            b~matnr IN r_matnr AND
                            a~bstyp = 'F'.
                IF NOT i_ekko[] IS INITIAL.
    Select Vendor name
               SELECT lifnr
                            name1
                      FROM lfa1
                      INTO TABLE i_lfa1
                      FOR ALL ENTRIES IN i_ekko
                      WHERE lifnr = i_ekko-lifnr.      
    Here if i restrict the first select statement to get only 250 records then i am not getting the desired record in the second select statement.
    Could anyone let me know how to write the select statement.
    Regards,
    Ramesh

    restric the first select using up to 250.
    sort the i_ekko by vendor name.
    ex: sort i_ekko by lifnr.
    use second select statement here.

  • If I want to order by dateAdded to I have to include it in the select statement like

    If I do this:
    <cfquery name="chart" datasource="#datasource#">
    select behaviourID,score, dateAdded2 = convert(varchar,
    dateAdded , 101)
    from staff_charts_data
    where userID =
    <cfqueryparam value="#arguments.userID#"
    cfsqltype="cf_sql_integer"> AND
    NOT score = 5
    </cfquery>
    If I want to order by dateAdded to I have to include it in
    the select statement like so:
    <cfquery name="chart" datasource="#datasource#">
    select behaviourID,score, dateAdded2 = convert(varchar,
    dateAdded , 101),dateAdded
    from staff_charts_data
    where userID =
    <cfqueryparam value="#arguments.userID#"
    cfsqltype="cf_sql_integer"> AND
    NOT score = 5
    </cfquery>

    you should be able to order by dateAdded without it being in
    the select clause. The only time the order by field has to be in
    the select clause is when your query has an aggregate and group by
    clause, like this:
    select field1, field2, max(field3) as youralias
    from sometables
    where whatever
    group by field1, field2
    order by ???
    You can only order field1, field2, max(field3) or youralias.
    You can't order by field4.

  • Issue with Past Month data in the Select Statement

    Hi,
    I written the following query,
    SELECT   /*+NO_MERGE(A)*/
                CASE
                   WHEN snap_shot_date > a.q3
                   AND snap_shot_date <= a.q4
                      THEN q4char
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN q3char
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN q2char
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN q1char              
                END snap_shot_date,
                CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN 1
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN 2
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN 3
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN 4
                END sort_by,
                pillar3_exposure_class_code, pd_band_description,
                ROUND (SUM (p3.ead_post_sec_post_crm)),
                ROUND (SUM (notional_principle)),
                DECODE (SUM (notional_principle),
                        0, 0,
                        ROUND (  SUM (DECODE (exposure_type,
                                              'UNDRAW', ead_post_sec_post_crm,
                                              0
                               / SUM (notional_principle),
                               4
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (  SUM (pd_value * p3.ead_post_sec_post_crm)
                               / SUM (p3.ead_post_sec_post_crm),
                               2
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (SUM (rwa) / SUM (p3.ead_post_sec_post_crm), 4)
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (  SUM (lgd_rate * p3.ead_post_sec_post_crm)
                               / SUM (p3.ead_post_sec_post_crm),
                               2
                TO_CHAR (MAX (a.max_date), 'FMMonth DD, YYYY')
           FROM summary.pillar3 p3,
                (SELECT DISTINCT (month_end_date) max_date,
                                 LAST_DAY (month_end_date) q4,
                                 TO_CHAR (LAST_DAY (month_end_date),
                                          'MON YYYY'
                                         ) q4char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -3) q3,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -3),
                                     'MON YYYY'
                                    ) q3char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -6) q2,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -6),
                                     'MON YYYY'
                                    ) q2char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -9) q1,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -9),
                                     'MON YYYY'
                                    ) q1char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -12) q0
                            FROM rcdwstg.stg_bcar_detail) a
          WHERE snap_shot_date BETWEEN ADD_MONTHS (a.max_date, -12) AND a.max_date
       GROUP BY CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN q4char
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN q3char
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN q2char
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN q1char
                END,
                CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN 1
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN 2
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN 3
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN 4
                END,
                pillar3_exposure_class_code,
                pd_band_description
       ORDER BY 2 DESC;I have written the query to get the latest 12 months data from a table and split that into 4 quarter to show in the Cognos Report. But when the table having 13th or the past months data, the select statement is showing Empty values in the first two columns and fetching the 13 month data too.
    Can anyone help me in this to avoid the problem.
    Thanks
    Radha K

    WHERE snap_shot_date BETWEEN ADD_MONTHS(TRUNC(a.max_date, 'MM'), -11) AND  a.max_date
    ....

  • How to test the select statement.

    Hi All,
    How to test the select statement.
    Is there any Oracle sqlplus  or toad kind of tool to  test the query.
    thanks
    siva

    Use SQL Trace (ST05) and choose 'Explain one SQL Request'. Enter your SQL command as it should be executed in the underlying database. e.g. if the db is Oracle, the statement should be entered as:
    SELECT matnr,werks,lvorm,dispo
    FROM marc
    WHERE mandt = :a AND
                 matnr = :b AND
                 werks = :c
    In the above :a, :b and :c are place holders for the actual comparison values. You dont have to enter those values. When you choose 'Explain' button, you will find the 'Execution Plan'. The important parameter which denotes the efficiency of the SQL statement is the 'Cost'. The cost should be as low as possible. The table access should be through INDEX UNIQUE SCAN. If you get a FULL TABLE SCAN and higher cost, you need to fine-tune your statement by modifying the where clause.
    If you dont know Oracle SQL statements, execute the program in trace mode and go to the trace and you will find the underlying SQL statements issued to the database.
    Regards
    Suresh Radhakrishnan

  • Break the SELECT statement.

    Hi,
    My requirement is to break the Select statement and get the fields in where clause in one internal table.
    For eg: Select VBELN
                          POSNR
                          MATNR  from VBAP into wa_vbap where VBELN = '0000000001'
                                                                              and   POSNR = '000010'.
    Here i need to put fields VBELN, POSNR, MATNR in one internal table, table name VBAP in second internal table  and where clause fields  VBELN, POSNR in third internal table.
    Please let me know if anyone has any solution for this.
    Thanks in advance.
    Sunanda.

    Hi
    *& Report  YSELECT                                                     *
    REPORT  YSELECT                                 .
    *Select VBELN
    *POSNR
    *MATNR from VBAP into wa_vbap where VBELN = '0000000001'
    *and POSNR = '000010'.
    *Here i need to put fields VBELN, POSNR, MATNR in one internal table,
    *table name VBAP in second internal table and where clause fields VBELN,
    * POSNR in third internal table.
    TABLES: VBAP.
    TYPES: BEGIN OF STRUCT1,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          MATNR LIKE VBAP-MATNR,
           END OF STRUCT1.
    TYPES: BEGIN OF STRUCT2,
            TBLNAME(10),
           END OF STRUCT2.
    TYPES: BEGIN OF STRUCT3,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          END OF STRUCT3.
    DATA: ITAB1 TYPE TABLE OF STRUCT1 WITH HEADER LINE,
          ITAB2 TYPE TABLE OF STRUCT2 WITH HEADER LINE,
          ITAB3 TYPE TABLE OF STRUCT3 WITH HEADER LINE,
          V_TBLNAME(10).
    ITAB3-VBELN = '0000000001'.
    ITAB3-POSNR = '000010'.
    APPEND ITAB3.
    LOOP AT ITAB3.
        SELECT VBELN POSNR MATNR FROM VBAP INTO TABLE ITAB1 WHERE VBELN EQ
    ITAB3-VBELN AND POSNR EQ ITAB3-POSNR.
          WRITE ITAB1-VBELN.
    ENDLOOP.
    WRITE: 'SUBRC=', SY-SUBRC.
    I am unable to find out how to satisfy your second internal table requirement.
    Hope this helps
    Regards,
    Jayanthi.K

  • Calling an SP takes over 200% more time over the select statement

    As part of my POC converting a SQL Server application over to SAP HANA, I'm find that CALL is taking over 200% more time than calling the SELECT statement directly. The result is that the application that uses ODBC against HANA with CALL statements is taking much more time than SQL Server. I'm finding this for all stored procedure calls in the application. Here is an example:
    CREATE PROCEDURE dbo.usp_GetOrdersByCustomerID
    (IN C_ID bigint)
    LANGUAGE SQLSCRIPT DEFAULT SCHEMA "DBO" READS SQL DATA
    AS BEGIN
    SELECT  TOP 20
       C_F_NAME,
                C_L_NAME,
                C_EMAIL,
                O_ID,
                O_TOTAL,
                O_DTS,
                O_FM_DTS
    FROM    dbo.Customer JOIN dbo.Orders ON C_ID = O_C_ID
    WHERE   C_ID = :C_ID
        ORDER   BY O_ID DESC;
    END;
    When using the following CALL statement in SAP HANA Studio
    CALL dbo.usp_GetOrdersByCustomerID(3429);
    I get execution times that look like this:
    Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'
    successfully executed in 9 ms 663 µs  (server processing time: 8 ms 115 µs)
    Fetched 5 row(s) in 0 ms 69 µs (server processing time: 0 ms 0 µs)
    Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'
    successfully executed in 11 ms 851 µs (server processing time: 8 ms 238 µs)
    Fetched 5 row(s) in 0 ms 62 µs (server processing time: 0 ms 0 µs)
    Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'
    successfully executed in 8 ms 522 µs  (server processing time: 6 ms 892 µs)
    Fetched 5 row(s) in 0 ms 93 µs (server processing time: 0 ms 0 µs)
    When I execute the select statement with the hard coded parameter value, I get much faster results:
    Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'
    successfully executed in 4 ms 430 µs  (server processing time: 2 ms 424 µs)
    Fetched 5 row(s) in 0 ms 73 µs (server processing time: 0 ms 0 µs)
    Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'
    successfully executed in 4 ms 105 µs  (server processing time: 2 ms 210 µs)
    Fetched 5 row(s) in 0 ms 69 µs (server processing time: 0 ms 0 µs)
    Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'
    successfully executed in 4 ms 694 µs  (server processing time: 2 ms 810 µs)
    Fetched 5 row(s) in 0 ms 60 µs (server processing time: 0 ms 0 µs)
    I have 500,000 rows in the Customers table and 2,500,000 rows in the Orders table. The tables are COLUMN tables.
    Is there an optimization that I'm missing?
    Regards,
    Bill

    Hi Bill,
    Can you please try something:
    tab_cust =
    SELECT
       C_F_NAME,
                C_L_NAME,
                C_EMAIL
    FROM    dbo.Customer
    WHERE   C_ID = :C_ID;
    tab_orders =
    SELECT
                O_ID,
                O_TOTAL,
                O_DTS,
                O_FM_DTS
    FROM    dbo.Orders ON C_ID = O_C_ID
    WHERE   O_C_ID = :C_ID
    SELECT  TOP 20
       C_F_NAME,
                C_L_NAME,
                C_EMAIL,
                O_ID,
                O_TOTAL,
                O_DTS,
                O_FM_DTS
    FROM    :tab_cust JOIN :tab_orders ON C_ID = O_C_ID
        ORDER   BY O_ID DESC;
    END;
    Expected behavior: The data set for each of the tables is filtered out and then joined. Although the filter is expected to be pushed to each of the joined tables even in your case, but this is worth the try.
    Regards,
    Ravi

  • Can call a function in the select statement?

    Is there any ways to call a function in the select statement?
    what I like to do is this:
    select deptno, totalEmployees(deptno), TotalSalary(deptno)
    from emp;
    I know it can be done by count(*) and join tables, but my case
    is much more complex and the where clauses are different from
    one function to another, and have many tables to join and many
    combinations
    Thanks

    Functions can be used in a select statement subject to certain
    restrictions, see
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/
    server.817/a85397/statem9b.htm#2062024
    It's under "CREATE FUNCTION> Keywords and Parameters> function>
    Restrictions on User-Defined Functions"
    Here is an except...
    When a function is called from within a query or DML statement,
    the function cannot:
    a) Have OUT or IN OUT parameters
    b) Commit or roll back the current transaction, create or roll
    back to a savepoint, or alter the session or the system. DDL
    statements implicitly commit the current transaction, so a user-
    defined function cannot execute any DDL statements.
    c) Write to the database, if the function is being called from a
    SELECT statement. However, a function called from a subquery in
    a DML statement can write to the database.
    d) Write to the same table that is being modified by the
    statement from which the function is called, if the function is
    called from a DML statement.
    Except for the restriction on OUT and IN OUT parameters, Oracle
    enforces these restrictions not only for the function called
    directly from the SQL statement, but also for any functions that
    function calls, and on any functions called from the SQL
    statements executed by that function or any function it calls.

  • Need to install only the query for fi account receivables standard data ?

    Hi all,
    I need to insall only the query for the standard business content for fi_ar in bw 3.5 ?
    i have selected the cube and then in grouping i have selected data flow afterwards only.
    And i have selected the queries only. but the cube is selected again. Should i uncheck the cube and install only the queries and transport it?
    Pls guide me on this!!
    Thanks
    Pooja

    Hi,
    If the required cube is already avaialble and continue with the existing design, you can uncheck the cube and install only queries. Check all the prerequisites before installing queries like used infoobjects, other targets if any.
    Hope this helps,
    Regards,
    Rama Murthy.

Maybe you are looking for