Selecting from a TABLEVIEW

Hi All..,
Kindly dont give any 'Blog' link...
With all of your helps, I have created a popup to select possible values. My popup screen(its a View, emppop.htm) contains a tableview and showing employee details(empid,name etc.).
Now my requirement is to select a value from this Tableview and bring that value into a field in the view(find.htm).
My tableview code is:
      <htmlb:tableView id             = "pop"
                       table          = "<%= it_emp %>"
                       selectionMode  = "SINGLESELECT"
                       onRowSelection = "handleid('<%= empid %>')" >
      </htmlb:tableView>
<script language="JavaScript">
function handleid(id)
window.opener.document.emppop.empid.value = <%= empid %>;
window.close();
</script>
I am pretty sure that this code is wrong. But I am not able to find a simple example anywhere. Pls help me..
Thanks in advance..
Dev

Here is my code for you all
Controller- <b>emppop.do</b>
Controller class- <b>ZCL_12_POP</b>
METHOD DO_INIT.
SELECT * FROM Z12_EMP_PER INTO TABLE IT_EMP.
create object  iterator.
ENDMETHOD.
METHOD DO_REQUEST.
  DATA: POPVIEW TYPE REF TO IF_BSP_PAGE.
  dispatch_input( ).
  POPVIEW = CREATE_VIEW( VIEW_NAME = 'emppop.htm').
  POPVIEW->set_attribute( name = 'it_emp' value = it_emp ).
  CALL_VIEW( POPVIEW ).
ENDMETHOD.
METHOD DO_HANDLE_EVENT.
  DATA: IND TYPE I.
  DATA: TV TYPE REF TO CL_HTMLB_TABLEVIEW.
  DATA: EVENT1 TYPE REF TO CL_HTMLB_EVENT.
  EVENT1 = CL_HTMLB_MANAGER=>GET_EVENT( RUNTIME->SERVER->REQUEST ).
  TV ?= CL_HTMLB_MANAGER=>GET_DATA(
  REQUEST = RUNTIME->SERVER->REQUEST
  NAME = 'tableView'
  ID = 'pop' ).
  IF TV IS NOT INITIAL.
    DATA: TV_DATA TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
    TV_DATA = TV->DATA.
    IF TV_DATA->PREVSELECTEDROWINDEX IS NOT INITIAL.
      FIELD-SYMBOLS: <ROW> LIKE LINE OF IT_EMP.
      READ TABLE IT_EMP INDEX TV_DATA->PREVSELECTEDROWINDEX ASSIGNING
  <ROW>.
      DATA VALUE TYPE STRING.
      EMPID = <ROW>-EMPID.
    ENDIF.
  ENDIF.
ENDMETHOD.
method DO_HANDLE_DATA.
field-symbols: <field> type ihttpnvp.
read table form_fields with table key
           name = 'empid' assigning <field>.
me->empid = <field>-value.
endmethod.
View: <b>emppop.htm</b>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title=" " >
    <htmlb:form>
      <%
  data TV_ITERATOR Type Ref To zcl_12_iterator.              "zcl_itr - Iterator Function
  data iterator type ref to IF_HTMLB_TABLEVIEW_ITERATOR.
  create object tv_iterator .                                "exporting appl_cons = application.
      %>
      <htmlb:tableView id              = "pop"
                       width           = "200"
                       headerVisible   = "true"
                       design          = "alternating"
                       visibleRowCount = "10"
                       fillUpEmptyRows = "true"
                       selectionMode   = "SINGLESELECT"
                       showNoMatchText = "true"
                       filter          = "server"
                       sort            = "server"
                       onHeaderClick   = "MyEventHeaderClick"
                       table           = "<%= it_emp %>"
                       iterator        = "<%= iterator %>" >
      </htmlb:tableView>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

