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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Need some help with the Select query.

    Need some help with the Select query.
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    select single vkorg abgru from ZADS into it_rej.
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
            VKORG TYPE VBAK-VKORG,
            ABGRU TYPE VBAP-ABGRU,
           END OF IT_REJ.
    This is causing performance issue. They are asking me to include the where condition for this select query.
    What should be my select query here?
    Please suggest....
    Any suggestion will be apprecaiated!
    Regards,
    Developer

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • 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

  • 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>

  • Need help with the session state value items.

    I need help with the session state value items.
    Trigger is created (on After delete, insert action) on table A.
    When insert in table B at least one row, then trigger update value to 'Y'
    in table A.
    When delete all rows from a table B,, then trigger update value to 'N'
    in table A.
    In detail report changes are visible, but the trigger replacement value is not set in session value.
    How can I implement this?

    You'll have to create a process which runs after your database update process that does a query and loads the result into your page item.
    For example
    SELECT YN_COLUMN
    FROM My_TABLE
    INTO My_Page_Item
    WHERE Key_value = My_Page_Item_Holding_Key_ValueThe DML process will only return key values after updating, such as an ID primary key updated by a sequence in a trigger.
    If the value is showing in a report, make sure the report refreshes on reload of the page.
    Edited by: Bob37 on Dec 6, 2011 10:36 AM

  • 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

  • Need some help understanding the way materialized views are applied through

    Hi, I need some help understanding the way materialized views are applied through adpatch.
    In patch 1, we have a mv with build mode immediate. When applying it PTS hang due to pool performance of mv refresh.
    So we provide patch 2, with that mv build mode deferred, hoping it'll go through. But patch 2 hang too on the same mv.
    How does this work? Is that because mv already exists in the database with build immediate, patch 2 will force it to refresh first before changing build mode? How to get over this?
    Thanks,
    Wei

    Hi Hussein,
    Thank you for the response.
    Application release is 11.5.10.
    Patch 1 is MSC11510: 8639586 ASCP ENGINE RUP#38 PATCH FOR 11.5.10 BRANCH
    Patch 2 is MSC11510: 9001833 APCC MSC_PHUB_CUSTOMERS_MV WORKER IS STUCK ON "DB FILE SEQUENTIAL READ" 12 HOURS
    The MV is APPS.MSC_PHUB_CUSTOMERS_MV
    This happens at customer environment but not reproducable in our internal environment, as our testing data is much smaller.
    Taking closer look in the logs, I saw actually when applying both patch 1 and patch 2, MV doesn't exist in the database. So seems my previous assumption is wrong. Still, strange that patch 2 contains only one file which is the MV.xdf, it took 7 hours and finally got killed.
    -- patch 1 log
    Materialized View Name is MSC_PHUB_CUSTOMERS_MV
    Materialized View does not exist in the target database
    Executing create Statement
    Create Statement is
    CREATE MATERIALIZED VIEW "APPS"."MSC_PHUB_CUSTOMERS_MV"
    ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 10 MAXTRANS 255 LOGGING
    STORAGE(INITIAL 4096 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 4 FREELIST GROUPS 4 BUFFER_POOL DEFAULT)
    TABLESPACE "APPS_TS_SUMMARY"
    BUILD IMMEDIATE
    USING INDEX
    REFRESH FORCE ON DEMAND
    WITH ROWID USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS select distinct
    from
    dual
    AD Worker error:
    The above program failed. See the error messages listed
    above, if any, or see the log and output files for the program.
    Time when worker failed: Tue Feb 02 2010 10:01:46
    Manager says to quit.
    -- patch 2 log
    Materialized View Name is MSC_PHUB_CUSTOMERS_MV
    Materialized View does not exist in the target database
    Executing create Statement
    Create Statement is
    CREATE MATERIALIZED VIEW "APPS"."MSC_PHUB_CUSTOMERS_MV"
    ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 10 MAXTRANS 255 LOGGING
    STORAGE(INITIAL 4096 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 4 FREELIST GROUPS 4 BUFFER_POOL DEFAULT)
    TABLESPACE "APPS_TS_SUMMARY"
    BUILD DEFERRED
    USING INDEX
    REFRESH COMPLETE ON DEMAND
    WITH ROWID USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS select distinct
    from dual
    Start time for statement above is Tue Feb 02 10:05:06 GMT 2010
    Exception occured ORA-00028: your session has been killed
    ORA-00028: your session has been killed
    ORA-06512: at "APPS.AD_MV", line 116
    ORA-06512: at "APPS.AD_MV", line 258
    ORA-06512: at line 1
    java.sql.SQLException: ORA-00028: your session has been killed
    ORA-00028: your session has been killed
    ORA-06512: at "APPS.AD_MV", line 116
    ORA-06512: at "APPS.AD_MV", line 258
    ORA-06512: at line 1
    Exception occured :No more data to read from socket
    AD Run Java Command is complete.
    Copyright (c) 2002 Oracle Corporation
    Redwood Shores, California, USA
    AD Java
    Version 11.5.0
    NOTE: You may not use this utility for custom development
    unless you have written permission from Oracle Corporation.
    AD Worker error:
    The above program failed. See the error messages listed
    above, if any, or see the log and output files for the program.
    Time when worker failed: Tue Feb 02 2010 19:51:27
    Start time for statement above is Tue Feb 02 12:44:52 GMT 2010
    End time for statement above is Tue Feb 02 19:51:29 GMT 2010
    Thanks,
    Wei

  • 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 can I call a Page Process from the Select statement for Report Page

    I'm able to call a javascript using the below:
    img src="#IMAGE_PREFIX#add2.gif" border="0" alt="Icon 4" onClick="javascript:add_connect1('||CPORT.ID||')"
    But Now,
    I'd like to accomplish (2) New things:
    1. instead of using,....... onClick="javascript:add_connect1,
    I'd like to call a Page Process, onClick=
    2. I'd like to be able to call two different processes onClick.
    a. onClick="javascript:passBack('||ID||')"
    b. onClick= <Please see my question #1 above>
    Can someone please help me with the syntax for this,
    If indeed it can even be done?
    Thanks- Gary

    Greg.
    It seems that my situation is the one you describe in you second paragraph, where you mention:
    you could then add the ID column value as a parameter to the javascript functionBut,
    I do not know how to reference the variable in my javascript nor how to use it in my on-demand process.
    If you can hellp me past this last little bump, then I think I will be able to use these skills in Sooo many different areas of my design.
    Here's what I've got so far:
    A. In the select statement I identify the javascript as:
    onClick="javascript:connect_port('<font color=blue>''||ID||''</font>')";
    B. In my javascript I have this:
    <script language="JavaScript" type="text/javascript">
    function connect_port(ID)
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=CONNECT_PORT',0);
    gReturn = get.get();
    get = null;
    </script>
    C. In my on demand function I have this:
    BEGIN
    INSERT INTO CCONNECTIONS_B
    BLDG_ID,CLST_ID,PORT_ID,STRAND_ID
    ) VALUES
    :P2004_BLDG_ID,:P2004_CLST_ID,:P2004_PORT_ID,:P2004_STRAND_ID1
    END;
    You can see that I dont know how to use the value for 'ID' in either the javascript or the On-Process function.
    If you can help me out with this one, Then I can imitate it for the rest.
    -Gary
    Edited by: garyNboston on Apr 3, 2009 6:44 AM
    Edited by: garyNboston on Apr 3, 2009 6:44 AM
    Edited by: garyNboston on Apr 3, 2009 6:45 AM
    Edited by: garyNboston on Apr 3, 2009 6:47 AM

  • 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

  • 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

  • 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.

  • Decode in the select Statement

    Hi All,
    I am using the decode function in the select statement....but as i am using the group by in the select statement....i am not able to run the same query
    How to tackle this problem of handling the decode ....while we have group by also.
    This is bit urgent
    Thanks for your help
    Ramya

    Hi,
    Thanks for the quick reply.
    Here is the code...i have included the decode for the customer carrier code...
    SELECT c.trx_number invoice_number,
    c.trx_date invoice_date,
    ctl.sales_order_date order_date,
    c.ship_date_actual ship_date,
    c.purchase_order,
    ctl.sales_order order_number,
    olv.ordered_item item,
    msi.description item_description,
    olv.ordered_quantity quantity,
    olv.unit_selling_price unit_price,
    olv.unit_selling_price * olv.ordered_quantity amount,
    olv.tax_value,
    rc.customer_number,
    csta.customer_carrier_code,
    (SELECT decode(customer_carrier_code, NULL, 'Shipping & Handling', 'Shipping') sh
    FROM xx_cust_ship_to_addresses_v cstaa,
    ra_addresses ara
    WHERE cstaa.location_id = ad.location_id
    AND ara.location_id = ad.location_id) SH,
    rc.customer_name invoice_to_name,
    rct.name invoice_type,
    olv.sold_to,
    olv.ship_to_location,
    olv.ship_to_address1,
    olv.ship_to_address2,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -2, LENGTH(olv.ship_to_address5)) ship_to_country,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -9, 6) ship_to_postalcode,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -12, 2) ship_to_state,
    SUBSTR(olv.ship_to_address5, 1, LENGTH(olv.ship_to_address5) -15) ship_to_city,
    olv.invoice_to_address1,
    olv.invoice_to_address2,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -2, LENGTH(olv.invoice_to_address5)) invoice_to_country,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -9, 6) invoice_to_postalcode,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -12, 2) invoice_to_state,
    SUBSTR(olv.invoice_to_address5, 1, LENGTH(olv.invoice_to_address5) -15) invoice_to_city,
    olv.flow_status_code,
    olv.terms net_terms,
    olv.freight_terms_code freight_terms,
    olv.fob_point_code fob
    FROM ra_customer_trx_all c,
    ra_customer_trx_lines_all ctl,
    ra_cust_trx_types rct,
    jtf_rs_salesreps rs,
    ra_customers rc,
    ra_addresses ad,
    ra_site_uses su,
    mtl_system_items msi,
    oe_order_headers_v ohv,
    oe_order_lines_v olv,
    rcv_lot_transactions tl,
    rcv_shipment_lines sl,
    rcv_shipment_headers rsh,
    rcv_transactions rt,
    wsh_delivery_details wdd,
    xx_cust_ship_to_addresses_v csta
    WHERE to_char(ohv.order_number) = ctl.sales_order
    AND ctl.customer_trx_id = c.customer_trx_id
    AND c.cust_trx_type_id = rct.cust_trx_type_id
    AND c.org_id = rs.org_id
    AND c.primary_salesrep_id = rs.salesrep_id
    AND c.ship_to_site_use_id = su.site_use_id
    AND su.address_id = ad.address_id
    AND ad.customer_id = rc.customer_id
    AND ctl.inventory_item_id = msi.inventory_item_id
    AND ohv.header_id = olv.header_id
    AND olv.line_id = wdd.source_line_id(+)
    AND to_char(olv.line_id) = ctl.interface_line_attribute6
    AND tl.shipment_line_id = sl.shipment_line_id
    AND sl.shipment_header_id = rsh.shipment_header_id
    AND tl.transaction_id = rt.transaction_id
    AND csta.location_id = ad.location_id;
    GROUP BY c.trx_number,
    csta.customer_carrier_code,
    c.trx_date,
    c.creation_date,
    c.ship_date_actual,
    c.sold_to_customer_id,
    c.bill_to_customer_id,
    c.bill_to_site_use_id,
    c.ship_to_customer_id,
    c.ship_to_site_use_id,
    c.purchase_order,
    (SELECT decode(customer_carrier_code, NULL, 'Shipping & Handling', 'Shipping') sh
    FROM xx_cust_ship_to_addresses_v cstaa,
    ra_addresses ara
    WHERE cstaa.location_id = ara.location_id
    AND ara.location_id = ad.location_id),
    ctl.sales_order,
    ctl.sales_order_date,
    ctl.tax_rate,
    ctl.customer_trx_id,
    ctl.taxable_amount,
    rc.customer_number,
    olv.ordered_item,
    olv.unit_selling_price,
    olv.unit_list_price,
    olv.tax_value,
    olv.unit_cost,
    olv.ordered_quantity,
    rs.name,
    rc.customer_name,
    rc.customer_id,
    rc.party_id,
    rc.party_number,
    ad.address_id,
    rct.name,
    msi.description,
    olv.unit_selling_price * olv.ordered_quantity,
    c.org_id,
    ohv.header_id,
    olv.sold_to,
    olv.ship_from,
    olv.ship_to_location,
    olv.ship_to_address1,
    olv.ship_to_address2,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -2, LENGTH(olv.ship_to_address5)),
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -9, 6),
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -12, 2),
    SUBSTR(olv.ship_to_address5, 1, LENGTH(olv.ship_to_address5) -15),
    olv.invoice_to_location,
    olv.invoice_to_address1,
    olv.invoice_to_address2,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -2, LENGTH(olv.invoice_to_address5)),
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -9, 6),
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -12, 2),
    SUBSTR(olv.invoice_to_address5, 1, LENGTH(olv.invoice_to_address5) -15),
    olv.flow_status_code,
    olv.terms,
    olv.freight_terms_code,
    olv.shipping_method_code,
    olv.fob_point_code,
    olv.line_id,
    rsh.attribute1,
    rsh.attribute2,
    su.tax_code,
    su.ship_via,
    wdd.tracking_number
    ORDER BY invoice_number;

  • F4 help in the selection screen from a int table

    I collected the datas from the function module. and the internal table is populated.
    the internal table contains manny fields.
    among these fields i need to take only one field and this field value to be used for F4 help in the selection screen ( not a dynpro)
    for example : in the selection screen
    I have to select the PO.
    based on the user i have filtered the PO. (determined dynamically by using the user name this i have done it)
    then i have to assign the PO the selection screen.
    which FM will be better to use  for this type of scenario and help me out with some example codes particularly for my req
    Thanks

    Hi ,
    use the FM 'F4IF_INT_TABLE_VALUE_REQUEST'
    This example is for search help for material type .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_mtart-low .
    select all material types you want to display in search help into table i_mtart.
    PERFORM select_material_type.
    PERFORM help_material_type.
    *& Form help_material_type
    text
    --> p1 text
    <-- p2 text
    FORM help_material_type .
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    DDIC_STRUCTURE = ' '
    retfield = 'MTART'
    PVALKEY = ' '
    dynpprog = sy-cprog
    dynpnr = sy-dynnr
    dynprofield = 'S_MTART-LOW'
    STEPL = 0
    WINDOW_TITLE =
    VALUE = ' '
    value_org = 'S'
    MULTIPLE_CHOICE = ' '
    DISPLAY = ' '
    CALLBACK_PROGRAM = ' '
    CALLBACK_FORM = ' '
    MARK_TAB =
    IMPORTING
    USER_RESET =
    TABLES
    value_tab = i_mtart
    FIELD_TAB =
    RETURN_TAB =
    DYNPFLD_MAPPING =
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    OTHERS = 3
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " help_material_type
    Regards,
    Balaji.

  • 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.

Maybe you are looking for

  • How to use drag n drop button in report display

    hello friends                          i'm displaying list report . i want one customer one time and with  diff amounts .ok first of all i'm diplaying detail customer details , if i click on one customer i have to display that cust one time and i wan

  • Back up a 16 gig iPhone 4s to iCloud

    How long does it take to back up a 16 gig iPhone 4s to iCloud?

  • Direct Postings from FI to COPA

    Hi! I have  done configuration for PA transfer strucutre for Direct Acct Assign. fr. FI/MM. but while I am creating the FI document , unless until I click on profitability segment field, system is not posting COPA document. Is it mandatory to click o

  • Running cmd commands through java

    Hi, I am trying to run few dos commands through java using Runtime.exec("command") but I am getting following error commmand is cd D:\CodeMerge\A\ java.io.IOException: CreateProcess: cd.. error=2 at java.lang.Win32Process.create(Native Method) at jav

  • I have CS4 and use photoshop, illustrator,

    I have CS4 and primarily only use Photoshope, illustrator, and Indesign running on an iMAC 10.8.5.   I want to upgrade to Apple's OSX Yosemite, but am reluctant to do so, as I keep reading that people are incountering "error" issues with the CS4 vers