Count number rows in multiple tables from one query

Hi
I was wondering if its possible to have a single query return the number of lines in multiple tables, for example i have the tables
foo1
pk_foo1
and
foo2
pk_foo2
They are not joined together by any contraints. So the pseudo code for the query would be something like
SELECT numrows(pk_foo1), numrows(pk_foo2) FROM foo1, foo2
Thanks!

without a join you get a cartesian product for the query:
SQL> select count(d.deptno),count(e.deptno)
  2  from dept d,emp e
  3  /
COUNT(D.DEPTNO) COUNT(E.DEPTNO)
            105             105so you need to do a bit of trickery
  1  select a.cnt,b.cnt
  2  from
  3  ( select count(d.deptno) cnt from dept d ) a,
  4* ( select count(e.deptno) cnt from emp e) b
SQL> /
       CNT        CNT
         7         15
SQL> select count(*) from dept;
  COUNT(*)
         7
SQL> select count(*) from emp;
  COUNT(*)
        15

Similar Messages

  • Add to Multiple Tables from One Page

    Hello,
    I am building an application that handles hardware inventory (APEX 4.0). I have an input page that adds data to two or more tables all at once. The page has two forms on it that point to two separate tables. However when I try to run the page, it fails and returns an error:
    ORA-06550: line 1, column 437: PL/SQL: ORA-00904: "ORH_LAST_UPDATE_DATE": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
         Error      Unable to process row of table IDD_ID_DATA.
    So far as i can see within the App, that column is not at issue (I am not even doing anything to it and it is nullable). I have looked into the App itself as well as doing some online research but have found nothing helpful...
    So my question is this: Is it possible to add to multiple tables from one page? If so how do I do it?
    I am new to APEX so any help would be greatly appreciated!

    UPDATE:
    I received an email from the APEX Support Team:
    "The simple answer is that you will need to manually code the DML (and query) processes if you wish to maintain multiple tables from one page (There is a limit of one table when using the built-in processes).
    In order to do this I suggest you delete the processes generated by the wizards and create PL/SQL processes with insert, update, delete statements as necessary. Such coding is not difficult but is more time consuming than when you can use built-in processes."
    I have been playing around with PL/SQL code and the end result is this:
    begin
         INSERT INTO table1
         VALUES(
              :P2_Item_Field1,
              :P2_Item_Field2);
         INSERT INTO table2
         VALUES(
              :P2_Item_Field1,
              :P2_Item_Field2);
    end;
    I used this code in a custom PL/SQL Process in the Processing>Processes section of Page Processing and it seems to work fine now. The only downside to this method is if the name of a Page Item is changed the code will also have to be changed. Other than that i have had no problems.

  • Insert/update multiple tables from one form.

    I'm working on an app. that requires the user to fill out a form. The contents from the form is then used to either insert new records or update existing records in multiple tables. Is that possible? Can someone give a details example?

    You should create a form like you would create it having one table. Use row_id as primary key. The rest of the process are done by the triggers - those will take care of updating the right table depending which column was hit.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Rows in all tables in one query

    Hi All,
    How can i find the numbers of rows (records) in all the tables except system tables with single query.
    In one tran table i have around 10,00,000 (TEN LACS) rows. while processing it take time. Plz suggest some solution for this.
    Regards,
    Mummy

    Hi,
    You could use the NUM_ROWS column in the ALL_TABLES table. This column only gets populated if you collect statistics on the relevant tables though.
    See: http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2105.htm#REFRN20286
    You can analyze the relevant tables first and then use a SUM. For instance this query gets the total number of rows in the tables in the schema MAST:
    select sum(num_rows) from all_tables where owner = 'MAST';
    Regards,
    Marco
    =
    www.marcostuijvenberg.nl

  • Update multiple UDF from one query generator

    Hi All,
    I have Form1 with multiple UDF1 which have been key in by users
    And another Form2 with multiple UDF2 which exactly same with Form1 UDF1
    Is there a way that I can copy multiple UDF at Form2UDF2 from Form1UDF1 instead of creating query for each individual UDF, where in query generator I can select more the one column but only first column will be insert to the single UDF.
    Thanks

    Hi Firos,
    I mean I have 7UDF in the Payment Form where the information to this UDF are come from 7UDF in the invoice form which already created previously so I would like to copy those UDF from invoice to UDF in payment by using single query to capture all the UDF information by doing:
    SELECT T0.[DocNum], T0.[UDF1], T0.[UDF2], T0.[UDF3], T0.[UDF4], T0.[UDF5], T0.[UDF6], T0.[UDF7]
    FROM OINV T0 WHERE T0.[CardCode] = $[ORCT.CardCode]
    From above query can I pass the result directly to UDF in Payment Form? or I need to create one query for each individual UDF.
    Thanks

  • Creating multiple reports from one query

    Hello Everyone
    I are designing crystal reports where 1 query is built for 1 report / 1 sub-report. To improve overall efficiency of reports, I am trying to design multiple reports/ subreports from the same query. All the sub-reports belong to the parent report and they are very similar to each other.
    For example: in Webintelligence, we can just create 1 data provider and pull multiple reports from it and display it in multiple tabs.
    Can we do the same thing in Crystal reports??
    Please advice.
    Thanks
    Edited by: Devesh  Modi on Jun 9, 2010 11:19 PM

    Hello,
    If you are using WEBI then you have access to BOE. Create a Universe and publish it to the Repository and then you can use it as your data source.
    But I think what you are asking is how to query the DB once? Not possible, each subreport will run the query each time it's viewed.
    What you may want to do is create a Stored Procedure and get all of you info into one data collection and not use subreports, use grouping to emulate subreports. As an Example ....
    You may want to create a case in Service Market Place since you have BOE and work with a Report Design Rep to help you work out the best solution for you.
    Thank you
    Don

  • Update SAME column name in two tables from ONE query

    Dear All Seniors
    Please tell me is it possible to update a same column name in two tables.
    I have two tables in same schema
    (1)table name
    pem.igp_parent
    column name
    igp_no.
    igp_type
    (2)table name
    pem.igp_child
    column name
    igp_no.
    igp_type
    i want to update igp_no column in one query please tell me how it would be possible.
    thanks
    yassen

    You want to update the data from what to what? Where is the new data coming from?
    If you are trying to put the same data in two different tables, that strongly implies that you have a normalization problem that needs to be addressed.
    Why do you want a single query rather than updating each table in turn? Can you join the two target tables to produce a key-preserved view?
    Justin

  • Loading multiple tables from one xml-file

    I've got one xml-file containing information which should be loaded into multiple database tables. How can I do that?

    Please use XSLT to tranform to XML file with XSU recognized format and separated for different table input.
    You may refer to Example in book "Building Oracle XML Applications".
    null

  • Multiple charts from one query

    I have a database containing demographic information for
    visitors to various sites. I would like to create a separate chart
    for each site summarizing its demographics. My SQL statement looks
    something like this:
    SELECT SITE, RACE, LANGUAGE, GENDER FROM VISITS GROUP BY
    SITE
    Can this be used to generate a series of charts, one for each
    site? About the only thing I have come up with is a loop using
    cfoutput's group option and cfchartdata to get individual data
    points and I don't think even that would work since I'm not sure
    how I can construct a loop to accomplish this. Thought I'd see if
    there was an alternative that I overlooked before I threw myself
    into it..

    How about Query of Queries...
    -- Get Main Query: queryMain
    -- Prepare first Chart for Site A: querySiteA
    SELECT from queryMain where Site = ''siteA'
    -- Show Chart with: querySiteA
    -- Prepare first Chart for Site B: querySiteB
    SELECT from queryMain where Site = ''siteB'
    -- Show Chart with: querySiteB
    Query of Queries is great for this kind of thing, no need to
    go back to the DB, you have the data, now just further filter it
    for your needs...

  • Insert Multiple rows into the table from that table data

    Hi All,
    I have a requirement like to insert mulitple rows into the table from that table data only(I need to replicate the data).
    In this table primary key is composite primary key with all foreign keys.primary key also including the Date foreign key.I need to change that date at the of insertion.
    INSERT
    INTO myschema.Fact_page_performance
    time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available ,
    date_sk
    VALUES
    (SELECT time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available
    FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk=20090509,20090510
    But it is giving the error like missing Expression.
    Could anyone please help to me.
    Thanks and Regards
    Swetha.

    You can have either VALUES or SELECT not both
    INSERT
    INTO myschema.Fact_page_performance
    time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available ,
    date_sk
    SELECT time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available
    FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk=20090509,20090510;

  • How to move table from one tablespace to other tablespace?

    how to move table from one tablespace to other tablespace?

    887274 wrote:
    how to move table from one tablespace to other tablespace?
    alter table <table_name> move  tablespace <new_tablespace_name>;
    Rebuild the indexes; alter index <index_name> rebuild <new_tablespace_name> online;Example;:
    SQL> create table ttt( ID NUMBER PRimary key);
    Table created.
    SQL> insert into ttt values (1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select index_name, status  from dba_indexes where table_name='TTT';
    INDEX_NAME                 STATUS
    SYS_C0010863                 VALID
    SQL> alter table ttt move tablespace users;
    Table altered.
    SQL> select index_name, status  from dba_indexes where table_name='TTT';
    INDEX_NAME                 STATUS
    SYS_C0010863                 UNUSABLE
    SQL> alter index SYS_C0010863 rebuild tablespace users online;
    Index altered.
    SQL> select index_name, status  from dba_indexes where table_name='TTT';
    INDEX_NAME                 STATUS
    SYS_C0010863                 VALID
    SQL>

  • How can we copy table from one schema to other schema

    Hi,
    I have create one table in one schema and i want to copy it to other schema.How we can copy table from one schema to other schema

    Hi,
    You can try something like this :-
    SQL> CONNECT SYS/SYS123@SERVER AS SYSDBA
    Connected.
    SQL> CREATE USER TEST_1 IDENTIFIED BY TEST_1;
    User created.
    SQL> CREATE USER TEST_2 IDENTIFIED BY TEST_2;
    User created.
    SQL> GRANT CONNECT,RESOURCE,DBA TO TEST_1;
    Grant succeeded.
    SQL> GRANT CONNECT,RESOURCE,DBA TO TEST_2;
    Grant succeeded.
    SQL> CONNECT TEST_1/TEST_1@SERVER
    Connected.
    SQL> CREATE TABLE TEST_COPY ( TEST_COL NUMBER );
    Table created.
    SQL> INSERT INTO TEST_COPY VALUES ( 1 );
    1 row created.
    SQL> INSERT INTO TEST_COPY VALUES ( 2 );
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> GRANT ALL ON TEST_COPY TO TEST_2;
    Grant succeeded.
    SQL>  CONNECT TEST_2/TEST_2@SERVER
    Connected.
    SQL> CREATE TABLE TEST_COPY AS SELECT * FROM TEST_1.TEST_COPY;
    Table created.
    SQL>  SELECT * FROM TEST_COPY;
      TEST_COL
             1
             2Regards,
    Sandeep

  • ACCESSING MULTIPLE TABLES THRU ONE SELECT STATEMENTS

    How to access multiple tables through one single select statement and also using where condition in it for multiple fields which are from different tables. please give me any example from any tables ....thanks in advance

    See the below example code :
    REPORT ZMM_COST no standard page heading
                            line-size 255
                            message-id zwave  .
    type-pools
    type-pools : slis.
    Tables
    tables : mara,
             makt,
             mbew,
             konp,
             pgmi,
             marc,
             RMCP3,
             sscrfields,
             mvke.
    Internal Table for MARC and MARA
    data : begin of i_join occurs 0,
           matnr like mara-matnr, " Material #
           meins like mara-meins, " Unit of Measure
           werks like marc-werks, " Plant
           zzdept like marc-zzdept," Department
           end of i_join.
    Internal table for PGMI
    data : begin of i_pgmi occurs 0,
           werks like pgmi-werks, " Plant,
           nrmit like pgmi-nrmit, " Material #
           wemit like pgmi-wemit, " Plant
           end of i_pgmi.
    Internal Table for MBEW
    data i_mbew like mbew occurs 0 with header line.
    Internal Table for Output
    data : begin of i_output occurs 0 ,
           matnr like mara-matnr, " Material #
           maktx like makt-maktx, " Material Desc
           VPRSV like mbew-VPRSV, " Price Control Indicator
           VERPR like mbew-VERPR, " Moving Avg Price
           meins like mara-meins, " Base Unit of Measure
           STPRS like mbew-STPRS, " Standard Price
           LPLPR like mbew-LPLPR, " Current Planned Price
           ZPLPR like mbew-ZPLPR, " Future Planned Price
           VPLPR like mbew-VPLPR, " Previous Planned Price
           kbetr like konp-kbetr, " Sales Price
           KMEIN like konp-KMEIN, " Sales Unit
           margin(5) type p decimals 2,
           vmsta like mvke-vmsta, " Material Status.
           end of i_output.
    Internal Table for A004
    data : i_a004 like a004 occurs 0 with header line.
    Variables
    data : wa_lines type i,
           wa_maktx type makt-maktx,
           v_flag type c.
      ALV Function Module Variables
    DATA: g_repid like sy-repid,
          gs_layout type slis_layout_alv,
          g_exit_caused_by_caller,
          gs_exit_caused_by_user type slis_exit_by_user.
    DATA: gt_fieldcat    type slis_t_fieldcat_alv,
          gs_print       type slis_print_alv,
          gt_events      type slis_t_event,
          gt_list_top_of_page type slis_t_listheader,
          g_status_set   type slis_formname value 'PF_STATUS_SET',
          g_user_command type slis_formname value 'USER_COMMAND',
          g_top_of_page  type slis_formname value 'TOP_OF_PAGE',
          g_top_of_list  type slis_formname value 'TOP_OF_LIST',
          g_end_of_list  type slis_formname value 'END_OF_LIST',
          g_variant LIKE disvariant,
          g_save(1) TYPE c,
          g_tabname_header TYPE slis_tabname,
          g_tabname_item   TYPE slis_tabname,
          g_exit(1) TYPE c,
          gx_variant LIKE disvariant.
    data : gr_layout_bck type slis_layout_alv.
    Selection-screen
    selection-screen : begin of block blk with frame title text-001.
    parameters : p_werks like marc-werks default '1000' obligatory.
    select-options : s_dept for marc-zzdept obligatory,
                     s_matnr for mara-matnr,
                     s_mtart for mara-mtart,
                     s_vprsv for mbew-VPRSV,
                     s_PRGRP for RMCP3-PRGRP MATCHCODE OBJECT MAT2 ,
                     s_vmsta for mvke-vmsta.
    selection-screen: end of block blk.
    *SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    *PARAMETERS: p_vari LIKE disvariant-variant.
    *SELECTION-SCREEN END OF BLOCK b3.
    At slection screen events                                            *
    *-- Process on value request
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    Initialization                                                       *
    Initialization.
      g_repid = sy-repid.
    sscrfields-functxt_01 = 'Clear Selection'.
    selection-screen function key 1.
    AT SELECTION-SCREEN.
    case sscrfields-ucomm.
    when 'Clear Selection' or 'FC01'.
    clear: s_matnr,
           p_werks.
    refresh: s_matnr,
             s_dept,
             s_mtart,
             s_vprsv,
             s_PRGRP,
             s_vmsta.
    endcase.
    Start-of-selection.
    start-of-selection.
    Clear the all data.
      perform clear_data.
    Get the data from PGMI Table
      perform get_pgmi.
    Get the data from MARC and MARA Table
      perform get_mara_marc.
    Get the data from MBEW Table
      perform get_mbew.
    Move the data into OUTPUT Table
      perform move_output_internal.
    *end-of-selection.
    end-of-selection.
      if not i_output[] is initial.
    ALV Function Module
        perform print_alv.
      endif.
    *&      Form  get_pgmi
          Select the data from PGMI Table
    FORM get_pgmi.
      clear v_flag.
    If Product group has a value at Selection-screen.
      if not s_prgrp is initial.
        select werks nrmit wemit from pgmi into table i_pgmi
                                 where prgrp in s_prgrp
                                 and   werks = p_werks
                                 and   wemit = p_werks.
        v_flag = 'X'.
      endif.
    ENDFORM.                    " get_pgmi
    *&      Form  get_mara_marc
          Select the data from MARA and MARC
    FORM get_mara_marc.
      if v_flag = 'X'.
        select amatnr ameins bwerks bzzdept into table i_join
               from mara as a inner join marc as b on amatnr = bmatnr
               for all entries in i_pgmi
                                         where a~matnr in s_matnr
                                         and   b~werks = p_werks
                                         and   b~zzdept in s_dept
                                         and   a~mtart in s_mtart
                                         and   a~matnr = i_pgmi-nrmit
                                         and   b~werks = i_pgmi-werks.
      else.
    Get the data from MARA and MARC Table
        select amatnr ameins bwerks bzzdept into table i_join
               from mara as a inner join marc as b on amatnr = bmatnr
                                         where a~matnr in s_matnr
                                         and   b~werks = p_werks
                                         and   b~zzdept in s_dept
                                         and   a~mtart in s_mtart.
      endif.
      clear wa_lines.
      describe  table i_join lines wa_lines.
      if wa_lines is initial.
        message i000(zwave) with 'List contains no data'.
        stop.
      endif.
      sort i_join by matnr werks zzdept.
    ENDFORM.                    " get_mara_marc
    *&      Form  get_mbew
          Select the data from MBEW Table
    FORM get_mbew.
    Get the data from MBEW.
      select * from mbew into table i_mbew
               for all entries in i_join
               where matnr = i_join-matnr.
      clear wa_lines.
      describe  table i_mbew lines wa_lines.
      if wa_lines is initial.
        message i000(zwave) with 'List contains no data'.
        stop.
      endif.
      sort i_mbew by matnr bwkey.
    ENDFORM.                    " get_mbew
    *&      Form  move_output_internal
         Final Results
    FORM move_output_internal.
      loop at i_join.
        clear wa_maktx.
      Compare the data with MVKE Table
        select single vmsta from mvke into mvke-vmsta
                                 where matnr = i_join-matnr
                                 and   vkorg = '0001'
                                 and   vtweg = '01'
                                 and   vmsta in s_vmsta.
        if sy-subrc ne 0.
          continue.
        else.
          i_output-vmsta = mvke-vmsta.
        endif.
        read table i_mbew with key matnr = i_join-matnr
                                   bwkey = i_join-werks
                                   binary search.
        if sy-subrc eq 0.
    Price Control Indicator
          i_output-VPRSV = i_mbew-VPRSV.
    Moving Average Price
          i_output-VERPR = i_mbew-VERPR / i_mbew-peinh.
    Standard Price
          i_output-STPRS = i_mbew-STPRS / i_mbew-peinh.
    Current Planned Price
          i_output-LPLPR = i_mbew-LPLPR / i_mbew-peinh.
    Future Planned Price
          i_output-ZPLPR = i_mbew-ZPLPR / i_mbew-peinh.
    Previous Planned Price
          i_output-VPLPR = i_mbew-VPLPR / i_mbew-peinh.
    Base Unit of Measure - Added by Seshu 01/09/2007
          i_output-meins = i_join-meins.
        else.
          continue.
        endif.
    Get the sales Price.
        perform get_sales_data.
        if i_mbew-VPRSV = 'V'.
    Get the Percentage of Margin
          if i_output-kbetr ne '0.00'.
            i_output-margin = ( ( i_output-kbetr - i_mbew-VERPR )
                               / i_output-kbetr ) * 100 .
          endif.
        else.
    Get the Percentage of Margin
          if i_output-kbetr ne '0.00'.
            i_output-margin = ( ( i_output-kbetr - i_output-stprs )
                               / i_output-kbetr ) * 100 .
          endif.
        endif.
    Get the material Description from MAKT Table
        select single maktx from makt into wa_maktx
                                 where matnr = i_join-matnr
                                 and   spras = 'E'.
        if sy-subrc eq 0.
          i_output-matnr = i_join-matnr.
          i_output-maktx = wa_maktx.
        endif.
        append i_output.
        clear : i_output,
                i_join,
                i_mbew.
      endloop.
    ENDFORM.                    " move_output_internal
    *&      Form  get_sales_data
          Get the Sales Price for each material
    FORM get_sales_data.
    Get the data from A004 table to get KNUMH
    Added new field Sales Unit - Seshu 01/09/2006
      refresh : i_a004.
      clear :   i_a004.
      data : lv_kbetr like konp-kbetr," Condition value
             lv_KPEIN like konp-kpein , "per
             lv_KMEIN like konp-KMEIN. " Sales Unit
      select * from a004 into table i_a004
                              where matnr = i_join-matnr
                              and   vkorg = '0001'
                              and   vtweg = '01'.
      if sy-subrc eq 0.
        sort i_a004 by DATAB descending.
    Get the Latetest Date
        read table i_a004 with key matnr = i_join-matnr
                                   vkorg = '0001'
                                   vtweg = '01'
                                   binary search.
    Get the Sales Value
        select single kbetr KPEIN KMEIN from konp
                 into (lv_kbetr,lv_KPEIN, lv_KMEIN)
                                 where knumh = i_a004-knumh
                                 and   kappl = i_a004-kappl
                                 and   kschl = i_a004-kschl.
        if sy-subrc eq 0.
          i_output-kbetr = lv_kbetr / lv_KPEIN.
          i_output-KMEIN = lv_KMEIN.
        endif.
      endif.
      clear : lv_kbetr,
              lv_kpein,
              lv_KMEIN.
    ENDFORM.                    " get_sales_data
    *&      Form  print_alv
          ALV Function Module
    FORM print_alv.
    Fill the Fiedlcat
      PERFORM fieldcat_init  using gt_fieldcat[].
      gr_layout_bck-edit_mode = 'D'.
      gr_layout_bck-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       I_INTERFACE_CHECK                 = ' '
       I_BYPASSING_BUFFER                =
       I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = g_repid
       I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = g_user_command
       I_CALLBACK_TOP_OF_PAGE            = ' '
       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
       I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  =
       I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      =
       I_GRID_SETTINGS                   =
        IS_LAYOUT                         = gr_layout_bck
          IT_FIELDCAT                       = gt_fieldcat[]
       IT_EXCLUDING                      =
       IT_SPECIAL_GROUPS                 =
       IT_SORT                           =
       IT_FILTER                         =
       IS_SEL_HIDE                       =
       I_DEFAULT                         = 'X'
        I_SAVE                            = g_save
        IS_VARIANT                        =
       IT_EVENTS                         =
       IT_EVENT_EXIT                     =
       IS_PRINT                          =
       IS_REPREP_ID                      =
       I_SCREEN_START_COLUMN             = 0
       I_SCREEN_START_LINE               = 0
       I_SCREEN_END_COLUMN               = 0
       I_SCREEN_END_LINE                 = 0
       IT_ALV_GRAPHICS                   =
       IT_ADD_FIELDCAT                   =
       IT_HYPERLINK                      =
       I_HTML_HEIGHT_TOP                 =
       I_HTML_HEIGHT_END                 =
       IT_EXCEPT_QINFO                   =
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = i_output
       EXCEPTIONS
         PROGRAM_ERROR                     = 1
         OTHERS                            = 2
      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.                    " print_alv
    *&      Form  fieldcat_init
          Fieldcat
    FORM fieldcat_init USING  e01_lt_fieldcat type slis_t_fieldcat_alv.
      DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    Material #
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'MATNR'.
      LS_FIELDCAT-ref_fieldname = 'MATNR'.
      LS_FIELDCAT-ref_tabname = 'MARA'.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Material'.
      ls_fieldcat-seltext_M = 'Material'.
      ls_fieldcat-seltext_S = 'Material'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Material Description
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'MAKTX'.
      LS_FIELDCAT-OUTPUTLEN    = 35.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Description'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Price Indicator
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'VPRSV'.
      LS_FIELDCAT-OUTPUTLEN    = 7.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Price Control Indicator'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Moving Avg Price
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'VERPR'.
      LS_FIELDCAT-OUTPUTLEN    = 11.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Moving Avg Price'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Base Unit of Measure
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'MEINS'.
      LS_FIELDCAT-OUTPUTLEN    = 7.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Base Unit'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Standard Price
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'STPRS'.
      LS_FIELDCAT-OUTPUTLEN    = 11.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Standard Price'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Current Planned Price
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'LPLPR'.
      LS_FIELDCAT-OUTPUTLEN    = 11.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Current Planned Price'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Future Planned Price
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'ZPLPR'.
      LS_FIELDCAT-OUTPUTLEN    = 11.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Future Planned Price'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Previous Planned Price
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'VPLPR'.
      LS_FIELDCAT-OUTPUTLEN    = 11.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Previous Planned Price'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Sales Price
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'KBETR'.
      LS_FIELDCAT-OUTPUTLEN    = 13.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Sales Price'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Sales Unit
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'KMEIN'.
      LS_FIELDCAT-OUTPUTLEN    = 7.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Sales Unit'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    % of Gross Margin
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'MARGIN'.
      LS_FIELDCAT-OUTPUTLEN    = 13.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = '% of Gross Margin'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Material Status
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'VMSTA'.
      LS_FIELDCAT-OUTPUTLEN    = 13.
      LS_FIELDCAT-TABNAME    = 'I_OUTPUT'.
      ls_fieldcat-seltext_L = 'Material Status'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    ENDFORM.                    " fieldcat_init
    **&      Form  f4_for_variant
          text
    *FORM f4_for_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
            EXPORTING
                 is_variant          = g_variant
                 i_save              = g_save
                 i_tabname_header    = g_tabname_header
                 i_tabname_item      = g_tabname_item
              it_default_fieldcat =
            IMPORTING
                 e_exit              = g_exit
                 es_variant          = gx_variant
            EXCEPTIONS
                 not_found = 2.
    IF sy-subrc = 2.
       MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
       IF g_exit = space.
         p_vari = gx_variant-variant.
       ENDIF.
    ENDIF.
    *ENDFORM.                    " f4_for_variant
    *&      Form  clear_data
          Clear the Internal table
    FORM clear_data.
      clear : i_output,
              i_join,
              i_mbew,
              i_a004,
              i_pgmi.
      refresh :  i_output,
                 i_join,
                 i_mbew,
                 i_a004,
                 i_pgmi.
    ENDFORM.                    " clear_data
          FORM USER_COMMAND                                             *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                rs_selfield TYPE slis_selfield.                 "#EC CALLED
      CASE R_UCOMM.
        WHEN '&IC1'.
          read table i_output index rs_selfield-tabindex.
          SET PARAMETER ID 'MAT' FIELD i_output-matnr.
          SET PARAMETER ID 'WRK' FIELD p_werks.
          if not i_output-matnr is initial.
            call transaction 'MD04' and skip first screen.
          endif.
      ENDCASE.
    ENDFORM.
    Reward Points if it is helpful
    Thanks
    Seshu

  • Getting error while creating table from one database to other.

    Hi,
    We are getting below error while creating the table from one database to other.
    SQL> create table fnd_lobs parallel compress as select * from [email protected];
    create table fnd_lobs parallel compress as select * from [email protected]
    ERROR at line 1:
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    ORA-02063: preceding line from EEXIT2TEST
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    ORA-02063: preceding line from EEXIT2TEST
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    ORA-02063: preceding line from EEXIT2TEST
    ORA-01555: snapshot too old: rollback segment number 28 with name "_SYSSMU28$"
    too small
    Regards,
    Bhatia

    hi
    what are the apps version local and remote database???
    Snapshot too old errors occur because Oracle can 't reconstruct a consistent
    image of a block for the purposes of a consistent read.
    I feel at remote database, you are using UNDO, it will be rather easy to iincrease the undo retention time or increase the undo tablespace size.. if you are dealing with roll back segments, you may have rollback segments whose optimal values are too small...
    increase roll back segments size and select again then
    the following metalink notes might be helpful
    ORA-01555 "Snapshot too old" - Detailed Explanation Doc ID: 40689.1
    How To Avoid ORA-01555: Snapshot Too Old When Running PAAPIMP Doc ID: 603259.1
    OERR: ORA 1555 "snapshot too old (rollback segment too small)" Doc ID: 18954.1

  • Cutting and pasting tables from one project to another

    When cutting and pasting existing tables from one project to
    another, the line weights for the cell borders seem to vary at
    random - some are the original line weight and some are heavier
    when pasted.
    I've tried sorting things out with the table properties
    dialogue, but to no effect.
    Is there a quick fix, or am I better importing in whole
    topics and then editing the imported topic?

    Hi Colum/Peter,
    It's not a custom table, I just need to copy an existing
    table from one project to another.
    My blasted developers (may the fleas of a thousand camels,
    etc), just decided to change the toolbars in one of our
    applications. As this toolbar appears in slightly different guises
    in about 6 tabs, I was trying to update the table that shows what
    icon does what and cut and paste that table into all the sub
    projects I have. Each table then only needs a minor edit for a few
    icons specific to that sub-project.
    Peter's on the right track. When I cut and pasted the table
    it also pasted in a number of lines of HTML associated with the
    styles in the other project. If I delete those lines, the table
    then appears as it should.
    Thanks for prompt response

Maybe you are looking for

  • Reversed Receipt Handling in CE Open Interface

    Oracle Support has stated that in 11.0.3, it is not possible to interface reversed receipts (NSF, etc.) from an external system through the reconciliation open interface. Does anyone know if there are plans to enable this functionality, as cash manag

  • Credit Memo Request already exists for item & 1 , & 2, etc

    Hi SD guru's, I am trying to create a credit memo request in reference to my sales order invoice and i am getiing this warning message "Credit Memo Request already exists for item ". How is this possible,when i am creating the credit memo request onl

  • Rsh disconnect problems in Solaris 10

    My company uses rsh to transmit data to proprietary cards, from Ultra 25's running Solaris 10. We're experiencing random timeouts. The error is rsh connection timeout. We never had this problem on Solaris 8 or Solaris 7. Has anyone run across this be

  • The rating stars are stuck on my screen.

    I have the 30 GB model. When I press the middle button to go to the "my rating" screen, if I change the rating, even if I change it back, it stays there. Then the stars go off to be replaced by themselves, but it gets louder as it would if you rub th

  • Mapping - leading zeros

    Hello all, I have the mapping program with simple UDF written to pad the number with ZEROS.  it is working good on the test mode, but at runtime it is not working, I am not getting leading zeros. When I check my Input payload, I see leading zeros in