Pl sql join and selecting columns from join."t"."c": invalid at debug time

I noticed the error at cc.Country that is shown because cc is not yet there at compile time (got that
from searching this forum).
Isnt that a bit weak of oracle sql developer that it doesnt compile from the outside to the inside /core but
rather form top to bottom?
Am I right with my conclusion? If so, how to do it otherwise i.e. specifying that cc.country is
a column from countrycodes joined with table6 ?
SELECT DISTINCT 0,
2,
SUBSTR('metable', 0, 1) || '_ABC',
'ABC_' || 'metable',
'ABC ' ||cc.Country ,
'+'
FROM table6
LEFT JOIN COUNTRYCODE cc
ON cc.Code = metable
WHERE metable IS NOT NULL
AND metable <> ''

metalray wrote:
hi Boneist
thanks for your reply
its in a plsql procedure (10g). well as you see cc is the alias
of the table COUNTRYCODE. which does exists. the error is at 'ABC ' ||cc.Country'
telling me"PL/SQL: ORA-01747: invalid user.table.column,..."
when I put COUNTRYCODE next to table6 in the FROM it works but thats not what I want
since I want to join both tables not just select from both.Can you give us your exact code and exact error message.
I'm not finding any problem with using alias names in the query..
SQL> select d.dname
  2        ,'EMPNAME : '||e.ename
  3  from dept d LEFT JOIN emp e ON e.deptno = d.deptno;
DNAME          'EMPNAME:'||E.ENAME
RESEARCH       EMPNAME : SMITH
SALES          EMPNAME : ALLEN
SALES          EMPNAME : WARD
RESEARCH       EMPNAME : JONES
SALES          EMPNAME : MARTIN
SALES          EMPNAME : BLAKE
ACCOUNTING     EMPNAME : CLARK
RESEARCH       EMPNAME : SCOTT
ACCOUNTING     EMPNAME : KING
SALES          EMPNAME : TURNER
RESEARCH       EMPNAME : ADAMS
SALES          EMPNAME : JAMES
RESEARCH       EMPNAME : FORD
ACCOUNTING     EMPNAME : MILLER
OPERATIONS     EMPNAME :
15 rows selected.
SQL>