Similar Messages

  • Avoid first select event from a tableview

    Hi,
    Anyone know how to avoid the first select event from a tableview?
    I've tried the approach with a data store but the select event from the table is'nt available and if I write it manually I can't deploy the model.
    Best Regards
    Robin

    Robin,
      The error message probably wasn't written anywhere unless you've changed the default logging settings. 
      There's a sticky thread always at the top of this forum titled "How To Troubleshoot VC Issues" which contains a link to a pdf file - <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/92d80512-0a01-0010-32a3-cd3735bd9275">here's the same link</a>.  Near the end of that file are step by step instructions for turning on the logging.  Once you (or your admin) do that when you recompile/deploy a meaningful error message will appear in the VC editor as well as in the server log files.
    Good luck.

  • ALV grid list  report when selected  from  selection screen

    Hi folks,
                I need to get ALV grid display in my list report when selected the interval values from  the selection screen. If I change the values in list of ALV grid it needs to be updated when I press UPDATE pushbutton. The output of list should be in ALV grid display.I need sorting ,flitering,totaling functionality in the list output.
    For example if I selected BUKRS = 100 and 200 in the selection screen ,I need to display the ALV grid list in below the selection screen as ALV grid display...
    Its urgent as  I am new to ALV grid functionality...
    Thanks in advance..

    hi raja,
    check with the folllowing code.
    REPORT zca0m_zca0fcstftop NO STANDARD PAGE HEADING
                                    MESSAGE-ID zcsv_usrtbl_maintain.
    Type pools                                                           *
    TYPE-POOLS : slis.                          " Used for ALV display
    Tables
    TABLES: zca0fcstftop,
            dd04t,                         "R/3 DD: Data element texts
            tactt.                         "Activities that can be protected
    internal tables
    DATA: BEGIN OF wa_zca0fcstftop .
            INCLUDE STRUCTURE zca0fcstftop.
    DATA: END OF wa_zca0fcstftop.
    DATA: t_zca0fcstftop LIKE STANDARD TABLE OF wa_zca0fcstftop.
    DATA: BEGIN OF i_fcode OCCURS 0,
            fcode LIKE sy-ucomm,
          END OF i_fcode.
    *Record for variant selection
    DATA : BEGIN OF ws_variant,
             selected TYPE c,
             variant  LIKE ltdx-variant,  "Variant name
             text     LIKE ltdxt-text,    "Variant description
           END OF ws_variant.
    *Table for variant selection
    data : itab_variant LIKE STANDARD TABLE OF ws_variant WITH HEADER LINE.
    Variant selection pop-up global variables
    DECLARATION OF TABLECONTROL 'VARIANT_CNTL' ITSELF
    CONTROLS: variant_cntl TYPE TABLEVIEW USING SCREEN 0200.
    LINES OF TABLECONTROL 'VARIANT_CNTL'
    DATA:     g_variant_cntl_lines  LIKE sy-loopc.
    DATA:grid1 TYPE REF TO  cl_gui_alv_grid ,
         g_custom_container TYPE REF TO cl_gui_custom_container.
    Work fields
    DATA: table_name LIKE dd02l-tabname,   "To store table name
          field_name LIKE dd03l-fieldname, "To Store Field Name
          act_auth LIKE tactz-actvt,       "To pass Activity ID
          tab_maint LIKE dd02l-tabname,    "To pass Table Name to be Maintd.
          wg_confirm_ind,                  "To trap User responses
          flag,                            "To trap changes made to an entry
          f_copy,                          "To Identify 'COPY' Command Use
          f_select,                        "To decide between Select-options
                                           " and Internal Table
          l_transaction_code LIKE tstc-tcode,
          v_langu LIKE sy-langu,
          v_repid LIKE sy-repid,
          s_variant TYPE disvariant.
    DATA: ok_code LIKE sy-ucomm.
    DATA:selected_rows TYPE lvc_t_row  ,
         sel_rows TYPE lvc_t_row WITH HEADER LINE.
    DATA:t_lines TYPE i.
    Constants                                                            *
    CONSTANTS :
               c_x TYPE c VALUE 'X',             " Constant 'X'.
               c_f TYPE c VALUE 'F'.             " Constant 'F'.
    Parameters and Selection Options
    *Selection Screen for table maintenance
    *Selection option for Plant
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-b01.
    PARAMETERS:  p_werks   LIKE zca0fcstftop-werks OBLIGATORY.
    SELECT-OPTIONS: s_prdfml  FOR zca0fcstftop-product_family,
                    s_bmach   FOR zca0fcstftop-base_machine,
                    s_factop FOR zca0fcstftop-factory_top,
                    s_optval  FOR zca0fcstftop-option_value,
                    s_week    FOR zca0fcstftop-week.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-b02.
    PARAMETERS     : p_varant LIKE ltdx-variant.          " ALV variant
    SELECTION-SCREEN END OF BLOCK block2.
    At selection screen                                                  *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varant.
      PERFORM alv_variant_f4 CHANGING p_varant.
    AT SELECTION-SCREEN ON p_werks .
    Validating Plant on the selection screen
      PERFORM validate_plant.
    Initialization
    INITIALIZATION.
    Check Authorization for the Transaction
    Authorization Check For T Code
      SELECT tcode
         INTO l_transaction_code
         FROM tstc UP TO 1 ROWS
         WHERE pgmna = sy-repid.
      ENDSELECT.
      AUTHORITY-CHECK OBJECT 'S_TCODE'
                          ID 'TCD' FIELD l_transaction_code.
      IF sy-subrc NE 0.
        MESSAGE e001 WITH l_transaction_code.
      ENDIF.
      v_langu = sy-langu.                             " language
      v_repid = sy-repid .                            " abap Program name
    Start Of Selection
    START-OF-SELECTION.
      CALL SCREEN 0050.
    *&      Form  validate_plant                                           *
          Validating Plant on the selection screen                       *
    FORM validate_plant .
      DATA : l_werks LIKE t001w-werks.                          " Plant
      IF p_werks IS NOT INITIAL.
        SELECT SINGLE werks
            FROM t001w
            INTO l_werks
            WHERE werks EQ p_werks.
        IF sy-subrc NE 0.
          MESSAGE e100(ra) WITH text-001 .
        ENDIF.
      ENDIF.
      AUTHORITY-CHECK OBJECT 'Z_PP_PLANT'
               ID 'ACTVT' FIELD '03'
               ID 'WERKS' FIELD p_werks
               ID 'TCD' FIELD l_transaction_code.
      IF sy-subrc NE 0.
        MESSAGE e000(oo) WITH 'No authorization for plant:'(e80) p_werks.
      ENDIF.
    ENDFORM.                    " validate_plant
    *&      Form  get_data                                                 *
          Get data                                                       *
    FORM get_data .
      SELECT * FROM zca0fcstftop
        INTO TABLE t_zca0fcstftop
        WHERE werks           = p_werks
          AND product_family IN s_prdfml
          AND base_machine   IN s_bmach
          AND factory_top    IN s_factop
          AND option_value   IN s_optval
          AND week           IN s_week.
    ENDFORM.                    " get_data
    *&      Form  fill_fcode
    FORM fill_fcode USING    value(p_0029).
      i_fcode-fcode = p_0029.
      APPEND i_fcode.
      CLEAR i_fcode.
    ENDFORM.                               " fill_fcode
    *&      Module  STATUS_0100  OUTPUT
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'UPDATE'.
      CLEAR flag.
    ENDMODULE.                             " STATUS_0100  OUTPUT
    *&      Module  MODIFY_0100  OUTPUT
    MODULE modify_0100 OUTPUT.
      IF sy-ucomm = 'CHNG' OR
           sy-ucomm = 'PICK'.
        LOOP AT SCREEN.
          CHECK screen-group1 = 'CHG'.
          screen-required = '0'.
          screen-output   = '1'.
          screen-input    = '0'.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    Check if you are in create mode & if yes then set the screen elements
    as mandatory
      IF ok_code = 'CREA'.
        LOOP AT SCREEN.
          CHECK screen-group1 = 'CHG'.
          screen-required = '1'.
          screen-output   = '1'.
          screen-input    = '1'.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    ENDMODULE.                             " MODIFY_0100  OUTPUT
    *&      Module  Check_Exit  INPUT
          text
    MODULE check_exit INPUT.
      IF ( sy-ucomm = 'BACK' OR sy-ucomm = 'CANC' OR sy-ucomm = 'EXIT' ) AND
           ( flag = 'Y' ).
        CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
          EXPORTING
            defaultoption  = 'Y'
            textline1      = text-008
            textline2      = text-009
            titel          = text-004
            cancel_display = ' '
          IMPORTING
            answer         = wg_confirm_ind.
        CASE wg_confirm_ind.
          WHEN 'J'.                                             "Yes
            sy-ucomm = 'SAVE'.
            CLEAR flag.
          WHEN 'N'.                                             "No
            sy-ucomm = 'BACK'.
            CLEAR flag.
        ENDCASE.
      ENDIF.
    ENDMODULE.                             " Check_Exit  INPUT
    *&      Module  Exit_0100  INPUT
          text
    MODULE exit_0100 INPUT.
      SET SCREEN 0. LEAVE SCREEN.
    ENDMODULE.                             " Exit_0100  INPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'SAVE'.                       "Save
        Check to see if the user has the appropriate authorization
          IF p_werks NE zca0fcstftop-werks.
          could not update - not in selection
            MESSAGE e000(oo) WITH 'Entry not within selection'.
            SET SCREEN 0. LEAVE SCREEN.
            PERFORM get_data.
          ENDIF.
          IF f_copy = 'X'.
            INSERT zca0fcstftop.
            IF sy-subrc = 0.
              MESSAGE s004.
              PERFORM initialize.
              SET SCREEN 0. LEAVE SCREEN.
              PERFORM get_data.
            ELSE.
              MESSAGE w005.
            ENDIF.
          ELSE.
            MODIFY zca0fcstftop.
            IF sy-subrc = 0.
              MESSAGE s004.
              PERFORM initialize.
              SET SCREEN 0. LEAVE SCREEN.
              PERFORM get_data.
            ELSE.
              MESSAGE w005.
            ENDIF.
          ENDIF.
          PERFORM get_data.
        WHEN 'BACK'.                       "Back
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'CANC'.                       "Cancel
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      COMMIT WORK.
    ENDMODULE.                             " USER_COMMAND_0100  INPUT
    *&      Form  Initialize
    FORM initialize.
      CLEAR :   table_name,
                field_name,
                wg_confirm_ind,
                f_copy,
                flag,
                t_zca0fcstftop,
                zca0fcstftop,
                wa_zca0fcstftop,
                i_fcode.
      REFRESH: t_zca0fcstftop.
    ENDFORM.                               " Initialize
    *&      Form  alv_variant_f4
          text
         <--P_VARIANT  text
    FORM alv_variant_f4  CHANGING variant.
      DATA: rs_variant LIKE disvariant.
      DATA nof4 TYPE c.
      CLEAR nof4.
      LOOP AT SCREEN.
        IF screen-name = 'VARIANT'.
          IF screen-input = 0.
            nof4 = 'X'.
          ENDIF.
        ENDIF.
      ENDLOOP.
      rs_variant-report   = sy-repid.
      rs_variant-username = sy-uname.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = rs_variant
          i_save     = 'A'
        IMPORTING
          es_variant = rs_variant
        EXCEPTIONS
          OTHERS     = 1.
      IF sy-subrc = 0 AND nof4 EQ space.
        variant = rs_variant-variant.
      ENDIF.
    ENDFORM.                               " ALV_VARIANT_F4
    *&      Module  STATUS_0050  OUTPUT
          text
    MODULE status_0050 OUTPUT.
    In this module Initialize the container and put the grid in it
      DATA:grid_layout  TYPE lvc_s_layo,
           fieldcat TYPE lvc_t_fcat,
           wa_fieldcat LIKE LINE OF fieldcat.
      PERFORM set_auth.
      SET PF-STATUS 'UPD_0050' EXCLUDING i_fcode.
      SET TITLEBAR 'UPD_0050'.
      IF g_custom_container IS INITIAL .
        CREATE OBJECT g_custom_container
           EXPORTING
              container_name = 'FTDATA'.
        CREATE OBJECT grid1
           EXPORTING
            i_parent = g_custom_container.
      ELSE.
        CALL METHOD grid1->free.
        CALL METHOD g_custom_container->free.
        CREATE OBJECT g_custom_container
           EXPORTING
              container_name = 'FTDATA'.
        CREATE OBJECT grid1
           EXPORTING
            i_parent = g_custom_container.
      ENDIF.
    Every time refresh The variables
      PERFORM initialize.
      PERFORM get_data.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZCA0FCSTFTOP'
        CHANGING
          ct_fieldcat      = fieldcat.
      grid_layout-grid_title = text-t01.
      grid_layout-sel_mode = 'A'.
      grid_layout-stylefname = 'CT'.
      s_variant-report   = sy-repid.
      s_variant-username = sy-uname.
      s_variant-variant  = p_varant.
      CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZCA0FCSTFTOP'
          is_layout        = grid_layout
          is_variant       = s_variant
          i_save           = 'A'
        CHANGING
          it_outtab        = t_zca0fcstftop
          it_fieldcatalog  = fieldcat.
      Create Object to receive events and link them to handler methods.
      When the ALV Control raises the event for the specified instance
      the corresponding method is automatically called.
    CREATE OBJECT event_receiver.
    SET HANDLER event_receiver->handle_button_click FOR grid1.
    ENDMODULE.                 " STATUS_0050  OUTPUT
    *&      Module  USER_COMMAND_0050  INPUT
    MODULE user_command_0050 INPUT.
      CALL METHOD grid1->get_selected_rows
        IMPORTING
          et_index_rows = selected_rows.
      DESCRIBE TABLE selected_rows LINES t_lines.
      IF t_lines > 1 .
        MESSAGE e048(zcsv_sfdr).
      ENDIF.
    Clear Header
      CLEAR wa_zca0fcstftop.
      sel_rows[] = selected_rows .
      READ TABLE sel_rows INDEX 1.
      READ TABLE t_zca0fcstftop INTO wa_zca0fcstftop INDEX sel_rows-index.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN 'CREA'.
          CLEAR zca0fcstftop.
          ok_code = sy-ucomm.
          zca0fcstftop-werks = p_werks.
          CALL SCREEN 100.
        WHEN 'COPY'.
          MOVE wa_zca0fcstftop TO zca0fcstftop .
          CLEAR wa_zca0fcstftop.
          f_copy = 'X'.
          CALL SCREEN 100.
        WHEN 'CHNG'.
          CHECK NOT wa_zca0fcstftop IS INITIAL.
          MOVE wa_zca0fcstftop TO zca0fcstftop .
          CLEAR wa_zca0fcstftop.
          ok_code = sy-ucomm.
          CALL SCREEN 100.
        WHEN 'DELE'.
          CHECK NOT wa_zca0fcstftop IS INITIAL.
          CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
            EXPORTING
              defaultoption  = 'N'
              textline1      = text-005
              textline2      = text-006
              titel          = text-007
              cancel_display = ' '
            IMPORTING
              answer         = wg_confirm_ind.
          IF wg_confirm_ind EQ 'J'.
            DELETE zca0fcstftop FROM wa_zca0fcstftop .
            IF sy-subrc EQ 0.
              MESSAGE s004.
            ELSE.
              MESSAGE e005.
            ENDIF.
          ELSEIF wg_confirm_ind EQ 'N'.
          ENDIF.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                 " USER_COMMAND_0050  INPUT
    *&      Form  exit_program
    FORM exit_program .
      CALL METHOD g_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      SET SCREEN 0.
      LEAVE SCREEN.
    ENDFORM.                    " exit_program
    *&      Form  set_auth
    FORM set_auth.
      REFRESH: i_fcode.
    Check authorization for change
      MOVE '02' TO act_auth.        "02 --> Change
      MOVE 'ZCA0FCSTFTOP' TO tab_maint.
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
        ID 'ACTVT' FIELD act_auth
        ID 'TABLE' FIELD tab_maint.
      IF sy-subrc NE 0.
        PERFORM fill_fcode USING 'CHNG'.
      ENDIF.
    Check for authorization for create
      MOVE '01' TO act_auth.        "01 --> Create
      MOVE 'ZCA0FCSTFTOP' TO tab_maint.
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
        ID 'ACTVT' FIELD act_auth
        ID 'TABLE' FIELD tab_maint.
      IF sy-subrc NE 0.
        PERFORM fill_fcode USING 'CREA'.
        PERFORM fill_fcode USING 'COPY'.
      ENDIF.
    Check for authorization for delete
      MOVE '06' TO act_auth.        "06 --> Delete
      MOVE 'ZCA0FCSTFTOP' TO tab_maint.
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
        ID 'ACTVT' FIELD act_auth
        ID 'TABLE' FIELD tab_maint.
      IF sy-subrc NE 0.
        PERFORM fill_fcode USING 'DELE'.
      ENDIF.
    ENDFORM.                    " set_auth
    *&      Module  check_change  INPUT
    MODULE check_change INPUT.
      flag = 'Y'.
    ENDMODULE.                 " check_change  INPUT
    regards,
    vikas.
    plz reward if helpful

  • Selection from a Maintenance View

    Hi,
        I have to fetch data from a view, unfotunately that view is a mainteance view. Is there any other way to select/fetch data from that view in my report program ?
    Regards,
    Bharath Mohan B

    Hi
    U cannot access the data from maintanence view.
    Only projection and database view can be used in ABAP code.
    If u want to access the Data from more the one table , Create the DATABASE VIEW and use this view in ur program.
    For example : UR Database view name is Ztest
    in ur program
    table Ztest.
    select * from Ztest ***************
    *******************UR Business Logic
    <b>Reward if useful</b>

  • URGENT : select from table statement in ABAP OO

    Hi all,
    I am an absolute ABAP OO beginner and need some quick help from an expert. How can I make a selection from an existing table (eg MARA) in an BADI which is programmed according to ABAP OO principles.
    In the old ABAP school you could make a TABLES statement at the beginning and the do a SELECT¨* FROM but this does not work in ABAP OO.
    How should i define such simple selections from existing tables. Anyone ?
    Thanks a lot,
    Eric Hassenberg

    *define internal table
    data: i_mara like standard table of mara.
    *select to this table
    select * from mara into table i_mara.
    Also you have to define work area for this internal table in order to use it.
    data:w_mara like line of i_mara.

  • Select from v$sql_plan in a procedure

    Hi
    I''m attempting to save plans (from V$SQL_PLAN) into a table using a procedure in schema APPS, but keep getting missing table error,
    PL/SQL: ORA-00942: table or view does not existI then granted an explicit SELECT to APPS on the V$SQL_PLAN table from a schema with
    a DBA role, but still get the same error when compiling the procedure.
    SQL> create table gl_imp_post_plans as ( select * from v$sql_plan where rownum < 1);
    Table created.
    SQL> select count(*) from v$sql_plan;
      COUNT(*)
         13506
    SQL> create or replace procedure Ins_Plan_from_Dictionary as
      2 
      3    begin
      4      insert into GL_Imp_Post_Plans
      5      select  sqo.*
      6      from    v$sql_plan sqo
      7      where  (sqo.sql_id) not in (select distinct gipi.SQL_ID
      8                                  from   GL_Imp_Post_Plans gipi)
      9      and    (sqo.sql_id) in     (select distinct
    10                                         sqi.sql_id
    11                                  from   v$sql_plan sqi
    12                                  where  sqi.object_owner = 'APPS'
    13                                  and    sqi.object_name  in ('GL_BALANCES','GL_DAILY_BALANCES','GL_JE_LINES') );
    14      commit;
    15 
    16 
    17      exception
    18        when others then
    19          rollback;
    20  --        sysao_util.Message ('O', 'Error ' || sqlerrm);
    21 
    22  end Ins_Plan_from_Dictionary;
    23  /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE INS_PLAN_FROM_DICTIONARY:
    LINE/COL ERROR
    4/5      PL/SQL: SQL Statement ignored
    11/40    PL/SQL: ORA-00942: table or view does not exist
    SQL>
    SQL> l 11
    11*                                 from   v$sql_plan sqiThe same error occurs when I attempt to select from GV$SQL_PLAN or DBA_HIST_SQL_PLAN.
    Could anybody suggest how I can persist the rows into a table using a procedure?
    thanks

    thanks, yes this works:
    create or replace procedure Ins_Plan_from_Dictionary as
      begin
        execute immediate 'begin
                            insert into GL_Imp_Post_Plans
                            select  sqo.*
                            from    v$sql_plan sqo
                            where  (sqo.sql_id) not in (select distinct gipi.SQL_ID
                                                        from   GL_Imp_Post_Plans gipi)
                            and    (sqo.sql_id) in     (select distinct
                                                               sqi.sql_id
                                                        from   v$sql_plan sqi
                                                        where  sqi.object_owner = ''APPS''
                                                        and    sqi.object_name  in (''GL_BALANCES'',''GL_DAILY_BALANCES'',''GL_JE_LINES'') );
                            commit;
                           end;';
        exception
          when others then
            rollback;
    --        sysao_util.Message ('O', 'Error ' || sqlerrm);
    end Ins_Plan_from_Dictionary;
    /

  • Can not select from v$mttr_target_advice

    Hello
    When i try to select from the view it never comes back and is a problem for the mmon process. Anyone have any ideas.

    Could you pleasse post the error message and the version you are using?
    Best Regards
    Krystian Zieja / mob

  • Can not select from my own MV. Please help.

    Hello Gurus,
    I have created a MV with following clauses
    CREATE or REPLACE MATERIALIZED VIEW "OWNER_NAME1"."MV_Name1"
    BUILD IMMEDIATE
    USING INDEX
    REFRESH COMPLETE
    AS
    SELECT column1, column2 .... from table1,table2
    where .....
    I have logged in to DB with the 'owner_name1' schema itself which is the owner of the MV.
    But, when I try to select from the above MV. It gives error "Ora-00942 table or view does not exist"
    I can see the same under 'user_objects' view as an object of owner_name1 schema.
    Could you please help me in understanding where I have gone wrong?
    DB - Oracle 9i on unix platform.
    Thanks in advance!
    Abhijit.

    Oh! I missed to mention the exact steps followed by me which created error for me,
    viz.
    1) I have 2 Database and their users as follows
    bq. i) DB1 in local server - 'localUser'
    bq. ii) DB2 in remote server - 'RemoteUser1' and 'RemoteUser2'
    2) 'RemoteUser2' user in DB2 has 'select' privilage on table 'RemoteTable1' of 'RemoteUser1' ( both are remote DB's users ! )
    i.e. select * from RemoteUser1.RemoteTable1; --works okay when logged into RemoteUser2. no synonyms are created hence using schema_name.table_name convention.
    3) Logged in to 'localUser' in DB1.
    4) Created a DB link 'local_to_remote2' in 'localUser' schema ( in DB1) to 'RemoteUser2' schema (in DB2)
    i.e.
    create database link local_to_remote2 connect to RemoteUser2 identified by password using 'connection_string';
    DBLink was created successfully.
    5) I could select from the tables of 'RemoteUser2' using DB Link. (by logging in to 'localUser')
    i.e. select * from RemoteUser1.RemoteTable1@local_to_remote2 ; --- gives me expected output. no issues!
    6) Now, I created below MV in 'localUser' ( no need to tell in 'DB1' )
    the exact syntax I used is as follows,
    CREATE or REPLACE MATERIALIZED VIEW "localUser"."MV_Name1"
    BUILD IMMEDIATE
    USING INDEX
    REFRESH COMPLETE
    AS
    SELECT column1, column2
    From RemoteUser1.RemoteTable1@local_to_remote2
    where condition1
    and condition2;
    The MV was created successfully, and I could see it as an 'Valid' object of 'localUser' schema.
    i.e. select * from user_objects where object_name ='MV_NAME1' and status ='VALID' --- tells that above create MV is an object of owner 'localUser'
    But, when I try to select from the said MV. it gives me error "Ora-00942 table or view does not exist"
    i.e. select * from MV_Name1; ---- neither this
    select * from localUser.MV_Name1; ---- nor this works :(
    Even when I try to drop the same MV it gives me same error. :(
    Could you please suggest me anything so that I will be able to select from MY OWN MV ?
    Please help Gurus.

  • Can not select from SAPTOOLS.DB6PMCF

    We use third-party tool to monitor our SAP systems. We receive an error
    Can not select from SAPTOOLS.DB6PMCF
    when we monitor DB2 database.
    Function DB6PMCF is registered in SAPSID schema. Can I register it also in SAPTOOLS schema? What is a correct procedure for this?

    Hi Milan,
    I think you have to issue the following command for the affected user.
    db2 "grant execute on function saptools.db6pmcf to <user>"
    regards, Javier Rocha

  • Can't select from view even though it appears in ALL_VIEWS

    Oracle's documentation states that all_views "describes the views accessible to the user":
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2117.htm
    DBA_OBJECTS appears in the ALL_VIEWS, yet I get a "table or view does not exist" error when I try to select from it.
    Any thoughts on why this is happening?
    SQL> SELECT COUNT(1)
      FROM all_views
      WHERE owner = 'SYS'
      AND view_name = 'DBA_OBJECTS'
      COUNT(1)
             1
    1 row selected.
    SQL> SELECT *
      FROM sys.dba_objects
    SELECT *
      FROM sys.dba_objects
    Error at line 2
    ORA-00942: table or view does not exist

    That's not standard behaviour:
    DBA >create user u1 identified by u1;
    Utente creato.
    DBA >grant connect to u1;
    Concessione riuscita.
    DBA >conn u1/u1
    Connesso.
    DBA >select count(0) from all_views;
      COUNT(0)
           856
    DBA >select view_name from all_views
      2  where view_name like 'DBA%'
      3  or view_name like 'V$%';
    VIEW_NAME
    DBA_PROCEDURES
    DBA_PUBLISHED_COLUMNS
    V$OBJECT_USAGE
    DBA >select 'select count(*) from '||owner||'.'||view_name||';'
      2  from all_views
      3  where view_name like 'DBA%'
      4  or view_name like 'V$%';
    'SELECTCOUNT(*)FROM'||OWNER||'.'||VIEW_NAME||';'
    select count(*) from SYS.DBA_PROCEDURES;
    select count(*) from SYS.DBA_PUBLISHED_COLUMNS;
    select count(*) from SYS.V$OBJECT_USAGE;
    DBA >select count(*) from SYS.DBA_PROCEDURES;
      COUNT(*)
          6793
    DBA >select count(*) from SYS.DBA_PUBLISHED_COLUMNS;
      COUNT(*)
             0
    DBA >select count(*) from SYS.V$OBJECT_USAGE;
      COUNT(*)
             0All the DBA* or V$ visible are also accessible, DBA_OBJECTS is not present in ALL_VIEWS.
    There's something strange on your user's priviledges...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/02/query-gerarchiche/]

  • Can I Select from table skipping extents linked with lost datafiles?

    Hi~,
    I need your help to recover my database.
    I'm using oracle 9.2.0.8 at Fedora 3 with no-archive mode.
    and I don't have any backup.
    Last night, I experenced hard disk failure.
    I tried OS-level recovery, but I lost some datafiles of tablespace.
    anyway, I wanted to recover my database without data of lost datafiles.
    so, I issued "alter database datafile offline drop" and
    start oracle instance.
    But, datafiles were not removed from dba_data_files view and
    extents linked with lost datafiles were not removed from dba_extents view!
    Selecting query of some table containing extents linked with lost data files,
    I got "ORA-00376: file xxx cannot be read at this time" message.
    So, my question is that..
    HOW CAN I SELECT FROM THAT TABLE WITHOUT SCANNING EXTENTS LINKED WITH LOST DATA FILES?
    Thanks.

    Hi,
    Without being in archivelog and without backup, one can't do any sort of recovery. That's why backups and archivelog are so so important.
    The offline data file command never does actually drop the datafile. It merely indicates to the control file that now the said tablespace will also be dropped. This won't update any view that the files are not supposed to be used or shown to you anymore.
    This is what documentation says about the recovery of the database in the NoARch mode,
    http://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/osrecov.htm#i1007937
    You do need a backup in order to get those tables being read. Oracle doesn't have any feature which can offline/skip the missing extents for you and let you read the data without them.
    HTH
    Aman....

  • Select from .. as of - using archived redo logs - 10g

    Hi,
    I was under the impression I could issue a "Select from .. as of" statement back in time if I have the archived redo logs.
    I've been searching for a while and cant find an answer.
    My undo_management=AUTO, database is 10.2.0.1, the retention is the default of 900 seconds as I've never changed it.
    I want to query a table as of 24 hours ago so I have all the archived redo logs from the last 48 hours in the correct directory
    When is issue the following query
    select * from supplier_codes AS OF TIMESTAMP
    TO_TIMESTAMP('2009-08-11 10:01:00', 'YYYY-MM-DD HH24:MI:SS')
    I get a snapshot to old ORA-01555 error. I guess that is because my retention is only 900 seconds but I thought the database should query the archive redo logs or have I got that totally wrong?!
    My undo tablespace is set to AUTOEXTEND ON and MAXSIZE UNLIMITED so there should be no space issues
    Any help would be greatly appreciated!
    Thanks
    Robert

    If you want to go back 24 hours, you need to undo the changes...
    See e.g. the app dev guide - fundamentals, chapter on Flashback features: [doc search|http://www.oracle.com/pls/db102/ranked?word=flashback&remark=federated_search].

  • How to select from list of values?

    Dear All,
    I am using XML publisher for word, where I need to select a value from a list of values, for example I have hotel code like TTAG,TOBBR,TTAG,TOTM now I need
    to select hotel code and the corrosponding data should be display on word after
    running the RTF. Tell me, how can I achive the same?
    hare krishna
    Alok

    Thanks prety much,I am using XML to upload data from there into RTF templete. I've already insert table through load data option, but my problem is, how could I select a value from a list of values and based on that value selected from the list, it should displaydata corrosping to it. For example, I have few codes like TTAG, AMAG, TOTOM and if I select TOTM, it should display the complete address of that hotel named TOTM. If above given scenario is not at all possible, then Is there any alternate method to achieve this?
    hare krishna
    Alok

  • How to select from a stored procedure?

    Lets say I have a simple stored procedures
    Create Procedure stp_test
    As
    Begin
     Select * from tbl1
    End
    Go
    I would like to be able to do this in SSMS (actually, I want to do this from ADODB)
    Select top 10 * from ...stp_test... Order By rowID
    It looks like I want to use OpenQuery on the stored Procedure, but I have not been able to do it correctly.  How can I query my stored procedure?
    Rich P

    It looks like I want to use OpenQuery on the stored Procedure, but I have not been able to do it correctly.  How can I query my stored procedure?
    If you want to use the OPENQUERY method , use the following.. follow this link...
    http://stackoverflow.com/questions/209383/select-columns-from-result-set-of-stored-procedure
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • F4IF_INT_TABLE_VALUE_REQUEST - what line was selected from list displayed

    I am building an internal table and displaying it as search help using F4IF_INT_TABLE_VALUE_REQUEST.  How can I tell what line was selected from the search help?  Only one field is filled with the selection, but there are several other fields attached to this that I need in my program - but I can't tell which line was selected, and the one field is not enough information to use to get the record from the internal table.

    Hi,
    RETURN_TAB would have the selected values.
    FIELD_TAB will have the hit list fields.
    DYNPFLD_MAPPING will have the Assignment of the screen fields to the internal table.
    Regards,

Maybe you are looking for

  • Oracle ADF/BC4J vs "other" Java/J2ee technologies. Influence a decision

    Dear All, Our dev group is now at the stage when we need to make a decision which way to go - "proprietary" Oracle ADF/BC4J route or open source/java/j2ee standard. In our group we have a mix of Oracle Foms, pl/sql and java developers. The problem is

  • From 3.5 to 11.1

    Hi all, i need to migrate an application built on version 3.5 to 11.1. Is there anyone who can tell me the steps to do the migration?? Thanks in advance.

  • Liquify very slow processing

    I recently upgraded to a faster processor including SSD for a scratch disc. Although I have 32gig of ram with CS5 running on Windows 7 and it never uses a scratch.  I thought I could save an hour a week with waiting for liquify to do it's thing but a

  • Can't play .mov files in Xine

    Hi I am pretty new to Arch but it is great so far.  I am running vanilla KDE4 with Xine as the Phonon backend.  One problem I'm having is that I can't play .mov files.  Other stuff like .wmv and .avi play ok.  I also have the codecs package installed

  • Oracle Daily Business Intelligence Designer

    hi i'm working on Oracle EBS ERP R12 i have created lots of report in oracle dbi R12 the dashboard output like this INV_NAME----qty---------rate HR C12----------5-------------0.6 i want multiple dimension .. like this INV_NAME-------UOM----------QTY-