How to disable the first row of an ALV Grid?

Hi All,
      I am working on a module pool programme. I am displaying ALV grid. I have to give some default values in the first row and disable it. I have to disable the third column and fourth row value. How can i achieve this?
Help will be appreciated.
Thanks,
Ibrahim.

here is the code i have written....but its not working...
TYPES : BEGIN OF tp_grid,
        fname(25)   TYPE c,
        reqd,
        seqno       TYPE n,
        tl_styl TYPE lvc_t_styl,
        edit,
        END OF tp_grid.
DATA : wl_styl TYPE lvc_s_styl.
DATA : wl_layout TYPE lvc_s_layo.
DATA : lt_celltab TYPE lvc_t_styl.
  READ TABLE tl_grid INTO wl_grid INDEX 1.
  wl_styl-fieldname = 'TAG NUMBER'.
  wl_styl-style = cl_gui_alv_grid=>mc_style_disabled.
  INSERT wl_styl INTO TABLE lt_celltab.
  INSERT LINES OF lt_celltab INTO  wl_grid-tl_styl index 1.
  MODIFY tl_grid INDEX 1 FROM wl_grid.
  wl_layout-stylefname = 'TL_STYL'.
  CALL METHOD l_initgrid->set_table_for_first_display
    EXPORTING
      is_layout                     = wl_layout
    CHANGING
      it_outtab                     = tl_grid
      it_fieldcatalog               = tl_init_fcat
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4.
ENDFORM.                    " display_initgrid
Help will be appreciated....
Thanks,
Ibrahim