Similar Messages

  • How to find out the failed sql command and its data from DEFERROR

    Hi,
    has anybody a procedure or some other possibilities to read the content of column USER_DATA of the advanced replication view DEFERROR in order to find out the failed sql command and its column values?
    Thanks in advance.

    Hi Vishwa,
                 The control would be something like this for navigation in Get_p_xxx method u mention as link and u mention a event name which gets triggered on the click of this hyperlink. So your GET_P_XXX method would have the following code:
    CASE iv_property.
        WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
          rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
        WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
          rv_value = 'EXAMPLE'.
    Now you have to create a method as EH_ONEXAMPLE at your IMPL class and within which you would give an outbound plug method. Within the outbound plug the target data would be filled in the collection and window outbound plug would be triggered.
    This is a huge topic and  i have just mentioned you basic things.
    Regards,
    Bharathy.

  • How to insert select columns from one internal table to another

    Hi,
    How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
    regards,
    Sriram

    Hi,
    If your question is for copying data from 1 int table to other ;
    we can use
    APPEND LINES OF it_1 TO it_2.
    or if they have different columns then:
    loop at it_1 into wa_it1.
    move wa_it1-data to wa_it2-d1.
    apped wa_it2 to it_2.
    clear wa_it2.
    endloop.
    thnxz

  • How can I select columns from a table EMP, using Select statement?.

    Hi Friends,
    How can I select columns from a table EMP?.
    I want to select columns of EMP table, using select statement.
    Please reply me urgently.
    Shahzad

    Something like this:
    scott@DBA> select empno,ename,job from emp;
         EMPNO ENAME      JOB
          7369 SMITH      CLERK
          7499 ALLEN      SALESMAN
          7521 WARD       SALESMAN
          7566 JONES      MANAGER
          7654 MARTIN     SALESMAN
          7698 BLAKE      MANAGER
          7782 CLARK      MANAGER
          7788 SCOTT      ANALYST
          7839 KING       PRESIDENT
          7844 TURNER     SALESMAN
          7876 ADAMS      CLERK
          7900 JAMES      CLERK
          7902 FORD       ANALYST
          7934 MILLER     CLERK
    14 rows selected.Check the documentation:
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#sthref9697
    Message was edited by:
    Delfino Nunez

  • Remove Enable, Disable and Delete columns from searchUser.do

    Hello,
    What jsp form do I need to modify to remove the enable, disable and delete columns from the searchUser.do page? I edited tjspSearchUserResultsTiles.jsp but that didn't seem to do it.
    Thanks

    Hi,
    TableGenerator.jsp is the general jsp so you shouldn't modify it.You need to extend tcSearchUserAction.java class aand create a custom class.You need to over ride populateColumnHeadings and populateTableData.
    I won't suggest this approach until you are very much familiar with struts development and oim classes.
    Regards
    Nitesh

  • Hi All, I have new iphone 4s and want to import my contacts from my old Orange SIM (the contacts have all been copied to SIM). I enter the SIM and select "Import from SIM" in the settings -- Calendar, Contacts etc it look like Ok but nothing copied,helpp

    Hi All, I have new iphone 4s and want to import my contacts from my old Orange SIM (the contacts have all been copied to SIM). I enter the SIM and select "Import from SIM" in the settings --> Calendar, Contacts etc it looks like Ok but nothing copied,I tried hundreds of time and waited 2 day but still nothing and I again made sure that I do have the Contacts in the Microsim and it is there but cant import? dunno why???

    I have never used it, but have heard good things...
    http://www.littlemachines.com/

  • SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID'; = 39 rows .

    We just applied "SAP Bundle Patch 10.2.0.4.5 - 201010" in our development system.
    We completed all the post installation activities.
    In tail end - when we execute subjected command, 39 rows returned.
    Very First --- May we understand  What is the negative impact on Oracle system?
    Secondly -- Do we need to make these rows to "ZERO" is must ?
    Finally -  How to make them to "ZERO"
    2 lines expert advise...will enable us to move forward.
    Rgds
    ==========
    COMMAND
    ==========
    SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID';
    OBJECT_NAME
    LOGMNR_KRVRDLUID3
    DBMS_SQLTCB_INTERNAL
    DBMS_LOGMNR_FFVTOLOGMNRT
    DBMS_LOGMNR_OCTOLOGMNRT
    DBMS_RULE_EXP_UTL
    DBMS_LOGSTDBY
    DBMS_AW_EXP
    DBMS_SNAP_INTERNAL
    DBMSOBJG_DP
    DBMS_REPCAT_EXP
    DBMS_STREAMS_TBS_INT_INVOK
    DBMS_FILE_GROUP_UTL
    DBMS_FILE_GROUP_UTL_INVOK
    DBMS_STREAMS_MT
    DBMS_LOGREP_EXP
    DBMS_LOGREP_IMP
    DBMS_STREAMS_RPC
    DBMS_STREAMS_DATAPUMP
    DBMS_STREAMS_DATAPUMP_UTIL
    DBMS_STREAMS_TBS_INT
    DBMS_STREAMS_TBS_INT_INVOK
    DBMS_STREAMS_TABLESPACE_ADM
    DBMS_FILE_GROUP_UTL
    DBMS_FILE_GROUP_UTL_INVOK
    DBMS_FILE_GROUP
    DBMS_FILE_GROUP_INTERNAL_INVOK
    DBMS_FILE_GROUP_EXP
    DBMS_FILE_GROUP_IMP_INTERNAL
    DBMS_REDEFINITION
    DBMS_CDC_DPUTIL
    LOGMNR_KRVRDREPDICT3
    DBMS_CDC_DPUTIL
    DBMS_CDC_EXPDP
    DBMS_CDC_EXPVDP
    DBMS_CDC_IMPDP
    DBMS_SCHEMA_COPY
    UTL_RECOMP
    DBMS_SQLTUNE_INTERNAL
    DBMS_CDC_DPUTIL
    39 rows selected.
    SQL>
    ==========

    Hi,
    there has been an issue with an earlier set of bugfixes or an older CPU patch.
    It did invalidate the catproc component.
    Check:   select comp_id,status, version from dba_registry;
    if CATPROC is invalid, shutdown and startup your DB.
    run
    @?/rdbms/admin/catproc.sql
    it can run between 10 and 25 minutes depending on horse powers.
    Check again:   select comp_id,status, version from dba_registry;
    CATPROC should now be valid.
    If yes run utlrp.sql again and your errors will be gone.
    If not, your issue is something else.
    Volker

  • Inner join and select for all entries with respect to performance

    Hi Friends,
    I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient? and how? can you explain me in detail ?
    Regards,
    Dinesh

    INNER JOIN->
    The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join. With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view. With an outer join, records are also selected for which there is no entry in some of the tables used in the view.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ec77446011d189700000e8322d00/content.htm
    FOR ALL ENTRIES->
    Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
    Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.
    If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.
    If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
    Not Recommended
    Loop at int_cntry.
    Select single * from zfligh into int_fligh
    where cntry = int_cntry-cntry.
    Append int_fligh.
    Endloop.
    Recommended
    Select * from zfligh appending table int_fligh
    For all entries in int_cntry
    Where cntry = int_cntry-cntry.

  • Inner join and select for all entries with respect to performance in SAP

    Hi Friends,
    I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient?
    Regards,
    Dinesh

    I did some testing a while ago and found that a JOIN is usually a bit more efficient than FOR ALL ENTRIES. This wasn't always the case though, so the best thing to do is to write it both ways and see which is faster.
    Rob

  • Select column from user.table

    Hi,
    I have 100 users. Each one has same table let's say tableA. I want a query that return back the value of a given column in that table for all users with their names. I thought about a join between dba_users (username) and that table. Basically I generate a script by this :
    select 'SELECT CULOMN FROM '||owner||'.'||TABLE_NAME||';' from all_tables where table_name='TABLEA';
    I execute the result script as sysdba.
    But when executed it does not show the name of each user. I mean we can not see which value belongs to whom.
    How can I do that ?
    many thanks before.
    Message was edited by:
    user522961

    Or perhaps you just want some dynamic SQL like this:
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2    CURSOR u IS
      3      SELECT username
      4      FROM   all_users
      5      ORDER BY username;
      6    v_cnt1 NUMBER;
      7    v_cnt2 NUMBER;
      8    v_tbl  VARCHAR2(30) := 'EMP';
      9  BEGIN
    10    FOR users IN u
    11    LOOP
    12      SELECT count(*)
    13      INTO   v_cnt1
    14      FROM   ALL_TABLES
    15      WHERE  owner = users.username
    16      AND    table_name = v_tbl;
    17      IF v_cnt1 > 0 THEN
    18        EXECUTE IMMEDIATE 'SELECT count(*) FROM '||users.username||'.'||v_tbl INTO v_cnt2;
    19        DBMS_OUTPUT.PUT_LINE('User: '||users.username||' Count on '||v_tbl||':'||v_cnt2);
    20      END IF;
    21    END LOOP;
    22* END;
    SQL> /
    User: FRED Count on EMP:27
    User: BOB Count on EMP:34
    PL/SQL procedure successfully completed.
    SQL>

  • OBIEE not selecting columns from all LTS of a Conforming Degener@teDimen$ion

    Hello everyone
        I have a Degener@teDimen$ion Dimension A it has 4 LTS ( Fact1, Fact1A ,Fact2 and FACT2A).--> FACTS from
    Physical Layer.. FACTS in BMM are FACT_ONe and FACT_TWO.
    columns in Degener@teDimen$ion Dimension A
    col1 --> mapped to all 4 LTS(logical source). It is the key column.
    col2 --> mapped to all 4 LTS(logical source)
    col3 --> mapped to all 4 LTS(logical source)
    The content Tab of the LTS for this Dimension are mapped to Detail of
    Dimension Hierarchy name is DDimension A
    Dimension Hierarchy name is DDimension A, Levels in it are
    Total --> This has all the fact columns from FACT1 and FACT2. Basically dragged dropped from facts to
    this level.
    & Detail ---> It has col1,col2 and col3 and Degener@teDimen$ion Dimension A.
    FACT_ONE --> Fact1, Fact1A are LTS for this fact 
    FACT_TWO --> Fact2 and FACT2A are LTS for this fact.
    When i am doing a analysis with
    Year, Degener@teDimen$ion_Dimension A_COL2 , FACT_ONE.measure1, FACT_TWO.measure1
    It is basically showing the dimension value of FACT_TWO.measure1 only...
    even the select statement is not having column from FACT_ONE...
    Like
    select x,y, col2 from fact_two full outer join select x,y from fact_one...> I just provided this
    syntax just for an idea.. the this fact_one is not having that column in the select..
    I referred this link
    "http://www.rittmanmead.com/2010/01/oracle-bi-ee-10-1-3-4-1-modeling-degenerate-dimensions-fact-attributes/"
    and others but i am not able to find the reason why it is not issuing a select...
    Just to add more in the Total level of the hierarchy, if i added FACT_TWO only removed FACT_ONE measures..
    it is showing only fact_one value (this time the FACT_ONE SELECT is having col2 but not FACT_TWO)...
    the behaviuor is vice versa as well...

    I resolved this. The Issue is, when using Degener@teDimen$ion ( this is !nner joned to FACT tables in BMM) and if any of the dimensions {other than the Degener@teDimen$ion (Let us say Dim X) } have an ()uter join to any of the fact tables, and you were doing your analysis using Degener@teDimen$ion,  Dim X, Measure value you will face the following issues.
    when filtering the analysis on the ()uter join dimension ( Dim X), the IN filter will not work. Reason is that the filter is getting applied to both the Dimension and FACT tables and the values that exist in Dimension Dim X but not in FACT table wont show up.
         The above issue can be fixed by changing the join between the fact and Degener@teDimen$ion from inner to outer. I think this is a bug.. because  it is supposed to filter the fact  table after the entire outer joined result is obtained but not filter the fact table for the Dim X values and do a outer join. I think the BI should be intelligent enough.
         In order to solve the filtering issue what i did was mentioned in my Initial post. I think if we have the measures at the Totals level of dimension, it is picking the Degener@teDimen$ion,from the table that has less number of rows or the query from one of the two facts that gets submitted to database.. I couldn't find the relevant information in the oracle document though . . . .

  • OBIEE Group By on 2 facts and concatenated columns from different dimensions

    Hi
    I have a different kind of problem involving 2 fact tables with different dimensional attributes.
    Fact 1 has Dim Attributes ( Cust,Facility )
    Measure - Gross Amount
    Fact2 has Dim attributes (Cust,Facility and Risk Group )
    Measure : Exposure Amount
    Since we have 2 facts with different dimensions,
    to exclude the 'Risk Group' dimension column from the group by for the Fact1,
    we set the 'Gross Amount' measure to total level (Risk Group Dimension ) in contents tab.
    So the values from both the fact tables appears in the same report correctly.
    But in the same report we have another requirement where the rating column from the customer dimension has to be concatenated with the ratings column in the facility dimension.
    We have to concatenate customer.rating with the facility.rating and display it in the report.
    when we just pull the individual columns from the dimensions into the report it works fine.
    But when we try to concatenate the 2 columns and show it in the report,
    the concatenated column does not appear in the select or the group by in the SQL Fact2.( Generated by OBIEE )
    The other fact1 has the concatenated column in the select as well as the group by clause ( Generated by OBIEE )
    As a result the report shows the concatenated values only for the results from the Fact1. But the results from Fact2 does not have the concatenated column values.
    The report should look like the below:
    Custor.Name,     Customer.Id,     Facility.Name,     Facility.Id,     Customer.Rating/Facility.Rating,     Risk Group,     Gross Amount,     Exposure Amount
    ===========    =========      ===========     =========   ========================      =========     ===========     ===============
    JPMC                123                    GROSS               123               08/10                                                  LNL                    45,000               25,000
    CLAIRE               456                    NET                    456               07/10                                                  RNK                    50,000               30,000
    Thanks,
    Chandra

    As suggested you really want to move your none-aggregated fact attributes to a logical dimension (using the same physical table as the logical fact). Map this in the BMM layer as a snowflake, Place a hierarchy on this dimension with (at minimum) Total -> Detail levels, then on the other fact table you want to include in the report, set the content level on your other fact measures to the 'Total' level for your new logical Dim and it will allow them to be present in the same report.

  • Report with non aggregated and aggregated columns from different facts.

    Hi,
    We have got requirement as follows,
    1) We have two dimension tables, and two fact(Fact1 and Fact2) table in physical.
    2) In BMM we have made hierarchies for both dimensions, and are joins both logical fact table.
    3)In fact1, we are having three measures of which we have made two as aggregation sum, and one is non aggregated(It contains character).
    4)Fact2 have two measures, both are aggregation as sum.
    5)Now here the problem arises, we want to make a report with some columns from dim and non aggrgated column from fact1 and and aggregated column fact2
    How to resolve the above issue.
    Regards,
    Ankit

    As suggested you really want to move your none-aggregated fact attributes to a logical dimension (using the same physical table as the logical fact). Map this in the BMM layer as a snowflake, Place a hierarchy on this dimension with (at minimum) Total -> Detail levels, then on the other fact table you want to include in the report, set the content level on your other fact measures to the 'Total' level for your new logical Dim and it will allow them to be present in the same report.

  • Add and remove columns from JTable

    Help me please!
    A try to remove column from JTable. It's removed, but when I try to add column in table, then I get all old (removed early) columns + new column....
    I completely confused with it.....
    Here is my code for remove column:
    class DelC implements ActionListener
              public void actionPerformed (ActionEvent e )
                   int [] HowManyColDelete = table.getSelectedColumns();
                   if (HowManyColDelete.length !=0)
                        TableColumnModel tableCModel = table.getColumnModel();
                        for (int i = HowManyColDelete.length-1; i>-1; i--)
                             table.getColumnModel().removeColumn (tableCModel.getColumn (HowManyColDelete [ i ]));
                   else
                          JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
         }

    It's little ex for me, I just try understand clearly how it's work (table models i mean). Here is code. All action with tables take place through menu items.
    My brain is boiled, I've try a lot of variants of code, but did't get right result :((
    It's code represent problem, which I've describe above. If you'll try remove column and then add it again, it will be ma-a-a-any colunms...
    I understand, that my code just hide columns, not delete from table model....
    But now I have not any decision of my problem...
    Thanks a lot for any help. :)
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.table.DefaultTableModel;
    class JTableF extends JFrame
         Object [] [] data = new Object [0] [2];
         JTable table;
         DefaultTableModel model;
         String [] columnNames = {"1", "2"};
         TableColumnModel cm;
         JTableF()
              super("Table features");
              setDefaultLookAndFeelDecorated( true );
              setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              JMenuBar MBar = new JMenuBar();
              JMenu [] menus =  {new JMenu("A"), new JMenu("B")};
              JMenuItem [] menu1 =  {new JMenuItem("Add row"), new JMenuItem("Delete row", 'D'),  new JMenuItem("Add column"), new JMenuItem("Delete column")};
              menu1 [ 0 ].addActionListener(new AddL());
              menu1 [ 1 ].addActionListener(new DelL());
              menu1 [ 2 ].addActionListener(new AddC());
              menu1 [ 3 ].addActionListener(new DelC());
              for (int i=0; i<menu1.length; i++)
                   menus [ 0 ].add( menu1 [ i ]);
              for (int i=0; i<menus.length; i++)
                   MBar.add(menus );
              JPanel panel = new JPanel ();
              model = new DefaultTableModel( data, columnNames );
              table = new JTable (model);
              cm = table.getColumnModel();
              panel.add (new JScrollPane(table));
              JButton b = new JButton ("Add row button");
              b.addActionListener(new AddL());
              panel.add (b);
              setJMenuBar (MBar);
              getContentPane().add(panel);
              pack();
              setLocationRelativeTo (null);
              setVisible (true);
         class DelC implements ActionListener
              public void actionPerformed (ActionEvent e )
                   int [] HowManyColDelete = table.getSelectedColumns();
                   if (HowManyColDelete.length !=0)
                        TableColumnModel tableCModel = table.getColumnModel();
                        for (int i = HowManyColDelete.length-1; i>-1; i--)
                             int vizibleCol = table.convertColumnIndexToView(HowManyColDelete [ i ]);
                             tableCModel.removeColumn (tableCModel.getColumn (vizibleCol));
                        //cm = tableCModel;
                   else
                        JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
         class AddC implements ActionListener
              public void actionPerformed (ActionEvent e)
                   //table.setColumnModel(cm);
                   Object NewColumnName = new String();
                   NewColumnName = JOptionPane.showInputDialog ("Input new column name", "Here");
                   int i = model.getRowCount();
                   int j = model.getColumnCount();
                   Object [] newData = new Object [ i ];
                   model.addColumn ( NewColumnName, newData);
         class AddL implements ActionListener
              public void actionPerformed (ActionEvent e)
                   int i = model.getColumnCount();
                   Object [] Row = new Object [ i ];
                   model.addRow ( Row );
         class DelL implements ActionListener
              public void actionPerformed (ActionEvent e)
                   int [] HowManyRowsDelete = table.getSelectedRows();
                   if (HowManyRowsDelete.length !=0)
                        for (int k = HowManyRowsDelete.length-1; k>-1; k--)
                             model.removeRow (HowManyRowsDelete[k]);
                   else
                        JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Row is not selected!");
         public static void main (String [] args)
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        JTableF inst = new JTableF();

  • Select columns from table for display in alvgrid.

    Hi all,
    i have the following:
    i do select a tablename and pass it as a parameter. then this table is loaded into an internal table and displayed in an alv-grid.
    what i now want to do is a step  between the both:
    after the internal table with its structure is loaded, i want to display the field columns and i want them to be selectable so that in the next step the alv - grid is selected only with the selected columns ( just now it allways runs with all columns - even the not needed ).
    Any ideas for that would be appreciated. Is there some tutorial on that or some sample ?

    hi
    chk this sample code:
    *REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    Form  TOP-OF-PAGE                                                 *
    ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
               i_logo             = 'Z_LOGO'.
    endform.
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
          Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
          Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    **reward if helpful
    regards,
    madhu

Maybe you are looking for