How to add checkbox in ALV OO?

how to change editable mode and able to input???
REPORT  ZZ_ALV_TEST.
data:
      ispfli type table of spfli.
data: gr_table type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
data: gr_display type ref to cl_salv_display_settings.
DATA: GR_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE,
      GR_COLUMN  TYPE REF TO CL_SALV_COLUMN_TABLE.
start-of-selection.
select * into table ispfli from spfli.
cl_salv_table=>factory( importing r_salv_table = gr_table changing
t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
GR_COLUMNS = GR_TABLE->GET_COLUMNS( ).
  TRY.
      GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( 'CARRID' ). "Column which you
* want to make checkbox
      GR_COLUMN->SET_CELL_TYPE( 1 ).
    CATCH CX_SALV_NOT_FOUND.
  ENDTRY.
gr_table->display( ).

I understand the CARRID column is not a checkbox, so you might mean something else entirely. If all you need is to toogle a checkbox value on click, then
- first make the checkbox a hotspot
gr_column->set_cell_type(  if_salv_c_cell_type=>checkbox_hotspot ). " constant value 6
- implement a handler to the hotspot event
DATA gr_events TYPE REF TO cl_salv_events_table.
    gr_events = gr_table->get_event( ).
    SET HANDLER ??->handle_hotspot_click FOR gr_events.
- Your handler must toogle the checkbox value and refresh the display, something like
    METHOD handle_hotspot_click.
    FIELD-SYMBOLS <ls_item> TYPE spfli.
    READ TABLE ispfli INDEX row ASSIGNING <ls_item>.
    CHECK sy-subrc EQ 0.
    CASE column.
      WHEN 'CARRID'.  " your checkbox column
*       Toogle Value
        IF <ls_item>-carrid EQ 'X'.
          <ls_item>-carridl = space.
         ELSE.
          <ls_item>-carrid = 'X'.
        ENDIF.
        gr_table->refresh( ).
    ENDCASE.
  ENDMETHOD.
J.N.N

Similar Messages

  • How To add Logo in ALV Report

    Hi,
    How To add Logo in ALV Report?
        I need step by step explanation.

    Hi uday,
    go through this hope u can understand.
    *&amp;amp; Report Z_OOALV_LOGO
    *&--Sample Program using ooalv-> by SrikanthV--
    REPORT z_ooalv_logo.
    ****DECLARATION FOR LOGO INSERT
    CONSTANTS: cntl_true TYPE i VALUE 1,
    cntl_false TYPE i VALUE 0.
    DATA:h_picture TYPE REF TO cl_gui_picture,
    h_pic_container TYPE REF TO cl_gui_custom_container.
    DATA: graphic_url(255),
    graphic_refresh(1),
    g_result LIKE cntl_true.
    DATA: BEGIN OF graphic_table OCCURS 0,
    line(255) TYPE x,
    END OF graphic_table.
    DATA: graphic_size TYPE i.
    CALL SCREEN 100.
    *&amp;----
    *& Module PICTURE OUTPUT
    text
    MODULE picture OUTPUT.
    DATA: l_graphic_xstr TYPE xstring,
    l_graphic_conv TYPE i,
    l_graphic_offs TYPE i.
    CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
    EXPORTING
    p_object = 'GRAPHICS'
    p_name = 'EDS'"IMAGE NAME - Image name from SE78
    p_id = 'BMAP'
    p_btype = 'BCOL'
    RECEIVING
    p_bmp = l_graphic_xstr
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    graphic_size = XSTRLEN( l_graphic_xstr ).
    CHECK graphic_size > 0.
    l_graphic_conv = graphic_size.
    l_graphic_offs = 0.
    WHILE l_graphic_conv > 255.
    graphic_table-line = l_graphic_xstr+l_graphic_offs(255).
    APPEND graphic_table.
    l_graphic_offs = l_graphic_offs + 255.
    l_graphic_conv = l_graphic_conv - 255.
    ENDWHILE.
    graphic_table-line = l_graphic_xstr+l_graphic_offs(l_graphic_conv).
    APPEND graphic_table.
    CALL FUNCTION 'DP_CREATE_URL'
    EXPORTING
    type = 'image'
    subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'
    size = graphic_size
    lifetime = cndp_lifetime_transaction "'T'
    TABLES
    data = graphic_table
    CHANGING
    url = graphic_url
    EXCEPTIONS
    dp_invalid_parameter = 1
    dp_error_put_table = 2
    dp_error_general = 3
    OTHERS = 4 .
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
    ENDIF.
    CREATE OBJECT h_pic_container
    EXPORTING container_name = 'LOGO'.
    CREATE OBJECT h_picture EXPORTING parent = h_pic_container.
    CALL METHOD h_picture->load_picture_from_url
    EXPORTING
    url = graphic_url
    IMPORTING
    RESULT = g_result.
    ENDMODULE. " PICTURE OUTPUT
    Reward points if helpful.
    Thanks

  • Hi Experts, oo hierarchical alv, how to add checkbox on every header?

    Hi Experts,
    I am working on oo hierarchical alv, how can I add checkbox on every header? thanks in advance!
    Kind regards
    Dawson

    Hi Dawson,
    Just refer the below program & pass the check box functionality (mentioned in bold) in REUSE_ALV_HIERSEQ_LIST_DISPLAY in your program.
    TYPE-POOLS : slis.
    Data
    DATA : BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE t001.
    DATA : flag tyPE c,
    END OF itab.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvly TYPE slis_layout_alv.
    Select Data
    SELECT * FROM t001 INTO TABLE itab.
    *------- Field Catalogue
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'ITAB'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = alvfc
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    Display
    alvly-box_fieldname = 'FLAG'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    i_callback_program = sy-repid "<-------Important
    i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
    is_layout = alvly
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    CALL BACK FORM
    FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
    LOOP AT itab.
    itab-flag = 'X'.
    MODIFY itab.
    ENDLOOP.
    IMPORTANT.
    WHATROW-REFRESH = 'X'.
    ENDFORM. "ITAB_user_command
    Regards
    Abhii...

  • How to Add Checkbox and icon in ALVGRID

    Hi Experts,
      i have one Requirement. i need to add Checkbox, Selectall,icon(Unlock or inactive) infront of Contracts of ALV GRID.How to achive that.
    Thanks,
    Venkat.

    Hi
    For check box
    At declaring field catalog using structure LVC_S_FCAT
    mark CHECKBOX = 'X' and also EDIT = 'X'.
    For reference check below subroutine in program BCALV_EDIT_05.
    form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
    data ls_fcat type lvc_s_fcat.
    call function 'LVC_FIELDCATALOG_MERGE'
    exporting
    i_structure_name = 'SFLIGHT'
    changing
    ct_fieldcat = pt_fieldcat.
    *§A2.Add an entry for the checkbox in the fieldcatalog
    clear ls_fcat.
    ls_fcat-fieldname = 'CHECKBOX'.
    * Essential: declare field as checkbox and
    * mark it as editable field:
    ls_fcat-checkbox = 'X'.
    ls_fcat-edit = 'X'.
    * do not forget to provide texts for this extra field
    ls_fcat-coltext = text-f01.
    ls_fcat-tooltip = text-f02.
    ls_fcat-seltext = text-f03.
    * optional: set column width
    ls_fcat-outputlen = 10.
    append ls_fcat to pt_fieldcat.
    endform.
    For Icon:
    CONSTANTS:
         icon_id_failure            LIKE icon-id   VALUE ' ((Content component not found.)) @',
         icon_id_okay              LIKE icon-id   VALUE ' ((Content component not found.)) @'.
    TYPES: BEGIN OF ls_tab,
           matnr LIKE equi-matnr,
           maktx LIKE makt-maktx,
           b_werk  LIKE equi-werk,
           b_lager LIKE equi-lager,
           lgobe LIKE t001l-lgobe,
           sernr LIKE equi-sernr,
           icon LIKE icon-id,
           objnr LIKE equi-objnr,
          END OF   ls_tab.
    *Table that display the data for the ALV.
    DATA: itab  TYPE ls_tab OCCURS 0 WITH HEADER LINE.
        PERFORM get_h_date .
        IF h_date => sy-datum .
          itab-icon = icon_id_okay.
        ELSE .
          itab-icon = icon_id_failure.
         ENDIF.
    Regards
    Sudheer

  • How to add checkboxes to frame

    So I have two classes in my package. I am having trouble adding the checkbox group to my frame. I got it to add to my applet but I can not figure out how to add it to my frame. Here is what I have so far. When I run this program it puts the checkboxes in my applet and not in my frame.
    this is my painter class:
    package pt;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class painter extends Applet {
    private int xValue=-10, yValue=-10;
    MyFrame x;
    Checkbox Red, Black, Magenta, Blue, Green, Yellow;
    CheckboxGroup cbg;
    public void init()
    x= new MyFrame("Christie's Window");
    x.show();
    x.resize(250,100);
    cbg = new CheckboxGroup();
           Red = new Checkbox("Red", cbg,true);
           Black = new Checkbox("Black", cbg,false);
           Magenta = new Checkbox("Magenta",cbg,false);
           Blue = new Checkbox("Blue", cbg, false);
           Green = new Checkbox("Green", cbg, false);
           Yellow = new Checkbox("Yellow", cbg, false);
           add(Red);
           add(Black);
           add(Magenta);
           add(Blue);
           add(Green);
           add(Yellow);
         addMouseMotionListener(new MotionHandler(this));
    public void paint(Graphics g)
    g.drawString("Drag the mouse to draw", 10, 20);
    g.fillOval(xValue, yValue, 4,4);
    //Override Component class update method to allow all ovals
    // to remain on the screen by not clearing the background
    public void update(Graphics g)   { paint(g); }
    // set the drawing coordinates and repaint
    public void setCoordinates(int x, int y)
      xValue = x;
      yValue = y;
      repaint();
    // Class to handle only mouse drag events for the Drag applet
    class MotionHandler extends MouseMotionAdapter {
      private painter dragger;
      public MotionHandler(painter d)  { dragger = d; }
      public void mouseDragged( MouseEvent e)
        { dragger.setCoordinates( e.getX(), e.getY() );   }
        } and here is MyFrame class:
    package pt;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class MyFrame extends Frame {
    MyFrame(String x){
       super(x);
        public boolean handleEvent(Event evtObj) {
          if(evtObj.id==Event.WINDOW_DESTROY) {
            hide();
            return true;
          return super.handleEvent(evtObj);
    }

    here's your conversion, with listeners to change the color
    //import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    //public class painter extends Applet {
    class painter extends Frame {
    Color color = Color.RED;
    private int xValue=-10, yValue=-10;
    //MyFrame x;
    Checkbox Red, Black, Magenta, Blue, Green, Yellow;
    CheckboxGroup cbg;
    //public void init()
    public painter()
    //x= new MyFrame("Christie's Window");
    setTitle("Christie's Window");
    //x.show();
    //x.resize(250,100);
    setSize(600,400);
    setLocation(200,100);
    cbg = new CheckboxGroup();
           Red = new Checkbox("Red", cbg,true);
           Red.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Red.getState()) color = Color.RED;}});
           Black = new Checkbox("Black", cbg,false);
           Black.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Black.getState()) color = Color.BLACK;}});
           Magenta = new Checkbox("Magenta",cbg,false);
           Magenta.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Magenta.getState()) color = Color.MAGENTA;}});
           Blue = new Checkbox("Blue", cbg, false);
           Blue.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Blue.getState()) color = Color.BLUE;}});
           Green = new Checkbox("Green", cbg, false);
           Green.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Green.getState()) color = Color.GREEN;}});
           Yellow = new Checkbox("Yellow", cbg, false);
           Yellow.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Yellow.getState()) color = Color.YELLOW;}});
    Panel p = new Panel();
           p.add(Red);
           p.add(Black);
           p.add(Magenta);
           p.add(Blue);
           p.add(Green);
           p.add(Yellow);
    add(p,BorderLayout.NORTH);
         addMouseMotionListener(new MotionHandler(this));
    addWindowListener(new WindowAdapter(){
          public void windowClosing(WindowEvent we) { System.exit(0); }});
    public void paint(Graphics g)
    super.paint(g);
    g.setColor(color);
    g.drawString("Drag the mouse to draw", 10, 75);
    g.fillOval(xValue, yValue, 4,4);
    //Override Component class update method to allow all ovals
    // to remain on the screen by not clearing the background
    public void update(Graphics g)   { paint(g); }
    // set the drawing coordinates and repaint
    public void setCoordinates(int x, int y)
      xValue = x;
      yValue = y;
      repaint();
    // Class to handle only mouse drag events for the Drag applet
    class MotionHandler extends MouseMotionAdapter {
      private painter dragger;
      public MotionHandler(painter d)  { dragger = d; }
      public void mouseDragged( MouseEvent e)
        { dragger.setCoordinates( e.getX(), e.getY() );   }
      public static void main(String[] args){new painter().setVisible(true);}
    }

  • How to add radiobuttons in ALV Grid

    Hi,
    I refered the threads in SDN but i am not able to get proper solution for my requirement.
    I am displaying output in ALV Grid format. After displaying the output i mean in the output screen i need few buttons and radio buttons . when user selects the record and clicks the radio button accordingly my logic should work. Anybody can tell me how to add the radiobuttons in the output of the screen. Please find the below output format for the requirement is
    Push button1 Pushbutton2  Radiobutton1 Radio button2
    MY program output in Grid format.
    Anybody can suggest me how to approach.
    Regards,
    Maheedhar

    Check if this link helps..
    http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT

  • Need to add checkbox in alv header Not  in grid

    Dear Guru's,
                       My question is i want to add checkbox on top of alv grid ie on top of page .
    my requriement is for SD module- status of order -Mass Update.
    suppose status checkbox on header is HFSC is checked ( check box),
    for all the sales order which are showed on the alv grid must be updated with this status for which i am calling trasaction VA02 in program and doing changes but i am not able to create checkbox on header .
    Again i have already used ALV without classesso please give me solution accordinglly . Thanks in advance.

    Hi,
    For working with top of page we generally use SLIS_LISTHEADER right.
    In this type the first field is
    type - which can accept values as follows
               H - Heading
               S - Selection
               A - Action
    May be the options Selection or Action may help u.

  • How to add Checkbox in Table

    Hi,
    I want to add CheckBox in Table. my requirement is multiselection. I Implemented the following steps, but it's not working. anyone can tell me,what mistake i did?
    I created two "Value Attribute"(check,Name) under a "Value Node"(Student) in context.
    check - Boolean
    Name - mapped a Dictionary simple Type(5 values)
    Include a Table in Layout and select Create Binding on right clicking of Table.
    Checked only Student and check -> Next
    Selected the Editor as checkbox -> Finish
    Selected Name from context and assigned to checkbox text property.
    Then I deployed the application. But only one checkbox is displayed in Table without any text.
    Please give me the suggestion, how to do this.
    Thanks in Advance
    Rajakumar

    Hello,
    I think you have a fundamental misunderstanding on how Checkboxes work. A Checkbox triggers a boolean value with true (checked) or false (uncheked).
    When you map your name attribut to text you will see the content of that attribute as text behind. But not the metadata.
    You may want to use a RadiobuttonGroup or CheckboxGroup for your purpose.
    Frank

  • How to add header in ALV

    Hi Friends,
    How to add a header in ALV, Can you please tell me.
    Regards,
    Venu.

    hi,
    chk this sample code.
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                <b>i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM</b>           
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    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.
    rgds
    anver
    if hlped mark points

  • How to Set Checkbox of ALV Grid Dark on Display Mode

        ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
        Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
        I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
        Help me solve this problem, please.
        Part of my codes are as follows.
        Part 1:
    IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
           set_enable( iv_flag = 1 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             CLEAR ls_celltab.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ELSE.
           set_enable( iv_flag = 0 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ENDIF.
         CALL METHOD gr_grid->refresh_table_display
    *      EXPORTING
    *        is_stable      =
    *        i_soft_refresh =
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2
         IF sy-subrc <> 0.
    *     Implement suitable error handling here
         ENDIF.
        Part 2:
    METHOD set_enable.
         gr_grid->set_ready_for_input(
             i_ready_for_input = iv_flag
    ENDMETHOD.

    Hi Liu,
        Please go through the below code.
    *& Report  YEDIT_DISPLAY
    REPORT  YEDIT_DISPLAY.
    TABLES : VBAK.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_VBAK,
              VBELN TYPE VBAK-VBELN,
             END OF TY_VBAK,
             BEGIN OF TY_FINAL,
               BOX TYPE C,
               VBELN TYPE VBAK-VBELN,
             END OF TY_FINAL.
    DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
            WA_VBAK TYPE TY_VBAK,
            IT_FINAL TYPE TABLE OF TY_FINAL,
            WA_FINAL TYPE TY_FINAL,
            IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
       PERFORM FETCH_DATA.
       PERFORM FCAT_DATA.
       PERFORM DISPLAY.
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_DATA .
       SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
       LOOP AT IT_VBAK INTO WA_VBAK.
         WA_FINAL-VBELN = WA_VBAK-VBELN.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR : WA_FINAL , WA_VBAK.
       ENDLOOP.
    ENDFORM.                    " FETCH_DATA
    *&      Form  FCAT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FCAT_DATA .
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
       WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FCAT_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY .
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY
    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
                             RTAB TYPE slis_selfield.
       CASE UCOMM.
         WHEN '&IC1'.
           MESSAGE 'SUCESSFUL' TYPE 'S'.
         WHEN '&DATA_SAVE'.
           PERFORM FIL_FCAT.
           PERFORM DISPLAY1.
         WHEN 'BACK'.
           LEAVE TO SCREEN 0.
         WHEN OTHERS.
           LEAVE TO SCREEN 0.
       ENDCASE.
    ENDFORM.
    *&      Form  FIL_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FIL_FCAT .
    CLEAR IT_FCAT.
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
    **  WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FIL_FCAT
    *&      Form  DISPLAY1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY1 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY1
    Here i written code under the SAVE button , if requires you create your own status and apply.
    Regards,
    Krishna

  • How to add CheckBoxs to a scrollPane

    I have a file I�m getting user info out of and finding certain information the
    User enters, I�m making a query, I�m taking the found items and making an array of Checkboxes out of them witch is working my problem is adding the Checkboxes to the scroll Pane
    public class Frame1 extends JFrame{
    public static Panel listan = new Panel();
    JCheckBox[] jCheckBox1 ;
    JScrollPane scrollPane1 = new JScrollPane(list);
    //other Window objects
    //first method
    private void jbInit() throws Exception {
    //puts all window objects together
    // Constructs user screen
    list.setLayout(verticalFlowLayout1);
    panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
    // i have a find buttion that takes all infoamtion out of file
    // and puts in an array then finds user enterd infomation
    // this is just example code that just adds CheckBoxs to the scrollPane
    // and is Basically the same way the other program does
    // second method
    void addcheckbox_actionPerformed(ActionEvent e) {
    jCheckBox1 = new JCheckBox[50];
    for (int i = 0; i < 50; i++) {
    String checkboxText = ("Checkbox #: " + (i + 1));
    jCheckBox1[i] = new JCheckBox(checkboxText);
    for (int i = 0; i < 50; i++) {
    list.add(jCheckBox1, null);
    My problem is that I can�t add the checkboxes at the second method but it works in the first, I can add in the first because I initialize in the second.

    If you want something to compile here is all my example code
    I will incorporate it to my 30 page program
    Here is what I want my code to do
    package list;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import com.borland.jbcl.layout.*;
    import java.awt.Checkbox;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2008</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Frame1 extends JFrame {
      public static boolean ch=true;
      JPanel contentPane;
      GridLayout gridLayout1 = new GridLayout();
      JPanel panel1 = new JPanel();
      XYLayout xYLayout1 = new XYLayout();
      JButton jButton1;
      JButton jButton2;
      JButton addcheckbox;
      JCheckBox[] jCheckBox1 ;
      JScrollPane scrollPane1 = new JScrollPane();
      JPanel list = new JPanel();
      VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
      //Construct the frame
      public Frame1() {
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        try {
          jbInit();
        catch (Exception e) {
          e.printStackTrace();
      //Component initialization
    // method one
      private void jbInit() throws Exception {
        contentPane = (JPanel)this.getContentPane();
        jButton1 = new JButton();
        jButton2 = new JButton();
        addcheckbox = new JButton();
        this.setContentPane(contentPane);
        this.setLocale(java.util.Locale.getDefault());
        this.setResizable(false);
        this.setSize(new Dimension(400, 300));
        this.setState(Frame.NORMAL);
        this.setTitle("Frame Title");
        contentPane.setOpaque(true);
        contentPane.setRequestFocusEnabled(true);
        contentPane.setLayout(gridLayout1);
        panel1.setLayout(xYLayout1);
        jButton1.setSelected(false);
        jButton1.setText("Print");
        jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
        jButton2.setText("select all/none");
        jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
        addcheckbox.setBorderPainted(true);
        addcheckbox.setText("add");
        addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
        scrollPane1.setLocale(java.util.Locale.getDefault());
        list.setLayout(verticalFlowLayout1);
        contentPane.add(panel1, null);
        panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
        scrollPane1.getViewport().add(list, null);
        //scrollPane1.add(listan, null);
        panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
        panel1.add(jButton2,   new XYConstraints(262, 152, 108, 30));
        panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
      //Overridden so we can exit when window is closed
      protected void processWindowEvent(WindowEvent e) {
        super.processWindowEvent(e);
        if (e.getID() == WindowEvent.WINDOW_CLOSING) {
          System.exit(0);
      void jButton1_actionPerformed(ActionEvent e) {
        String checkprint = "selected:\n";
        for (int x = 0; x < jCheckBox1.length; x++) {
          if (jCheckBox1[x].isSelected()) {
             checkprint = checkprint + jCheckBox1[x].getText()+"\n";
        System.out.println(checkprint);
      void jButton2_actionPerformed(ActionEvent e) {
        for (int x = 0; x < jCheckBox1.length; x++) {
          if (ch == true) {
            jCheckBox1[x].setSelected(true);
          else{
            jCheckBox1[x].setSelected(false);
    if (ch == true)
          ch=false;
        else
          ch=true;
    //method two
      void addcheckbox_actionPerformed(ActionEvent e) {
        jCheckBox1 = new JCheckBox[50];
            for (int i = 0; i < 50; i++) {
              String checkboxText = ("Checkbox #: " + (i + 1));
              jCheckBox1[i] = new JCheckBox(checkboxText);
            for (int i = 0; i < 50; i++) {
             list.add(jCheckBox1, null);
    class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
    Frame1 adaptee;
    Frame1_jButton1_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
    class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
    Frame1 adaptee;
    Frame1_jButton2_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
    class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
    Frame1 adaptee;
    Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.addcheckbox_actionPerformed(e);
    }doesn�t work but if I take all of method two and put it in one it workspackage list;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import com.borland.jbcl.layout.*;
    import java.awt.Checkbox;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2008</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Frame1 extends JFrame {
    public static boolean ch=true;
    JPanel contentPane;
    GridLayout gridLayout1 = new GridLayout();
    JPanel panel1 = new JPanel();
    XYLayout xYLayout1 = new XYLayout();
    JButton jButton1;
    JButton jButton2;
    JButton addcheckbox;
    JCheckBox[] jCheckBox1 ;
    JScrollPane scrollPane1 = new JScrollPane();
    JPanel list = new JPanel();
    VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
    //Construct the frame
    public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch (Exception e) {
    e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
    // this is the same code in method two
    jCheckBox1 = new JCheckBox[50];
    for (int i = 0; i < 50; i++) {
    String checkboxText = ("Checkbox #: " + (i + 1));
    jCheckBox1[i] = new JCheckBox(checkboxText);
    for (int i = 0; i < 50; i++) {
    list.add(jCheckBox1[i], null);
    contentPane = (JPanel)this.getContentPane();
    jButton1 = new JButton();
    jButton2 = new JButton();
    addcheckbox = new JButton();
    this.setContentPane(contentPane);
    this.setLocale(java.util.Locale.getDefault());
    this.setResizable(false);
    this.setSize(new Dimension(400, 300));
    this.setState(Frame.NORMAL);
    this.setTitle("Frame Title");
    contentPane.setOpaque(true);
    contentPane.setRequestFocusEnabled(true);
    contentPane.setLayout(gridLayout1);
    panel1.setLayout(xYLayout1);
    jButton1.setSelected(false);
    jButton1.setText("Print");
    jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
    jButton2.setText("select all/none");
    jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
    addcheckbox.setBorderPainted(true);
    addcheckbox.setText("add");
    addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
    scrollPane1.setLocale(java.util.Locale.getDefault());
    list.setLayout(verticalFlowLayout1);
    contentPane.add(panel1, null);
    panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
    scrollPane1.getViewport().add(list, null);
    //scrollPane1.add(listan, null);
    panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
    panel1.add(jButton2, new XYConstraints(262, 152, 108, 30));
    panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    void jButton1_actionPerformed(ActionEvent e) {
    String checkprint = "selected:\n";
    for (int x = 0; x < jCheckBox1.length; x++) {
    if (jCheckBox1[x].isSelected()) {
    checkprint = checkprint + jCheckBox1[x].getText()+"\n";
    System.out.println(checkprint);
    void jButton2_actionPerformed(ActionEvent e) {
    for (int x = 0; x < jCheckBox1.length; x++) {
    if (ch == true) {
    jCheckBox1[x].setSelected(true);
    else{
    jCheckBox1[x].setSelected(false);
    if (ch == true)
    ch=false;
    else
    ch=true;
    void addcheckbox_actionPerformed(ActionEvent e) {
    class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
    Frame1 adaptee;
    Frame1_jButton1_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
    class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
    Frame1 adaptee;
    Frame1_jButton2_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
    class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
    Frame1 adaptee;
    Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.addcheckbox_actionPerformed(e);
    }Edited by: deme on Feb 27, 2008 6:48 AM
    Edited by: deme on Feb 27, 2008 6:51 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to add checkboxes to frames?

    Hi,
    I am trying to add checkboxes to a frame which will then be instantiated from an applet. I can launch the frame correctly from my applet but it always displays the last checkbox added only. So in my code below it would always display the 'Black' checkbox.
    Could anyone please tell me what I am doing wrong or not doing here?
    import java.awt.*;
    import java.applet.*;
    class Chooser extends Frame {
         Chooser(String title) {
              super(title);
              Checkbox cRed;
              Checkbox cBlack;
              CheckboxGroup cbg = new CheckboxGroup( );
              cRed = new Checkbox("Red", cbg, true);
              cBlack = new Checkbox("Black", cbg, false);
              add(cRed);
              add(cBlack);
            public boolean handleEvent(Event evtObj) {
              if (evtObj.id == Event.WINDOW_DESTROY) {
                   hide( );
                   return true;
              return super.handleEvent(evtObj);
         public void paint(Graphics g) {
              g.drawString("Chooser Frame",10,40);
    }Thanks
    Avi
    Message was edited by:
    avi22
    Message was edited by:
    avi22

    add a pack() statement to your Chooser constructor as the last statement before the end of the constructor
      Chooser(String title){
    //    your code here
        this.pack();

  • How to add colour in alv

    HI guru,
       WA_HEAD-TYP = 'S'.
        WA_HEAD-KEY = 'ON SPEC PRODUCTION' .
        CONCATENATE ON_SPEC  '%' INTO LV_ONSPEC.
        WA_HEAD-INFO = LV_ONSPEC.
        APPEND WA_HEAD TO TS_HEAD.
        CLEAR WA_HEAD.
    here i want add colour for onspec production.
    how to do this???

    Hi Subhasis,,
    Demo program to color particular row or column or cell of an ALV list using 'REUSE_ALV_LIST_DISPLAY'
    Check this link for the demo program:
    http://****************/Tutorials/ALV/ColorSALV/Demo.htm
    REPORT ZALV_LIST1.
    TABLES:
    SPFLI.
    TYPE-POOLS:
    SLIS.
    PARAMETERS:
    P_COL TYPE I ,
    P_ROW TYPE I,
    P_COLOR(4) TYPE C .
    DATA:
    T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    FS_FIELDCAT LIKE LINE OF T_FIELDCAT,
    FS_LAYOUT TYPE SLIS_LAYOUT_ALV ,
    W_COLOR(4) ,
    W_ROW TYPE I,
    W_FIELDNAME(20),
    W_PROG TYPE SY-REPID.
    DATA:
    BEGIN OF T_SPFLI OCCURS 0,
    COLOR(4),
    CHECKBOX ,
    CELL TYPE SLIS_T_SPECIALCOL_ALV,
    CARRID TYPE SPFLI-CARRID,
    CONNID TYPE SPFLI-CONNID,
    CITYFROM TYPE SPFLI-CITYFROM,
    CITYTO TYPE SPFLI-CITYTO,
    DISTANCE TYPE SPFLI-DISTANCE,
    END OF T_SPFLI.
    DATA:
    FS_CELL LIKE LINE OF T_SPFLI-CELL.
    SELECT *
    FROM SPFLI
    INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
    W_COLOR = P_COLOR.
    T_SPFLI-COLOR = P_COLOR.
    IF P_COL IS INITIAL AND P_ROW GT 0.
    MODIFY T_SPFLI INDEX P_ROW TRANSPORTING COLOR.
    ENDIF.
    FS_FIELDCAT-FIELDNAME = 'CARRID'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 1.
    FS_FIELDCAT-KEY = 'X'.
    FS_FIELDCAT-HOTSPOT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT .
    FS_FIELDCAT-FIELDNAME = 'CONNID'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 2.
    FS_FIELDCAT-KEY = 'X'.
    FS_FIELDCAT-HOTSPOT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT .
    FS_FIELDCAT-FIELDNAME = 'DISTANCE'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 3.
    FS_FIELDCAT-KEY = ' '.
    FS_FIELDCAT-EDIT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT.
    FS_FIELDCAT-FIELDNAME = 'CITYFROM'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 4.
    FS_FIELDCAT-KEY = ' '.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    LOOP AT T_FIELDCAT INTO FS_FIELDCAT.
    IF FS_FIELDCAT-COL_POS EQ P_COL.
    FS_FIELDCAT-EMPHASIZE = P_COLOR.
    W_FIELDNAME = FS_FIELDCAT-FIELDNAME.
    IF P_ROW IS INITIAL AND P_COL GT 0.
    MODIFY T_FIELDCAT FROM FS_FIELDCAT TRANSPORTING EMPHASIZE.
    ENDIF.
    ENDIF.
    ENDLOOP.
    FS_CELL-FIELDNAME = W_FIELDNAME .
    FS_CELL-COLOR-COL = 6.
    FS_CELL-NOKEYCOL = 'X'.
    APPEND FS_CELL TO T_SPFLI-CELL.
    IF P_ROW IS NOT INITIAL AND P_COL IS NOT INITIAL.
    MODIFY T_SPFLI INDEX P_ROW TRANSPORTING CELL.
    ENDIF.
    FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
    FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
    FS_LAYOUT-COLTAB_FIELDNAME = 'CELL'.
    FS_LAYOUT-F2CODE = '&ETA'.
    W_PROG = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = W_PROG
    IS_LAYOUT = FS_LAYOUT
    IT_FIELDCAT = T_FIELDCAT
    TABLES
    T_OUTTAB = T_SPFLI
    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.
    NOTE
    Column and Row are colored with a coded color ‘Cxyz’.
        Where C: Color (coding must begin with C)
                     X: Color Number
                     Y: Bold
                     Z: Inverse.
    Reward if found useful...,,,,,
    Regards ,
    Sreekar.Kadiri.

  • How to add button in ALV report (Class method )?

    Hello experts,
    I have developed one ALV report using classes.
    I want to add one more  button on the report like already is there named DISPLQUA
    How ca i do that here?
    Following the code of CLASS definition & implimentation
    CLASS lcl_handle_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_on_user_command FOR EVENT added_function OF cl_salv_events
            IMPORTING e_salv_function.
    ENDCLASS.                    "lcl_handle_events DEFINITION
          CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events IMPLEMENTATION.
      METHOD handle_on_user_command.
        CASE e_salv_function.
          WHEN 'DISPLQUA'.
            PERFORM show_quant_record.
         WHEN 'DISPQM03'.                                " Here i want to add button
           PERFORM display_quality_notification.
          WHEN OTHERS.
        ENDCASE.
      ENDMETHOD.                    "handle_on_user_command
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION

    HI Ronny.
    Code snippet for reference.
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION.
        METHODS :
    *--Toolbar control
          HANDLE_TOOLBAR FOR EVENT TOOLBAR
            OF CL_GUI_ALV_GRID IMPORTING E_OBJECT
                                         E_INTERACTIVE,
    ENDCLASS
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *--handle toolbar
      METHOD HANDLE_TOOLBAR.
    * append a separator to normal toolbar
        CLEAR G_TOOLBAR.
        G_TOOLBAR-BUTN_TYPE = 3.
        APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR G_TOOLBAR.
        G_TOOLBAR-FUNCTION = 'SAVE'.
        G_TOOLBAR-ICON = ICON_SYSTEM_SAVE.
        G_TOOLBAR-BUTN_TYPE = 0.
        G_TOOLBAR-QUICKINFO = 'Save the Customer'(203).
        APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
      ENDMETHOD.                    "HANDLE_TOOLBAR
    Hope this helps.
    Gary.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Apr 7, 2008 5:41 PM

  • How to add Icons to ALV Reprt?

    Hi,
    I need to display icons (red, yellow) in my ALV Report in the first column in my report.
    In my field catalog fieldcat-icon = 'X' has been taken into consideration, but still I am not able to see in my report. In the final internal table that is to display I created a field for this Icon type ICON_D. Is this the correct procedure to work with or else kindly let me know how to proceed?
    Regards,
    Raghu Ram.

    This is the code that has been incorporated in order to display Icon in the ALV Report.
    *                     TABLES Declarations                             *
    Tables: PROJ,             " Project definition
            PRPS,             " WBS (Work Breakdown Structure) Element Master Data
            ICON.
    *                     TYPE POOLS                                      *
    TYPE-POOLS: SLIS,        " Globale Typen für generische Listbausteine
                ICON.
    *                     ALV Data Declarations                           *
    DATA:
      GT_FIELDCAT       TYPE   SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
      GT_REPID          TYPE   SY-REPID.
    *                     Type Declarations                               *
    TYPES:
    * STRUCTURE OF TABLE PROJ
      BEGIN OF TY_PROJ,
        PSPNR      TYPE PROJ-PSPNR,
        PSPID      TYPE PROJ-PSPID,
        POST1      TYPE PROJ-POST1,
        OBJNR      TYPE PROJ-OBJNR,
        VERNR      TYPE PROJ-VERNR,
        VERNA      TYPE PROJ-VERNA,
      END OF TY_PROJ,
    * STRUCTURE OF TABLE PRPS
      BEGIN OF TY_PRPS,
        PSPNR      TYPE PRPS-PSPNR,
        POSID      TYPE PRPS-POSID,
        POST1      TYPE PRPS-POST1,
        OBJNR      TYPE PRPS-OBJNR,
        PSPHI      TYPE PRPS-PSPHI,
        VERNR      TYPE PRPS-VERNR,
      END OF TY_PRPS,
      BEGIN OF TY_FINAL,
        LIGHT       TYPE ICON_D,
        PSPNR       TYPE PROJ-PSPNR,
        PSPID       TYPE PROJ-PSPID,
        POST1       TYPE PROJ-POST1,
        OBJNR       TYPE PROJ-OBJNR,
        VERNR       TYPE PROJ-VERNR,
        VERNA       TYPE PROJ-VERNA,
        PSPNR_1     TYPE PRPS-PSPNR,
        POSID       TYPE PRPS-POSID,
        POST1_1     TYPE PRPS-POST1,
        OBJNR_1     TYPE PRPS-OBJNR,
        PSPHI       TYPE PRPS-PSPHI,
        VERNR_1     TYPE PRPS-VERNR,
      END OF TY_FINAL.
    *                     Internal Table Declarations                     *
    DATA:
        IT_PROJ  TYPE STANDARD TABLE OF TY_PROJ,
        IT_PRPS  TYPE STANDARD TABLE OF TY_PRPS,
        IT_FINAL TYPE STANDARD TABLE OF TY_FINAL.
    *                    Work Area Declarations                            *
    DATA:
        WA_PROJ  TYPE TY_PROJ,
        WA_PRPS  TYPE TY_PRPS,
        WA_FINAL TYPE TY_FINAL.
    *                          Selection Screen                           *
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
      SELECT-OPTIONS:   S_PSPNR FOR PROJ-PSPNR.
    SELECTION-SCREEN END OF BLOCK BLK.
    *                          Start Of Selection                         *
    START-OF-SELECTION.
      PERFORM DATA_RETREVIAL.
      PERFORM BUILD_FIELDCAT.
      PERFORM DISPLAY_ALV.
    *                          Data Retrevial Logic                       *
    *&      Form  DATA_RETREVIAL
    form DATA_RETREVIAL .
    DATA: status_icon TYPE icons-text,
          icon_name(20) TYPE c,
          icon_text(10) TYPE c.
      ICON_NAME = 'ICON_RED_LIGHT'.
      ICON_TEXT = 'RED'.
      CALL FUNCTION 'ICON_CREATE'
        EXPORTING
          name                        = ICON_NAME
         TEXT                         = ICON_TEXT
    *     INFO                        = ' '
         ADD_STDINF                   = 'X'
       IMPORTING
         RESULT                       = STATUS_ICON
       EXCEPTIONS
         ICON_NOT_FOUND               = 1
         OUTPUTFIELD_TOO_SHORT        = 2
         OTHERS                       = 3
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SELECT PSPNR
             PSPID
             POST1
             OBJNR
             VERNR
             VERNA
             FROM PROJ
             INTO TABLE IT_PROJ
             WHERE PSPNR IN S_PSPNR.
        SELECT PSPNR
               POSID
               POST1
               OBJNR
               PSPHI
               VERNR
               FROM PRPS
               INTO TABLE IT_PRPS
               FOR ALL ENTRIES IN IT_PROJ
               WHERE PSPHI EQ IT_PROJ-PSPNR.
          LOOP AT IT_PROJ INTO WA_PROJ.
            LOOP AT IT_PRPS INTO WA_PRPS.
              WA_FINAL-PSPNR    =  WA_PROJ-PSPNR.
              WA_FINAL-PSPID    =  WA_PROJ-PSPID.
              WA_FINAL-POST1    =  WA_PROJ-POST1.
              WA_FINAL-OBJNR    =  WA_PROJ-OBJNR.
              WA_FINAL-VERNR    =  WA_PROJ-VERNR.
              WA_FINAL-VERNA    =  WA_PROJ-VERNA.
              WA_FINAL-PSPNR_1  =  WA_PRPS-PSPNR.
              WA_FINAL-POSID    =  WA_PRPS-POSID.
              WA_FINAL-POST1_1  =  WA_PRPS-POST1.
              WA_FINAL-OBJNR_1  =  WA_PRPS-OBJNR.
              WA_FINAL-PSPHI    =  WA_PRPS-PSPHI.
              WA_FINAL-VERNR_1  =  WA_PRPS-VERNR.
              WA_FINAL-light     = STATUS_ICON.
              APPEND WA_FINAL TO IT_FINAL.
             CLEAR: WA_FINAL.
            ENDLOOP.
          ENDLOOP.
    endform.                    " DATA_RETREVIAL
    *                          Field Catalog                              *
    *&      Form  BUILD_FIELDCAT
    form BUILD_FIELDCAT .
    *  DATA: FIELDCAT    TYPE GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'LIGHTS'.
          GT_FIELDCAT-SELTEXT_M = 'STAUTS'.
          GT_FIELDCAT-COL_POS   = 0.
          GT_FIELDCAT-ICON      = 'X'.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPNR'.
          GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION(INTERNAL)'.
          GT_FIELDCAT-COL_POS   = 1.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPID'.
          GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION'.
          GT_FIELDCAT-COL_POS   = 2.
          GT_FIELDCAT-OUTPUTLEN = 24.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'POST1'.
          GT_FIELDCAT-SELTEXT_M = 'PROJECT DESC'.
          GT_FIELDCAT-COL_POS   = 3.
          GT_FIELDCAT-OUTPUTLEN = 40.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'OBJNR'.
          GT_FIELDCAT-SELTEXT_M = 'Object number'.
          GT_FIELDCAT-COL_POS   = 4.
          GT_FIELDCAT-OUTPUTLEN = 22.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'VERNR'.
          GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
          GT_FIELDCAT-COL_POS   = 5.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'VERNA'.
          GT_FIELDCAT-SELTEXT_M = 'Responsible Person Desc'.
          GT_FIELDCAT-COL_POS   = 6.
          GT_FIELDCAT-OUTPUTLEN = 25.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPNR_1'.
          GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
          GT_FIELDCAT-COL_POS   = 7.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'POSID'.
          GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
          GT_FIELDCAT-COL_POS   = 8.
          GT_FIELDCAT-OUTPUTLEN = 24.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'POST1_1'.
          GT_FIELDCAT-SELTEXT_M = 'WBS DESC'.
          GT_FIELDCAT-COL_POS   = 9.
          GT_FIELDCAT-OUTPUTLEN = 40.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'OBJNR_1'.
          GT_FIELDCAT-SELTEXT_M = 'Object number'.
          GT_FIELDCAT-COL_POS   = 10.
          GT_FIELDCAT-OUTPUTLEN = 22.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPHI'.
          GT_FIELDCAT-SELTEXT_M = 'Currnet Projct'.
          GT_FIELDCAT-COL_POS   = 11.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'VERNR_1'.
          GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
          GT_FIELDCAT-COL_POS   = 12.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
    endform.                    " BUILD_FIELDCAT
    *                          Display ALV Grid                           *
    *&      Form  DISPLAY_ALV
    form DISPLAY_ALV .
      GT_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                 = GT_REPID
    *     I_CALLBACK_PF_STATUS_SET          = ' '
    *     I_CALLBACK_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                         =
         IT_FIELDCAT                        = GT_FIELDCAT[]
    *     IT_EXCLUDING                      =
    *     IT_SPECIAL_GROUPS                 =
    *     IT_SORT                           =
    *     IT_FILTER                         =
    *     IS_SEL_HIDE                       =
    *     I_DEFAULT                         = 'X'
    *     I_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
    *     I_HTML_HEIGHT_TOP                 = 0
    *     I_HTML_HEIGHT_END                 = 0
    *     IT_ALV_GRAPHICS                   =
    *     IT_HYPERLINK                      =
    *     IT_ADD_FIELDCAT                   =
    *     IT_EXCEPT_QINFO                   =
    *     IR_SALV_FULLSCREEN_ADAPTER        =
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER           =
    *     ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = IT_FINAL
    *   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

Maybe you are looking for

  • IMac 1TB Seagate Hard Drive Replacement Program - how long does it take?

    I started a new thread for this issue since the original thread has degenerated into a rant. I just got my love letter from Apple informing me that my new 27" iMac has the bad drive. I backup to an external USB drive using Time Machine, and I am plan

  • Console One 1.3.6h Question

    Greetings, I want two members of our staff to be able to add and delete names as user come and go (we are a K-12 school). At the present, the only way they can do the job is to enable them to have security like an admin. This isn't good because I nee

  • Where can i find the shuffle playlist?

    Hi, currently i am using iTunes 9.0.2, before i update to this version, when i play shuffle, i can see a playlist mix with all shuffle songs (which i know whats next shuffle song, and if i dont like it i can simply click shuffle and it will update a

  • Standard Texts and Text Modules

    Hi, How to include standard texts and text modules in Adobe Print Forms? Is there any solution? Thanks !

  • How can I retrieve deleted emails from the trash?

    How do I retrieve deleted emails from the trash?  I have not emptied the trash.