Similar Messages

  • How to include the first row of detail in every xquery transformed xml?

    I am dealing with a XML file,where i need to publish to different BS.
    First node will be a common node node which contains vital info,second node goes to one BS and third goes to another BS.
    *<header></header>*
    *<details></details> (they are unbounded, but the first detail tag which comes in the input file is a mandatory tag in such a way that it needs to be included in every transformed message)*
    *<trailer></trailer>*
    We need to apply x query transformation on it in such a way:
    *</header></header>*
    *<1st detail></1st detail>*
    *<detail></detail> (2nd row of detail in input file)* -------------------------> Goes to BS1
    *<trailer></trailer>..*
    *<header></header>*
    *<1st detail></1st detail>*
    *<detail></detail> (3rd row of detail in input file)* ----------------------------->Goes to BS2
    *<trailer></trailer>*..
    And so on.
    Now, the problem is how to include the first row( *1st detail* ) of detail in every xquery transformed xml?

    are you looping of this input with a for each?
    /yourdata/details[1] should return always the first detail element.
    or before the for each do an assing of this first detail element to "generic_details_var"
    and use this var in every looping iteration (in an assign or as input for xquery)

  • How to skip the first row in Text file (in Sql Loader)

    Hi All,
    How to say the control file to skip the first row of the text file..
    i just going this example
    this is my text file:
    01308201222455038130820122245503813082012224550382
    1090358 474661834012245503813082012 0075 0 00000000000 000000000 00000130820120000000000000000 136.84 -833.3911082012 000000 000 009035847466183 090358 47466183 0015007514300000970001430000097700BH1150274792012081320120811201208122012-08-11-22.45.50.38369899999.0075LIQJGL17
    Control file:
    OPTIONS
    DIRECT = TRUE ,
    PARALLEL = FALSE ,
    SKIP = 1,
    ERRORS = 0
    UNRECOVERABLE
    LOAD DATA
    INFILE      <"FILE_DIR">
    BADFILE <"FILE_DIR">
    INSERT
    INTO TABLE DAILY_TRANSACTION
    WHEN (1:1)='D'
    TRAILING NULLCOLS
    Above the Eaxmple text file i need to Skip the first row which is
    01308201222455038130820122245503813082012224550382
    please can anyone suggest me is this correct?
    if not please correct me please
    since two days i been serching but i didn't get any thing
    Thank's
    Edited by: Lavanya on 24-Sep-2012 00:51

    Lavanya wrote:
    Hi Jeneesh,
    Thank you for your prompt replay
    I didn't try to load this control file
    And i need one more question
    I have Text file in my Machine which Contains very huge data so i was wrote one control file for that, and i got FTP connection also as well as.
    My question is firstly I need to PUT the Text file Into Unix Server isn't?
    so when i trying to put the text file into unix it's giving an error
    ftp>put c:/abc.txt
    Not connectedYou haven't succesfully made your FTP connection to the server.
    e.g.
    c:\>ftp
    ftp> o testserver
    Connected to testserver.mycompany.com.
    220 testserver FTP server ready.
    User (testserver.mycompany.com:(none)): myuser
    331 Password required for myuser.
    Password:
    230 User myuser logged in.
    ftp>then you can use FTP to put your data to the server. Remember, if you are transferring a text file from a windows based operating system to a unix server you need to put it in ASCII mode...
    ftp> ascii
    200 Type set to A.
    ftp>which will automatically convert the windows CR/LF pairs to the single LF character used by unix.

  • How to highlight the first row of a table

    When entering the form, how do I get the first row of the table to be highlighted when it has not been selected yet? There is already data in the table. Thanks.
    Allyson

    Any ideas on what would cause this NOT to work? I added this row right after the table is created and populated and it is still not highlighted when I enter the form. The snippet of code that does this is:
    MyTableModel modelS = (MyTableModel)dataModel.get("S");
    jTable1 = new JTable(modelS);
    jTable1.setRowSelectionInterval(0,0);MyTableModel is this:
    class MyTableModel extends DefaultTableModel {
      public MyTableModel(Object[] columnNames, int numRows) {
        super(columnNames, numRows);
      public boolean isCellEditable(int row, int column) {
        if (TableKey == 'S') {
          if (column == 6) {
            return false;
        if (TableKey == 'O') {
          if (column == 0 || column == 4 || column == 5) {
            return false;
        if (TableKey == 'P') {
          return false;
      return true;
    }Can anyone help? Thanks.
    Allyson

  • How to ignore the first row  in sender file

    I would like to ignore the first row in each file in the sender channel - how can i do it?

    Hi
    Check this,
    As he said give Document Offset = 1
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Also check this forum
    Re: Supress Column Heading - File Content Conversion in Sender Adapter
    Thanks,
    Prakash

  • How to keep the first row fixed in a JTable, with sorting, and bellow the headers ?

    I am trying to change the following code so then the fixed rows will stay on top(but below the headers!), but when I change getContentPane().add(fixedScroll, BorderLayout.SOUTH); to getContentPane().add(fixedScroll, BorderLayout.NORTH); it stays above the headers. How can I put the first rows on top, but below the headers ? Thanks.
    import java.awt.*; 
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    * @version 1.0 03/05/99
    public class FixedRowExample extends JFrame {
      Object[][] data;
      Object[] column;
      JTable fixedTable,table;
      private int FIXED_NUM = 2;
      public FixedRowExample() {
        super( "Fixed Row Example" );
        data =  new Object[][]{
            {      "a","","","","",""},
            {      "","b","","","",""},
            {      "","","c","","",""},
            {      "","","","d","",""},
            {      "","","","","e",""},
            {      "","","","","","f"},
            {"fixed1","","","","","","",""},
            {"fixed2","","","","","","",""}};
        column = new Object[]{"A","B","C","D","E","F"};
        AbstractTableModel    model = new AbstractTableModel() {
          public int getColumnCount() { return column.length; }
          public int getRowCount() { return data.length - FIXED_NUM; }
          public String getColumnName(int col) {
           return (String)column[col];
          public Object getValueAt(int row, int col) {
            return data[row][col];
          public void setValueAt(Object obj, int row, int col) {
            data[row][col] = obj;
          public boolean CellEditable(int row, int col) {
            return true;
        AbstractTableModel fixedModel = new AbstractTableModel() {     
          public int getColumnCount() { return column.length; }
          public int getRowCount() { return FIXED_NUM; }
          public Object getValueAt(int row, int col) {
            return data[row + (data.length - FIXED_NUM)][col];
        table = new JTable( model );
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        table.setAutoCreateRowSorter(true);
        fixedTable = new JTable( fixedModel );
        fixedTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        fixedTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        JScrollPane scroll      = new JScrollPane( table );
        scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        JScrollPane fixedScroll = new JScrollPane( fixedTable ) {
          public void setColumnHeaderView(Component view) {} // work around
                                                 // fixedScroll.setColumnHeader(null);
        fixedScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        JScrollBar bar = fixedScroll.getVerticalScrollBar();
        JScrollBar dummyBar = new JScrollBar() {
          public void paint(Graphics g) {}
        dummyBar.setPreferredSize(bar.getPreferredSize());
        fixedScroll.setVerticalScrollBar(dummyBar);
        final JScrollBar bar1 = scroll.getHorizontalScrollBar();
        JScrollBar bar2 = fixedScroll.getHorizontalScrollBar();
        bar2.addAdjustmentListener(new AdjustmentListener() {
          public void adjustmentValueChanged(AdjustmentEvent e) {
            bar1.setValue(e.getValue());
        scroll.setPreferredSize(new Dimension(400, 100));
        fixedScroll.setPreferredSize(new Dimension(400, 52));  // Hmm...
        getContentPane().add(     scroll, BorderLayout.CENTER);
        getContentPane().add(fixedScroll, BorderLayout.SOUTH);   
      public static void main(String[] args) {
        FixedRowExample frame = new FixedRowExample();
        frame.addWindowListener( new WindowAdapter() {
          public void windowClosing( WindowEvent e ) {
            System.exit(0);
        frame.pack();
        frame.setVisible(true);

    Sorry, this code missed a very important line:
    table.setAutoCreateRowSorter(true);
    So you meant:
    Object[][] header;//class atribute
    header=new Object[][]{//in the constructor
                { "h","i","j","k","l","m"},
                { "h","i","j","k","l","m"}
    public Object getValueAt(int row, int col) {//in the TableModel
            if (row==0){
                return header[row][col];
            else {
                return data[row][col];
    I tried, but when I sort, the first row get sorted with the rest.

  • How to set the first row as selected in single selection of table

    when the page renders how do we make the first row as selected for single selection in a table.
    Thansk a lot for your help

    set the selection Attribute's value to 'Y' for the first row. Thats enough.
    eg;
    Row row=vo.first();
    row.setAttribute("SelectionAttribute", "Y");
    --Prasanna                                                                                                                                                                                                                                                                                                                                           

  • How to use the first row function value for the rest of records

    Hi all,
    I am having a select statement like this. We are calling function enabled for each row. So it is taking
    time. As per our bussiness logic, we can use what the function 'enabled' will give for the first row to
    other rows also. so that we can avoid calling the function 'enabled' next row onwars.
    Before
    SELECT
    decode(enabled(col1, col2, col3),'TRUE','xxx', col4),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col5),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col6),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col7),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col8),
    from
    table1 t1, table2 t2 where t1.col1 = t2.col1
    After
    SELECT
    decode(enabled(col1, col2, col3),'TRUE','xxx', col4),
    decode('true/false','TRUE','xxx', col5), --Here 'true/false' is the first row value after calling the function 'enabled'
    decode('true/false','TRUE','xxx', col6),
    decode('true/false','TRUE','xxx', col7),
    decode('true/false','TRUE','xxx', col8),
    from
    table1 t1, table2 t2 where t1.col1 = t2.col1
    Any thoughts on this, how to implement this logic
    Thanks,
    Pal

    It's not clear where col1, col2, col3... etc. come from, so I've assumed they're in table1.
    with table1_X as (select enabled(col1, col2, col3) as enbl
                            ,col1, col2, col3, col4, col5, col6, col7, col8
                      from   table1)
    SELECT decode(t1.enbl,'TRUE','xxx', col4)
          ,decode(t1.enbl,'TRUE','xxx', col5)
          ,decode(t1.enbl,'TRUE','xxx', col6),
          ,decode(t1.enbl,'TRUE','xxx', col7),
          ,decode(t1.enbl,'TRUE','xxx', col8),
    from   table1_x t1 join table2 t2 on (t1.col1 = t2.col1)p.s. you'd be better leaving out the enabled function altogether and incorporating the logic of the function directly in the SQL, and then you would be avoiding any context switching which will clearly impact performance on any large amount of data.
    Edited by: BluShadow on 14-May-2013 08:26

  • How to add the REFRESH button in OOPs ALV grid

    how to add the REFRESH button in OOPs ALV grid

    Hi Naidu.
    Check the below code:
    Local Class Definition and implementation For events handeling
    CLASS LCL_EVENT DEFINITION .
      PUBLIC SECTION.
        METHODS :TOOLBAR FOR EVENT TOOLBAR OF  CL_GUI_ALV_GRID
                         IMPORTING E_OBJECT,
                 USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                         IMPORTING E_UCOMM.
    ENDCLASS.    
    CLASS LCL_EVENT IMPLEMENTATION.
      METHOD TOOLBAR.
        WA_TOOL-FUNCTION = 'ZFC1'.
        WA_TOOL-TEXT     = 'TEST'.
        WA_TOOL-ICON     = '@EA@'.
        APPEND WA_TOOL TO E_OBJECT->MT_TOOLBAR.
      ENDMETHOD.             "DISPLAY
      METHOD USER_COMMAND.
        IF E_UCOMM = 'ZFC1'.
              ENDIF.
      ENDMETHOD.                    "USER_COMMAND
    ENDCLASS.                    "LCL_EVENT IMPLEMENTATION
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'ZALV_BTON'.
      SELECT * FROM VBAK INTO TABLE GT_VBAK
               UP TO 30 ROWS.
    **** CREATE CONTAINER OBJECT
      CREATE OBJECT MY_CONTAINER
        EXPORTING
          CONTAINER_NAME              = 'CC1'
         EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6 .
    ****** GRID TO CONTAINER
      CREATE OBJECT ALV
          EXPORTING
          I_PARENT          = MY_CONTAINER
         EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CREATE OBJECT OBJ.
      SET HANDLER : OBJ->TOOLBAR FOR ALV.
      SET HANDLER : OBJ->USER_COMMAND FOR ALV.
    ****** ALV DISPLAY
      CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'VBAK'
        CHANGING
          IT_OUTTAB                     = GT_VBAK[]
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
    *       text
    MODULE USER_COMMAND_0200 INPUT.
      IF SY-UCOMM EQ 'BACK'.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    Regards
    Kumar M

  • How to select the first row for each pair of values ?

    Hi guys, am hoping someone can help me here.
    If I have 4 tables - Building, Dept, Emp, Text
    B D E T
    A 1 Z blah1
    A 1 X blah2
    A 1 W blah3
    A 2 V blah4
    A 2 G blah5
    A 2 H blah6
    B 1 K blah7
    B 1 L blah8
    B 2 E blah9
    B 2 F blah0
    I need a query that will bring back the first bit of text for each pair of building and dept records.
    So the results I would get would be
    A 1 blah1
    A 2 blah4
    B 1 blah7
    B 2 blah9
    blah2 wouldnt be returned, because we have already had a record from the Building A, dept 1 pairing.
    Likewise we wouldnt get blah5 because we have already had a record from the Building A, dept 2 pairing.
    Can this be done in 1 query??
    Thanks all.
    Message was edited by:
    Scott Hillier

    here you go
    SQL> drop table t;
    Table dropped.
    SQL> create table t(B char(1), D integer, E char(1), T varchar2(5));
    Table created.
    SQL> insert into t values('A', 1, 'Z', 'blah1');
    1 row created.
    SQL> insert into t values('A', 1, 'X', 'blah2');
    1 row created.
    SQL> insert into t values('A', 1, 'W', 'blah3');
    1 row created.
    SQL> insert into t values('A', 2, 'V', 'blah4');
    1 row created.
    SQL> insert into t values('A', 2, 'G', 'blah5');
    1 row created.
    SQL> insert into t values('A', 2, 'H', 'blah6');
    1 row created.
    SQL> insert into t values('B', 1, 'K', 'blah7');
    1 row created.
    SQL> insert into t values('B', 1, 'L', 'blah8');
    1 row created.
    SQL> insert into t values('B', 2, 'E', 'blah9');
    1 row created.
    SQL> insert into t values('B', 2, 'F', 'blah0');
    1 row created.
    SQL> select b,d,t
      2    from (
      3  select row_number() over(partition by b, d order by b,d) rno,b,d,t
      4    from t)
      5   where rno = 1;
    B          D T
    A          1 blah1
    A          2 blah4
    B          1 blah7
    B          2 blah9karthick
    http://karthickarp.blogspot.com/

  • How to ignore the first row in a csv import

    Hello
    This is the file we want to  add to the datamodel:
    https://www.mediafire.com/?a9xrwrwu79whu18
    (BTW this is the csv output from a neat & free software called Jstock)
    Here is an image of the problem:
    As you can see they add automatically a timestamp in the A1 cell ruining the possibility of a clean import.
    Can anyone help with a query to fix this and get the real headers?

    Hi NicoPer,
    To follow your M code. You have  this lines  #"First Row as Header" = Table.PromoteHeaders(Source).
    This mean you use first line ( the line include "timestamp=1415926728041" ) to make
    table header. So you no need to use Table.Skip function. You just use one more Table.PromoteHeaders to make second line to your table header. Below is your code:
    let
        Source = Csv.Document(File.Contents("C:\PATH\JSTOCK.csv"),null,null,null,1252),
        #"First Row as Header" = Table.PromoteHeaders(Source),
        #"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"timestamp=1415926728041", type text}}),
        FirstRowAsHeader = Table.PromoteHeaders(#"Changed Type")
    in
        FirstRowAsHeader
    Regards,

  • How to make the first row  selected before the display of ALV grid

    Hello Experts,
    I created a ALV grid using custom container in a screen . Now i want do the follwing:
    1. i want that, the  <b>first line must be selected before the display of ALV.</b>
    2. I have selection buttons . But i dont want the multiselect button and the  
        standard  toolbar in the ALV grid.
    Could any one please help me regarding the above?
    Thanks & Regards
    Sudhansu

    can u pls explain in more details with an example?
    I am telling u the scenario.
    1. i have a screen(Modal dialog Box)  containing ALV grid with selection buttons for each row  (top part) and a subscreen(second part).
          Now when i click on a selection button, it will display the corresponding values in the subscreen.
        When this screen will display for the first time , then first row of the ALV grid should be selected and the corresponding values should be displayed in  the subscreen.
    i   wrote the following code in the PAI. But when i select a record its not triggering the PAI.
    DATA:
         gi_index_rows TYPE lvc_t_row, " Internal table for indexes of selected rows
         g_selected_row LIKE lvc_s_row, " Information about 1 row
         l_lines TYPE i.
      CLEAR g_wa_vdmeko.
    *get selected row
      CALL METHOD g_alv_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      LOOP AT gi_index_rows INTO g_selected_row.
        READ TABLE g_int_vdmeko INDEX g_selected_row-index INTO g_wa_vdmeko.
        SELECT SINGLE  *
               FROM vdmepov
               WHERE bukrs = g_wa_vdmeko-bukrs AND
                     styp  = g_wa_vdmeko-styp  AND
                     sbez  = g_wa_vdmeko-sbez  AND
                     svym  = g_wa_vdmeko-svym  AND
                     svnr  = g_wa_vdmeko-svnr.
      ENDLOOP.
    I am displayinng the ALV using method "set_alv_for_first_display".
    Please help if u have any idea..................
    Thanks
    Sudhansu

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • To change the subtotals row color in ALV(Grid / List ) .

    I am trying to change the color of a row which gives the subtotal...in ALV report...
    but it is not working....
    I have used the following code but not getting where i m wrong
    I have u sed the following code wih the help of our forum only...
    <CODE>
    TYPE-POOLS: SLIS.
    *& Internal Table Delcaration
    DATA : BEGIN OF IT_SCALE OCCURS 0,
             DATUM LIKE ZSCALE-DATUM,
             MCOD1 LIKE ZSCALE-MCOD1,
             MATNR LIKE ZSCALE-MATNR,
             MAKTG LIKE ZSCALE-MAKTG,
             MEINS LIKE ZSCALE-MEINS,
             RATE LIKE ZSCALE-RATE,
             TOTAL LIKE ZSCALE-TOTAL,
             LI_COLOR(4),
           END OF IT_SCALE.
    DATA : INDEX LIKE SY-TABIX.
    *& ALV Data Declaration
    DATA: IT_FIELDCAT  TYPE SLIS_T_FIELDCAT_ALV.
    DATA: WA_FIELDCAT  LIKE LINE OF IT_FIELDCAT.
    DATA : T_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    DATA : IT_EVENTS   TYPE SLIS_T_EVENT WITH HEADER LINE.
    DATA : G_SAVE(1)   TYPE C VALUE 'A',
           GX_SAVE(1)  TYPE C VALUE 'A',
           GX_VARIANT  LIKE DISVARIANT,
           G_VARIANT   LIKE DISVARIANT,
           GS_LAYOUT   TYPE SLIS_LAYOUT_ALV,
           T_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
           T_I_EVENT      TYPE SLIS_ALV_EVENT.
    DATA : L_LIST(105)    TYPE C,         "Store the Top-of-page headings
           L_DATEFROM(10) TYPE C,         "Store date in top-of-page
           L_DATETO(10)   TYPE C.         "Store date in top-of-page
    <code>
    START-OF-SELECTION.
      PERFORM GET_DATA.
      PERFORM ALV_FIELDCAT.
      PERFORM GET_EVENTS.
      PERFORM SUB_COMMENT_BUILD USING T_LIST_TOP_OF_PAGE.
      PERFORM ALV_DISPLAY.
    FORM GET_DATA .
    DATA : LINE_COLOR.
      SELECT DATUM MCOD1 MATNR MAKTG MEINS RATE TOTAL
             FROM ZSCALE INTO CORRESPONDING FIELDS OF TABLE IT_SCALE
             WHERE DATUM IN S_DATE
               AND LIFNR IN S_LIFNR
               AND MATNR IN S_MATNR.
    loop at IT_SCALE.
      LINE_color = LINE_color + 2.
      if LINE_color < 7.
        LINE_color = 1.
      endif.
      concatenate 'C' lINE_color '00' into IT_SCALE-li_color.
      modify it_SCALE TRANSPORTING LI_COLOR.
    endloop.
    FORM ALV_FIELDCAT.
      DATA: COUNTER      TYPE I.
      COUNTER = COUNTER + 1.
      WA_FIELDCAT-COL_POS    = COUNTER.
      WA_FIELDCAT-FIELDNAME  = 'DATUM'.
      WA_FIELDCAT-TABNAME    = 'IT_SCALE'.
      WA_FIELDCAT-SELTEXT_L  = 'Date'.
      WA_FIELDCAT-JUST       = 'C'.
      WA_FIELDCAT-NO_ZERO    = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    .endform.
    FORM ALV_DISPLAY .
    GS_LAYOUT-ZEBRA        = 'X'.
      GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      GS_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
    gS_layout-no_input          = 'X'.
      gS_layout-totals_text       = 'Totals'(201).
      gS_layout-subtotals_text = 'Subtotal'.
      IF IT_SCALE[] IS INITIAL.
        MESSAGE I001(38) WITH 'No Data to Display'.
      ELSE.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = SY-REPID
       IS_LAYOUT                      = GS_LAYOUT
      IT_FIELDCAT                    = IT_FIELDCAT
       I_SAVE                         = G_SAVE
       IS_VARIANT                     = GX_VARIANT
      TABLES
        T_OUTTAB                       = IT_SCALE[].
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    ThanX in Adavance....

    Hi Prasad,
    I provided some code snippets for you. Please go through.
    Hope this proves to be helpful to you.
    The steps for coloring a line i the grid is much the same as making a traffic light.
    To color a line the structure of the  table must include a  Char 4 field  for color properties
    TYPES: BEGIN OF st_sflight.
            INCLUDE STRUCTURE zsflight.
          Field for line color
    types:  line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    Loop trough the table to set the color properties of each line. The color properties field is
    Char 4 and the characters is set as follows:
    Char 1 = C = This is a color property
    Char 2 = 6 = Color code (1 - 7)
    Char 3 = Intensified on/of = 1 = on
    Char 4 = Inverse display = 0 = of
         LOOP AT gi_sflight INTO g_wa_sflight.
          IF g_wa_sflight-paymentsum < 100000.
            g_wa_sflight-line_color    = 'C610'.
          ENDIF.
          MODIFY gi_sflight FROM g_wa_sflight.
        ENDLOOP.
    Name of the color field
    gs_layout-info_fname = 'LINE_COLOR'.
    Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
          EXPORTING i_structure_name = 'SFLIGHT'
                                 is_layout                = gs_layout
          CHANGING  it_outtab                 = gi_sflight.
    Heres another Example for you:
        & Report  Z_ALV_COLOURS                                              &
        & This report shows how to use colours in REUSE_ALV_GRID_DISPLAY     &
        & C = Colour        (all codes must start with 'C')                  &
        & X = Colour number (1-9)                                            &
        & Y = Intensified   (0 = off, 1 = on)                                &
        & Z = Inverse       (0 = off, 1 = on)                                &
        report  z_alv_colours.
        data count_1(1) type c.
    ALV definitions
        type-pools: slis.
        data i_fieldcat type slis_t_fieldcat_alv with header line.
        data i_layout   type slis_layout_alv.
        types: begin of t_alv,
              f1(4) type c,
              f2(15) type c,
              f3(4) type c,
              f4(4) type c,
              f5(4) type c,
              f6(4) type c,
              colour(4)   type c,
              coltab type slis_t_specialcol_alv,
        end of t_alv.
        data: i_alv type standard table of t_alv with header line.
        data l_alvcolor type slis_specialcol_alv.
        & create table entries for LINE colours                              &
        do 9 times.
          count_1 = sy-index.
          clear i_alv.
          concatenate 'C' count_1 '0' '0' into i_alv-f1.
          concatenate 'C' count_1 '0' '0' into i_alv-colour.
          i_alv-f2 = 'Line colour'.
          i_alv-f3 = 'X'.
          append i_alv.
    Intensified
          clear i_alv.
          concatenate 'C' count_1 '1' '0' into i_alv-f1.
          concatenate 'C' count_1 '1' '0' into i_alv-colour.
          i_alv-f2 = 'Line colour'.
          i_alv-f4 = 'X'.
          append i_alv.
    Inverse
          clear i_alv.
          concatenate 'C' count_1 '0' '1' into i_alv-f1.
          concatenate 'C' count_1 '0' '1' into i_alv-colour.
          i_alv-f2 = 'Line colour'.
          i_alv-f5 = 'X'.
          append i_alv.
    Intensified & Inverse
          clear i_alv.
          concatenate 'C' count_1 '1' '1' into i_alv-f1.
          concatenate 'C' count_1 '1' '1' into i_alv-colour.
          i_alv-f2 = 'Line colour'.
          i_alv-f6 = 'X'.
          append i_alv.
        enddo.
    create table entries for CELL colours
        do 9 times.
          count_1 = sy-index.
          concatenate 'C' count_1 '0' '0' into i_alv-f1.
          i_alv-f2 = 'Cell colour'.
          concatenate 'C' count_1 '0' '0' into i_alv-f3.
          concatenate 'C' count_1 '1' '0' into i_alv-f4.
          concatenate 'C' count_1 '0' '1' into i_alv-f5.
          concatenate 'C' count_1 '1' '1' into i_alv-f6.
          append i_alv.
        enddo.
        & Create table entries for CELL colours                              &
        loop at i_alv where f2 = 'Cell colour'.
    Colour cells
          clear l_alvcolor.
          l_alvcolor-fieldname = 'F3'.
          l_alvcolor-color-col = i_alv-f3+1(1).
          l_alvcolor-color-int = i_alv-f3+2(1).
          l_alvcolor-color-inv = i_alv-f3+3(1).
          l_alvcolor-nokeycol = 'X'.
          append l_alvcolor to i_alv-coltab.
          clear l_alvcolor.
          l_alvcolor-fieldname = 'F4'.
          l_alvcolor-color-col = i_alv-f4+1(1).
          l_alvcolor-color-int = i_alv-f4+2(1).
          l_alvcolor-color-inv = i_alv-f4+3(1).
          l_alvcolor-nokeycol = 'X'.
          append l_alvcolor to i_alv-coltab.
          clear l_alvcolor.
          l_alvcolor-fieldname = 'F5'.
          l_alvcolor-color-col = i_alv-f5+1(1).
          l_alvcolor-color-int = i_alv-f5+2(1).
          l_alvcolor-color-inv = i_alv-f5+3(1).
          l_alvcolor-nokeycol = 'X'.
          append l_alvcolor to i_alv-coltab.
          clear l_alvcolor.
          l_alvcolor-fieldname = 'F6'.
          l_alvcolor-color-col = i_alv-f6+1(1).
          l_alvcolor-color-int = i_alv-f6+2(1).
          l_alvcolor-color-inv = i_alv-f6+3(1).
          l_alvcolor-nokeycol = 'X'.
          append l_alvcolor to i_alv-coltab.
          modify i_alv.
        endloop.
        & Configure ALV settings                                             &
    Create field catalog
        perform create_field_catalog using 'F1'     'T_ALV' 'Colour name'.
        perform create_field_catalog using 'F2'     'T_ALV' 'Description'.
        perform create_field_catalog using 'F3'     'T_ALV' 'BaseColour'.
        perform create_field_catalog using 'F4'     'T_ALV' 'Intensified'.
        perform create_field_catalog using 'F5'     'T_ALV' 'Inverse'.
        perform create_field_catalog using 'F6'     'T_ALV' 'Both Inv/Int'.
        perform create_field_catalog using 'COLOUR' 'T_ALV' 'Colour'.
    Layout
        clear i_layout.
        i_layout-colwidth_optimize   = 'X'.
        i_layout-info_fieldname      = 'COLOUR'.   " for line colour
        i_layout-coltab_fieldname    = 'COLTAB'.   " for cell colour
        call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
            i_callback_program      = sy-cprog
            i_callback_user_command = 'USER_COMMAND'
            is_layout               = i_layout
            it_fieldcat             = i_fieldcat[]
            i_default               = 'X'
            i_save                  = 'A'
          tables
            t_outtab                = i_alv.
        & Form  CREATE_FIELD_CATALOG                                          &
        form create_field_catalog using    p_fieldname
                                           p_tabname
                                           p_text.
          i_fieldcat-fieldname        = p_fieldname.
          i_fieldcat-tabname          = p_tabname.
          i_fieldcat-seltext_l        = p_text.
          append i_fieldcat.
        endform.                    " CREATE_FIELD_CATALOG
    For more information about Coloring in ALV, Please refer :
    Coloring Rows in ALV
    Hope this helps you in solving your issue.
    Please Reward Points if any of the above points are helpful to you.
    Regards,
    Kalyan Chakravarthy

  • How to devide the top of page in alv grid display

    hi all
    in the alv grid display am getting the page number and total number of pages in the left hand side
    but what i need is i need in the right hand side
    how to get that

    Hi,
    PLease refer to the code below:
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    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-do_sum      = 'X'.
      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.
    Thanks,
    Sriram Ponna.

Maybe you are looking for

  • Automatic creation of customer from BP

    Hi Xperts Am using version ecc6.04 , I  implemented SAP note 956054 including running all the reports included therein. Am still not able to create the customer through the automatic process. Is there anything exceptional that should be done apart fr

  • Error trying to create a Master Form

    Hello, <b>I keep getting told to put this in different sections of the forum.</b> Exception from wwv_generate_component.build_procedure (WWV-01821) Error creating module: ORA-01403: no data found (WWV-16042) Has anyone seen this error before? I am ne

  • How can we split a select query to 3 or 4 if it is fetching much records?

    I am running a query like: select * from table_name it will be fetching 152940696 records. Now i want to fetch this result as 3 or 4 select statements. That is, in the second query I want to fetch the records from where i stopped in the first query.

  • IPad Email Attachments showing up as empty/missing icon question mark

    So this is a very odd bug that is happening on both the iPad and iPhone os, albeit it occurs more on the iPad. When I sent PDF attachments that shows up on my normal apple mail (as a preview PDF inside the email content), it is showing up as a empty

  • What HP printers use HP363 cartridges? Appalled by customer service.

    So, I just phoned HP sales to ask what printers use the HP363 cartridges, because my HP D7360 printer has just packed in and I have a load of cartridges for it, and was rather coldly told "you'll just have to look through them all to find out". I'm r