Problem with check Box in ALV list

Hi All,
In my alv list  I am using Check box and if I enabled the check box after pressing that pushbutton its not reflecting in the internal table how can I  resolve it. 
Please find below the piece of codes
FORM user_command USING ucomm    LIKE sy-ucomm
                                             selfield TYPE slis_selfield.      
sy-ucomm = ucomm.
  CASE ucomm.
  When 'SAVE'.
            I am checking my internal table value here.
           my logic....
  When others.
  Endcase.
FORM FIELD_CATLOGUE  USING   VALUE(P_tname) "Int.table name
                              VALUE(P_fname) "Field name
                              VALUE(P_title) "Column name
                              VALUE(P_sum)   "Sum
                              VALUE(P_edit)  "Edit
                              VALUE(P_Check). " Check box
  CLEAR wa_fcat.
  wa_fcat-tabname = p_tname.
  wa_fcat-fieldname = p_fname.
  wa_fcat-seltext_l = p_title.
  wa_fcat-do_sum    = P_Sum.
  Wa_Fcat-edit      = P_Edit.
  Wa_Fcat-checkbox  = P_Check.
  Append wa_fcat to i_fcat.
  gs_user_command     type slis_formname value 'USER_COMMAND'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = i_fcat
        is_layout          = ilay
        I_DEFAULT          = 'X'
        I_SAVE             = 'A'
        I_CALLBACK_PF_STATUS_SET  = gs_user_status
        i_callback_user_command  = gs_user_command
      TABLES
        t_outtab           = it_data
      EXCEPTIONS
        program_error      = 1
        others             = 2.

Hi,
Refer this program:-
*  internal table and alv declarations
*   with one field in internal table as
*   flag(1) type c (for checkbox in alv)
*          START-OF-SELECTION
START-OF-SELECTION.
  "your select query to populate data in internal table
*          END-OF-SELECTION
END-OF-SELECTION.
*          FIELD CATALOG FOR FIRST GRID DISPLAY
  PERFORM field_catalog.
*          SORT W.R.T. WORK ORDER NUMBER FOR FIRST GRID DISPLAY
  PERFORM sort_field.
*          FOR LAYOUT FOR FIRST GRID DISPLAY
  PERFORM set_layout.
*          DISPLAY RECORDS IN ALV GRID FOR FIRST GRID DISPLAY
  PERFORM alv_display.
*&      SUBROUTINE DEFINITIONS
*&      Form  FIELD_CATALOG
*       SUB-ROUTINE FIELD_CATALOG USED TO SET THE COLUMNS FOR
*       THE ALV GRID (OUTPUT FORMAT)
*       SETS THE COLUMN NAME AND THE OUTPUT LENGTH FOR THE FIELDS
FORM field_catalog .
  wa_field-fieldname = 'FLAG'.   " name of field from internal table
  wa_field-tabname = 'IT_FINAL'. " internal table name
  wa_field-outputlen = 2.        " output length on screen
  wa_field-checkbox = c_check.   " print as checkbox
  wa_field-edit = c_check.       " make field open for input
  wa_field-seltext_l = ' '.      " header information
  APPEND wa_field TO it_field.   " append field catalog internal table
  CLEAR wa_field.                " clear field catalog work area
  wa_field-fieldname = 'AUFNR'.  " name of field from internal table
  wa_field-tabname = 'IT_FINAL'. " internal table name
  wa_field-outputlen = 20.       " output length on screen
  wa_field-seltext_l = text-003. " header information
  APPEND wa_field TO it_field.   " append field catalog internal table
  CLEAR wa_field.                " clear field catalog work area
ENDFORM.                    " FIELD_CATALOG
*&      Form  SORT_FIELD
*       SUB-ROUTINE SORT_FIELD IS USED TO SORT THE RECORDS IN THE
*       INTERNAL TABLE BASED ON THE GIVEN FIELD AND NATURE OF
*       SORTING TO BE DONE (ASCENDING OR DESCENDING)
FORM sort_field .
  wa_sort-spos = 1.             " sort priority
  wa_sort-fieldname = 'AUFNR'.  " field on which records sorted
  wa_sort-tabname = 'IT_FINAL'. " internal table name
  wa_sort-up = c_check.         " sort ascending
  APPEND wa_sort TO it_sort.    " append sort info internal table
  CLEAR wa_sort.                " clear sort info work area
ENDFORM.                    " SORT_FIELD
*&      Form  SET_LAYOUT
*       SUB-ROUTINE SET_LAYOUT IS USED TO SET THE DISPLAY OF THE
*       ALV GRID LINES IN ALTERNATIVE COLOURS
FORM set_layout .
  wa_layout-zebra = c_check.    " so set colors of line alternatively
ENDFORM.                    " SET_LAYOUT
*&      Form  ALV_DISPLAY
*       SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
*       FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
*       AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
*       DISPLAYED IN THE GRID FORMAT
FORM alv_display .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = v_rep_id       " report id
     i_callback_pf_status_set          = 'PF'           " for PF-STATUS
     i_callback_user_command           = 'USER_COMMAND' " for User-Command
     is_layout                         = wa_layout      " for layout
     it_fieldcat                       = it_field       " field catalog
     it_sort                           = it_sort        " sort info
    TABLES
      t_outtab                          = it_final      " internal table
   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.                    " ALV_DISPLAY
*&      Form  pf
*       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
*       ON WHICH THE ALV GRID IS DISPLAYED
*       -->RT_EXTAB
FORM pf USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'ZTG_STAT'.
ENDFORM.                    "pf
*&      Form  USER_COMMAND
*       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
*       AND EXECUTE THE APPROPIATE CODE
*      -->LV_OKCODE   used to capture the function code
*                     of the user-defined push-buttons
*      -->L_SELFIELD   text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
  lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
  CASE lv_okcode.
* when the function code is EXECUTE then process the selected records
    WHEN 'EXECUTE'.
* refresh it_process when user processes selected records
      REFRESH it_process.
* to reflect the data changed into internal table
      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data.
      ENDIF.
* refresh the ALV Grid output from internal table
      l_selfield-refresh = c_check.
    WHEN 'SEL_ALL'.
* to select all the records displayed in ALV Grid
      LOOP AT it_final INTO wa_final.
        wa_final-flag = 'X'.
        MODIFY it_final FROM wa_final.
      ENDLOOP.
* refresh the ALV Grid output from internal table
      l_selfield-refresh = c_check.
    WHEN 'DESEL_ALL'.
* to deselect all the records displayed in ALV Grid
      LOOP AT it_final INTO wa_final.
        wa_final-flag = ' '.
        MODIFY it_final FROM wa_final.
      ENDLOOP.
* refresh the ALV Grid output from internal table
      l_selfield-refresh = c_check.
  ENDCASE.
ENDFORM.                    "USER_COMMAND
Hope this helps you.
Regards,
Tarun.

Similar Messages

  • Problem with check box in ALV Grid Display

    I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database,  my question is after perform update operation check box should be clear.
    Kindly help me!!!!

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

  • Problem with Check box in WAD

    Hi ,
    I am creating a Check box in WAD which is a selection variable for a characteristic. I am able to get the display of all the values listed.
    Problem is : I want to have the list of values displayed with a check mark and I am not able to see where to make this setting in WAD.
    Any suggestions....
    Thanks

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

  • How to print check box in ALV list display and how to pick selected ones

    Hi
    i am displaying one ALV list dispaly. for that im adding one check box fields by filling the fieldcat as below:
      wa_fldcat-checkbox = 'X'.
      wa_fldcat-edit = 'X'.
    but the check box is showing disable mode only. i want to display that check box and if i select that check box i want pick that records. for ALV grid i found one FM to pick records of selectedones as below.
    DATA ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF ref_grid IS NOT INITIAL.
        CALL METHOD ref_grid->check_changed_data.
      ENDIF.
    but how can i do for list display to pick those selected one records.
    Can any one sugget regarding this.
    Thanks in advance.
    Rahul.

    Hi,
    Thanks. now it's enabled. but how can we pick the records from that list whichever i selected through that check box.
    i found this one for ALV grid:
    DATA ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF ref_grid IS NOT INITIAL.
        CALL METHOD ref_grid->check_changed_data.
      ENDIF.
    but how for ALV normal list display.
    Thanks.
    rahul

  • Problem with check box need an idea

    hello i need some help.
    i am tring to make a attendence register as an assignment. what i am tring to do is that i can add student name in a file and then retrive them from a file and then mark there presents or absents.the part i cant get done is how do i mark the attendence. i want to display name and then the teacher can just click in the check box infront of the name to mark the present and when he clicks on the save button it would save the attendence in the file.
    now the problem is the check box have to increase and decrease if a name is add or deleted in the file
    SO does any one have any ideas what i can do to solve this problem

    lets suppose your file contains student name which are seperted by comma or space (what ever).then u can read it and open stringtokenizer with delimater you used to seperate names.count the number of tokens and create your check box on the count of tokens.There may be some good idea too and if any one have i would like to know.

  • Vendor Master Upload Problem with Check Box

    Hi All,
    I have a problem with Vendor Master Upload program. In one of the screen of XK01 transaction depending upon the PO Box, Postal Code, Other City and Other Region i have to check the PO Box w/o no check Box. So in my program after i check the PO Box, Postal Code, Other City and Other Region values how to write a code that i can check the PO Box w/o no. Or other wise how can i send value to the Po Box w/o no check box. field
    Thanks in advance.

    The call to the first screen should look something like:
        perform dynpro
          tables bdcdata
          using:
         'X' 'SAPMF02K'     '0105',         "Create Vendor: Initial Screen
          ' ' 'RF02K-BUKRS'             'COCO',
          ' ' 'RF02K-KTOKK'             'YYYY',
          ' ' 'USE_ZAV'                 'X'.
    I'm using screen 105, not 100 here.
    Rob

  • Problems with check boxes

    I am trying to create a process Register jsp. At first, i use normal jsp method
    try
    //get all the checkboxes values from here     
    //chkno is used only to retrieve the number of checked checkboxes
         String chkno[] = request.getParameterValues("hobbies");
    //using a while loop to retrieve the value + execute it to the database.
    int i = 0;
    int Rs2;
    String statement; //sql statement
    Statement SL2 = Conn.createStatement();
    while (chkno!=null && i < chkno.length)
    //get the specific array item
         String hobbies = request.getParameterValues("hobbies");
    //set up database related area
         try
              statement = "insert into memhobby values ('"+memid+"','"+hobbies+"')";
              Rs2 = SL2.executeUpdate(statement);
                   catch(Exception ex)
                   out.println(ex);
    //increment the i counter
              ++i;
    SL2.close();
    catch(Exception e){
    out.println(e);
    this one to retrieve check boxes values and insert into database. it works
    after that, i created javabean for connection. dbConnection, and dbHobby, which will make use of dbConnection and insert values into database.
    So, i use this method
    try
    //get all the checkboxes values from here     
    //chkno is used only to retrieve the number of checked checkboxes
         String chkno[] = request.getParameterValues("hobbies");
    //using a while loop to retrieve the value + execute it to the database.
    int i = 0;
    while (chkno!=null && i < chkno.length)
    //get the specific array item
         String listhobbies = request.getParameterValues("hobbies")[i];
         int hobbies = Integer.parseInt(listhobbies);
    //set up database related area
         try
              dbHobby.setHobbyMemId(memID);
              dbHobby.setHobbyHobbyId(hobbies);
              dbHobby.insertHobby();
                   catch(Exception ex)
                   out.println(ex);
    //increment the i counter
              ++i;
    catch(Exception e){
    out.println(e);
    it should works the same, but the problem now i having is, only the first check box values will be insert. the loop seem not to work anymore. why is that so?
    can anyone please help me?

    try to initialize all you variable first before parsing any value to it.
    eg:
    String hobby= "";
    hobby = request.getParameterValues("hobbies")!=null?request.getParameterValues("hobbies"):"";
    the nullPointerException due to your field("hobbies") is null and cannot set into String datatype.
    This may help.

  • Problem with check-box

    Hi all,
    I am using flash CS3 and working on flash and ActionScript
    3.0.
    In a flash application(.swf file), I have "3
    images"(converted to movieclips) in 3 different layers, "a
    combo-box"(which displays a specific image upon selection in the
    combo-box) and "a check-box".
    The Functionality of Combo-box is: If we select an image
    from combo-box,then a specific image is viewed on output upon
    selection. Now, if we click on the image appeared, then there
    appears a circle(dot) on the image at (evnt.localX,evnt.localY)
    pixel position [I had written ActinScript 3.0 code for this task].
    This occurs for all the 3 layers(i.e., on selection of the 3
    images).
    The Functionality of Check-box is: If check-box is
    "selected", it shows dots(circles) and if "not_selected" no dots
    are visible(It means, it hides the dots /circles) on the specific
    image.
    " I think you had understood that---- dots/circles placed on
    one image should not be visible when other image is viewed".
    If I change the selection of combo-boxes (i.e., image is
    changed) and when the check-box is selected, then it is showing all
    the dots(circles) of all three images. But, it should show only the
    specific dots(circles) that are obtained when clicked on specific
    image(i.e., specific selection from combo-box).
    Here, instances of our application are as follows(These all
    are Movie-Clip instances):
    Say, for 3 images: mc_image, mc_image2, mc_image3.
    for combo-box: mc_Combobox.
    for check-box: mc_Checkox.
    Here, the functionality of Check-box is what i need. When we
    select the check-box,It must show only the
    dots/circles that are related to the image which is selected
    from combo-box.
    How to do this?
    I am new to flash and ActionScript 3.0. Please help me....
    Thanks in advance.
    Text

    Hi Srihari.Ch,
    I dont know how it should work for only one circle and not
    for others??
    because as per my understanding each time a circle is drawn
    the same code is going to execute so how can it skip the condition
    in the if block for second time onwards.....
    Let me know if there is an understanding gap in your code and
    me...
    Also as a second thaught you can attach the event listener
    for the MouseEvent.CLICK
    only when the check box is clicked... you can track this by
    using a change event for checkboxes
    so your code will be
    myCheckBox.addEventListener(Event.CHANGE, addClickEvent);
    function addClickEvent(evnt:Event)
    //here check and attach mouse event listener for click event.
    if(evnt.target.selected)
    //Consider that myImageHolderMovieClip is the movieclip where
    you //have loaded an Image
    myImageHolderMovieClip.addEventListener(MouseEvent.CLICK,
    drawAcircle);
    else
    myImageHolderMovieClip.removeEventListener(MouseEvent.CLICK,
    drawAcircle);
    Also if this doesn't solve your problem please send me your
    code [fla and AS3 files] on my mail ID [email protected] i
    will try and give the reply as soon as possible.

  • I am having a problem with check boxes showing as all selected after downloading as a pdf after individual submits their form with just a few actually selected.

    The forms themselves don't have all the boxes checked when viewed in FormsCentral. It is only after I download it as a pdf that the problem occurs. I have to check and uncheck each box in the FormsCentral in order to not have that occur. Any suggestions?

    Hi sdwinter,
    Please help us with the step by step workflow to replicate the issue for better assistance on this.
    Thanks,
    Vikrantt Singh

  • ALV with Check Boxes

    Can I get a sample program of ALV (oops) with check boxes in it. thank you.

    Types: begin of lt_io.
    include structure mara. " Your Structure
    Types: style_table type lvc_t_style.
    Types: end of lt_io.
    data: lt_io type table of lt_io,
    ls_layout type lvc_s_layo,
    lt_fcat type lvc_t_fcat,
    lo_grid type ref to cl_gui_alv_grid.
    field-symbols: <io> type lt_io,
    <fcat> type lvc_s_fcat.
    ... fill your output table ....
    ls_layout-stylefname = 'STYLE_TABLE'.
    loop at lt_io assigning <io>.
    PERFORM set_style USING 'CHECKBOX' "Your Filename
    CHANGING <io>.
    endloop.
    ... Fill Your Field Catalog lt_fcat
    read table lt_fcat assigning <fcat>
    where fieldname = 'CHECKBOX'.
    <fcat>-checkbox = 'X'.
    create grid control lo_grid.
    CALL METHOD lo_grid->set_table_for_first_display
    EXPORTING
    is_layout = ls_layout
    CHANGING
    it_fieldcatalog = lt_fcat
    it_outtab = lt_io[].
    FORM set_button_to_line
    USING iv_fieldname TYPE lvc_fname
    CHANGING cs_io TYPE io.
    DATA: ls_style TYPE lvc_s_styl,
    lt_style TYPE lvc_t_styl.
    ls_style-fieldname = iv_fieldname.
    if cs_io-checkbox = ' '.
    ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
    else.
    ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
    endif.
    ls_style-maxlen = 2.
    INSERT ls_style INTO TABLE io-style_table.
    ENDFORM. "set_icon_to_status_line
    [/code].
    A classical report is a program that generates a single list, which must contain all of the required detail information.
    1) This procedure may result in extensive lists from which the user has to pick the relevant data.
    2) For background processing, this is the only possible method. After starting a background job, there is no way of influencing the program.
    3) The desired selections must be made beforehand and the list must provide detailed information.
    4) For dialog sessions, there are no such restrictions.
    5) The user is present during the execution of the program and can control and manipulate the program flow directly.
    6) To be able to use all advantages of the online environment, classical reporting was developed into interactive reporting.
    ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain up to 90 columns in the display with the wide array of display options.
    Advantages.
    Collapse multiple reports into one, drastically cutting down your report development time
    Save many hours using built-in ALV sorting, subtotaling and filtering capabilities
    Add conditional structures into your ALV report: No programming required!
    Combine ALV with display variants to meet a wide range of reporting requirements more easily
    Dynamically reorder column layouts and add/subtract fields
    Enable users and analysts to save their own personalized variants
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
    iii. I_callback_user_command : routine where the function codes are handled
    iv. I_structure name : name of the dictionary table
    v. Is_layout : structure to set the layout of the report
    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table
    iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
    declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events
    for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
    Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block
    II. it_fieldcat : field catalog
    III. i_tabname : internal table name with output data
    IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the
    output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field
    names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output
    ii. t_outtab_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary)
    E. ref_tabname : table (dictionary)
    F. key(1) : column with key-color
    G. icon(1) : icon
    H. symbol(1) : symbol
    I. checkbox(1) : checkbox
    J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    declarations for spl.group.
    GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV
    GT_SORT TYPE SLIS_T_SORTINFO_ALV, "for sort
    DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
      CLEAR LS_SORT.
      LS_SORT-FIELDNAME = 'FIELD1'.
      LS_SORT-SPOS      = 1.
      LS_SORT-UP        = 'X'.
      ls_sort-subtot    = 'X'. "subtotal
      APPEND LS_SORT TO E06_LT_SORT.
      APPEND LS_SORT TO E06_LT_SORT.
      LS_SORT-FIELDNAME = 'FIELD2'.
      LS_SORT-SPOS      = 2.
      LS_SORT-UP        = 'X'.
      ls_sort-subtot    = 'X'. "subtotal
      APPEND LS_SORT TO E06_LT_SORT.
    for creating the group..
      DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
      CLEAR  LS_SP_GROUP.
      LS_SP_GROUP-SP_GROUP = 'A'.
      LS_SP_GROUP-TEXT     = TEXT-005.
      APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
    and pass this info to FM...
    layout-sUBTOTALS_TEXT = 'SUbt...'
    and pass spl group info to fieldcatalog also...
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM      = G_REPID
                IS_LAYOUT               = GS_LAYOUT
                IT_FIELDCAT             = GT_FIELDCAT[]
                IT_SPECIAL_GROUPS       = GT_SP_GROUP[]
                IT_SORT                 = GT_SORT[]
    TYPES :
      BEGIN OF ty_vbak,
        vkorg TYPE vbak-vkorg,             " Sales organization
        kunnr TYPE vbak-kunnr,             " Sold-to party
        vbeln TYPE vbak-vbeln,             " Sales document
        netwr TYPE vbak-netwr,             " Net Value of the Sales Order
        waerk TYPE vbak-waerk,             " Document currency
      END OF ty_vbak.
    DATA:
      vbak    TYPE vbak,
      gt_vbak TYPE TABLE OF ty_vbak.
    SELECT-OPTIONS :
      s_vkorg FOR vbak-vkorg,              " Sales organization
      s_kunnr FOR vbak-kunnr,              " Sold-to party
      s_vbeln FOR vbak-vbeln.              " Sales document
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
    PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
         Form  f_read_data
    FORM f_read_data.
      SELECT vkorg kunnr vbeln netwr waerk
          UP TO p_max ROWS
        INTO TABLE gt_vbak
        FROM vbak
       WHERE kunnr IN s_kunnr
         AND vbeln IN s_vbeln
         AND vkorg IN s_vkorg.
    ENDFORM.                               " F_READ_DATA
         Form  f_display_data
    FORM f_display_data.
      TYPE-POOLS: slis.                    " ALV Global types
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                  
    Check out these sample programs
    BCALV_GRID_01
    This program illustrates how the events for print processing PRINT_TOP_OF_PAGE,
    PRINT_END_OF_PAGE, PRINT_TOP_OF_LIST,PRINT_END_OF_LIST are handled. The
    corresponding handler methods control the appearance of the list printed.
    BCALV_GRID_02
    Show a detail list in an amodal window. There is no second dynro needed in contrast to
    BCALV_GRID_03.
    BCALV_GRID_03
    This program implements a function on event DOUBLE_CLICK. According to the selected line data
    from table SBOOK is selected and displayed by a second ALV Control in a dialog dynpro.
    BCALV_GRID_04
    Illustrates the use of exceptions (lights or leds). According to the values of SFLIGHT-SEATSOCC, the
    lights are set to 1 (red), 2 (yellow) or 3 (green).
    BCALV_GRID_05
    Demonstrate the creation of an own toolbar button.
    BCALV_GRID_06
    Demonstrate the creation of an own context menu.
    BCALV_GRID_07
    Append a menu button to the standard toolbar.
    BCALV_GRID_08
    Append a menu with default button to the standard toolbar. It is exactly the same as
    BCALVC_TB_WITH_MENU except for methods HANDLE_MENU_BUTTON and HANDLE_TOOLBAR.
    Editable ALV grids
    BCALV_EDIT_01
    This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
    BCALV_EDIT_02
    This report illustrates how to set chosen cells of an ALV Grid Control editable.
    BCALV_EDIT_03
    In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
    The report checks the input value(s) semantically and provides protocol messages in case of error
    BCALV_EDIT_04
    This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
    implement the saving of the new data.
    BCALV_EDIT_05
    This example shows how to use checkboxes within an ALV Grid Control. You learn:
    (1) how to define a column for editable checkboxes for an attribute of your list
    (2) how to evaluate the checked checkboxes
    (3) how to switch between editable and non-editable checkboxes
    BCALV_EDIT_06
    This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
    Grid Control.
    BCALV_EDIT_07
    This example shows how to define dropdown listboxes for particular cells of your output table.
    BCALV_EDIT_08
    This report implements an ALV Grid Control with an application specific F4 help. The following aspects
    are dealt with:
    (1) how to replace the standard f4 help
    (2) how to pass the selected value to the ALV Grid Control
    (3) how to build an f4 help, whose value range depend on a value of another cell.
    Check this link tooo
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/07/23/oopsALVin+ABAP&showComments=true
    The ALV Grid Control is a tool with which you can output non-hierarchical lists in a
    standardized format. The list data is displayed as a table on the screen.
    The ALV Grid Control offers a range of interactive standard list functions that users need
    frequently (find, sort, filter, calculate totals and subtotals, print, print preview, send list,
    export list (in different formats), and so on. These functions are implemented in the
    proxy object class. You as the programmer have the possibility to turn off functions not
    needed. In most cases the implementations of the standard functions provided by the
    control are sufficient. However, if required, you can adjust these implementations to
    meet application-specific needs.
    You can add self-defined functions to the toolbar, if necessary.
    The ALV Grid Control allows users to adjust the layout of lists to meet their individual
    requirements (for example, they can swap columns, hide columns, set filters for the
    data to be displayed, calculate totals, and so on). The settings (list customizing) made
    by a specific user are called a display variant. Display variants can be saved on a userspecific
    or on a global basis. If such display variants exist for a list, they can be offered
    to the user for selection. If a display variant is set as the default variant, the associated
    list is always displayed based on the settings of this variant.
    2. REUSE_ALV_LIST_DISPLAY
    REUSE_ALV_GRID_DISPLAY
    REUSE_ALV_FIELDCATALOG_MERGE
    REUSE_ALV_COMMENTARY_WRITE
    3. Use of Field Catalog is to determines the technical properties & add formating information of the column.
    6. all the definition of internal table, structure, constants are declared in a type-pool called SLIS.
    7.fieldcat-fieldname
    fieldcat-ref_fieldname
    fieldcat-tabname
    fieldcat-seltext_m
    5. Form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.
    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
    In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
    The report output can contain up to 90 columns in the display with the wide array of display options.
    The commonly used ALV functions used for this purpose are;
    1. REUSE_ALV_VARIANT_DEFAULT_GET
    2. REUSE_ALV_VARIANT_F4
    3. REUSE_ALV_VARIANT_EXISTENCE
    4. REUSE_ALV_EVENTS_GET
    5. REUSE_ALV_COMMENTARY_WRITE
    6. REUSE_ALV_FIELDCATALOG_MERGE
    7. REUSE_ALV_LIST_DISPLAY
    8. REUSE_ALV_GRID_DISPLAY
    9. REUSE_ALV_POPUP_TO_SELECT
    Purpose of the above Functions are differ not all the functions are required in all the ALV Report.
    But either no.7 or No.8 is there in the Program.
    How you call this function in your report?
    After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.
    Then use follwing function module.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = 'Prog.name'
    I_STRUCTURE_NAME = 'I_ITAB'
    I_DEFAULT = 'X'
    I_SAVE = 'A'
    TABLES
    T_OUTTAB = I_ITAB.
    IF SY-SUBRC <> 0.
    WRITE: 'SY-SUBRC: ', SY-SUBRC .
    ENDIF.
    ENDFORM. " GET_FINAL_DATA
    The object F_IT_ALV has a field, the activity ACTVT, which can
    contain four permitted values: 01, 02, 03 and 70. Each of the
    activities 01, 02 and 70 controls the availability of particular
    functions (in the menu and the toolbar) of the ALV line item list:
    a) 01: "Settings -> Display variant -> Save..."
    b) 02: "Settings -> Display variant -> Current..." and
    "Settings -> Display variant -> Current header rows "
    c) 70: "Settings -> Display variant -> Administration..."
    Activity 03 corresponds to the minimum authorization, which is the
    most restricted one: The user can only select layouts which have
    been configured already. In particular, all of the other functions
    named above are inactive with activity 03.
    Now if you want to permit a user to change the column selection and
    the headers as well as to save the layout thus created, for example,
    but if you do not want to permit the user to administrate the
    layouts, you grant him or her the authorization for activities 01
    and 02.
    Check this link it will be mosty usefull for u
    http://www.sap-img.com/fu017.htm
    check this link
    http://abapprogramming.blogspot.com/
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
    Changing width of a custom container dynamically
    Display Page numbers in ALV
    Insert picture in selection screen.
    Logo in OO ALV Grid
    check these links
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Try these links
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    For More alv report examples check these Tcodes LIBS, BIBS Here u can find more number of examples on alv reports of different kinds
    check this sample code for intercative alv report
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 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.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        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  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH

  • Check box in ALV BLOCK List

    Hi All,
    iam Using ALV BLOCK list to print the output along with check boxes, iam able to print the output along with the check boxes but when i select any of the check box and click button on application tool bar it is going to dump  and saying,
    FIELD SYMBOL HAS NOT YET BEEN ASSIGNED.
    i populated layout with following fields.
      w_layout-box_fieldname = 'BOX'.
      w_layout-box_tabname = 'T_FINAL2'.
    Plz Help me out.
    Thanks in Advance.
    Neha

    *& Report  BCALV_TEST_BLOCK_LIST
    report  bcalv_test_block_list.
    types: g_ty_t_carrid  type standard table of alv_tab,
           g_ty_t_connid  type standard table of alv_chck,
           g_ty_t_curr    type standard table of alv_cur,
           g_ty_s_sflight type alv_t_t2,
           g_ty_s_carrid  type alv_tab,
           g_ty_s_connid  type alv_chck,
           g_ty_s_curr    type alv_cur.
    constants: con_sflight type lvc_fname value 'ALV_T_T2',
               con_scarr   type lvc_fname value 'ALV_TAB',
               con_spfli   type lvc_fname value 'ALV_CHCK',
               con_scurx   type lvc_fname value 'ALV_CUR',
               con_event_01 type lvc_fname value 'PF_STATUS_SET',
               con_event_02 type lvc_fname value 'USER_COMMAND',
               con_event_03 type lvc_fname value 'CALLER_EXIT',
               con_event_04 type lvc_fname value 'LIST_MODIFY',
               con_event_05 type lvc_fname value 'BEFORE_LINE_OUTPUT',
               con_event_06 type lvc_fname value 'AFTER_LINE_OUTPUT',
               con_event_07 type lvc_fname value 'SUBTOTAL_TEXT',
               con_event_08 type lvc_fname value 'REPREP_MODIFY',
               con_event_09 type lvc_fname value 'TOP_OF_PAGE',
               con_event_10 type lvc_fname value 'END_OF_PAGE',
               con_event_11 type lvc_fname value 'TOP_OF_LIST',
               con_event_12 type lvc_fname value 'END_OF_LIST',
               con_event_13 type lvc_fname value 'TOP_OF_COVERPAGE',
               con_event_14 type lvc_fname value 'END_OF_COVERPAGE',
               con_event_15 type lvc_fname value 'TOP_OF_FOREIGN_PAGE',
               con_event_16 type lvc_fname value 'END_OF_FOREIGN_PAGE',
               con_event_17 type lvc_fname value 'GROUPLEVEL_CHANGE'.
    DATA                                                                 *
    tables: sscrfields.   " for processing the FCODEs in Selektion screens
    include <icon>.
    include <symbol>.
    type-pools: slis, kkblo.
    types: g_ty_t_icon  type standard table of icon,
           g_ty_t_icont type standard table of icont,
           begin of g_ty_s_plane,
             carrid    type g_ty_s_sflight-carrid,
             connid    type g_ty_s_sflight-connid,
             planetype type g_ty_s_sflight-planetype,
             seatsmax  type g_ty_s_sflight-seatsmax,
           end   of g_ty_s_plane,
           g_ty_t_plane type sorted table of g_ty_s_plane
                             with unique key carrid connid,
           begin of g_ty_s_fcat_curr,
             fieldname  type lvc_fname,
             cfieldname type lvc_fname,
             currency   type lvc_s_fcat-currency,
           end   of g_ty_s_fcat_curr,
           g_ty_t_fcat_curr type sorted table of g_ty_s_fcat_curr
                                 with unique key fieldname,
           begin of g_ty_s_sort.
    include type slis_sortinfo_alv.
    types: end   of g_ty_s_sort,
           g_ty_t_sort type sorted table of g_ty_s_sort
                            with unique key spos fieldname,
           begin of g_ty_s_test,
             list_amount              type num1,
             select_amount            type i,
             only_db_info             type char1,
             db_short                 type char1,
             excp_display             type char1,
             excp_condense            type char1,
             layo_title               type lvc_s_layo-grid_title,
             layo_zebra               type char1,
             layo_no_vert_lines       type char1,
             layo_no_horiz_lines      type char1,
             layo_cell_merge          type char1,
             layo_count               type char1,
             layo_box                 type char1,
             layo_no_colhead          type char1,
             layo_column_optimize     type char1,
             layo_keys_hotspot        type char1,
             layo_no_keyfix           type char1,
             layo_no_hotspot          type char1,
             layo_hotspot_rows        type i occurs 0,
             layo_hotspot_columns     type lvc_fname occurs 0,
             layo_no_scrolling        type char1,
             layo_no_authcheck        type char1,
             layo_no_min_linesize     type char1,
             layo_min_linesize        type sylinsz,
             layo_max_linesize        type sylinsz,
             layo_group_change_edit   type char1,
             layo_get_selinfo         type char1,
             layo_confirmation_prompt type char1,
             layo_f2code              type syucomm,
             layo_reprep              type char1,
             sum_before               type char1,
             sum_no_sumline           type char1,
             sum_no_sumchoice         type char1,
             sum_numc                 type char1,
             sum_no_unitsplit         type char1,
             sum_totals_only          type char1,
             sum_totals_text          type symsgli,
             sum_no_subtotals         type char1,
             sum_no_subchoice         type char1,
             sum_subtotals_text       type symsgli,
             prnt_print               type char1,
             prnt_reserve_lines       type lvc_s_prnt-reservelns,
             prnt_no_listinfo         type char1,
             prnt_no_selinfo          type char1,
             prnt_with_title          type char1,
             prnt_footline            type lvc_s_prnt-footline,
             prnt_printinfo           type char1,
             prnt_no_coverpage        type char1,
             prnt_no_new_page         type char1,
             prnt_no_change_print_params type char1,
             color_rows               type i occurs 0,
             color_fields_column      type lvc_fname occurs 0,
             color_fields_cell        type lvc_fname occurs 0,
             fcat_no_out_fields       type lvc_fname occurs 0,
             fcat_tech_fields         type lvc_fname occurs 0,
             fcat_fix_column_fields   type lvc_fname occurs 0,
             fcat_do_sum_fields       type lvc_fname occurs 0,
             fcat_no_sum_fields       type lvc_fname occurs 0,
             fcat_curr_fields         type g_ty_t_fcat_curr,
             curr_amount              type i,
             curr_space               type char1,
             t_sort                   type g_ty_t_sort,
             no_info_popup            type char1,
             info_popup_once          type char1,
             events_info_popup        type lvc_fname occurs 0,
             events                   type lvc_fname occurs 0,
             buffer_active            type char1,
             bypassing_buffer         type char1,
           end   of g_ty_s_test,
           begin of g_ty_s_outtab.
    include type g_ty_s_sflight.
    types:   list                 type num1,
             box                  type char1,
             count                type i,
             lights               type char1,
             checkbox             type char1,
             hotspot              type char1,
             color(4)             type c,
             tabcolor             type slis_t_specialcol_alv,
             price2               type g_ty_s_sflight-price,
             currency2            type g_ty_s_sflight-currency,
             char(10)             type c,
             string               type string,
             int1                 type int1,
             int2                 type int2,
             int4                 type int4,
             numc(10)             type n,
             dec(10)              type p decimals 2,
             fltp                 type f,
             dats                 type d,
             tims                 type t,
             icon                 type icon-id,
             icon_qinfo           type icon-name,
             symbol               type icon-id,
           end   of g_ty_s_outtab,
           g_ty_t_outtab type table of g_ty_s_outtab.
    constants: con_true         type char1 value 'X',
               con_ok   type sy-ucomm value 'OK',
               con_exit type sy-ucomm value 'EXIT',
               con_canc type sy-ucomm value 'CANC',
               con_back type sy-ucomm value 'BACK'.
    data: gt_outtab1 type g_ty_t_outtab,
          gt_outtab2 type g_ty_t_outtab,
          gt_outtab3 type g_ty_t_outtab,
          gt_outtab4 type g_ty_t_outtab,
          gt_outtab5 type g_ty_t_outtab,
          gt_outtab6 type g_ty_t_outtab,
          gt_outtab7 type g_ty_t_outtab,
          gt_outtab8 type g_ty_t_outtab,
          gt_outtab9 type g_ty_t_outtab.
    data: gt_outtab   type g_ty_t_outtab with header line,
          gs_test     type g_ty_s_test.
    data: g_repid     type sy-repid.
    data: g_field     type lvc_s_fcat-fieldname,
          g_int_field type i.
          CLASS random DEFINITION
    class random definition.
      public section.
        types:
          value(16) type p decimals 0,
          numcv(15) type n.
        constants:
          max type random=>value value 4294967295.
        class-methods:
      computes a random natural number from the set {0, ..., random=>max}.
          number returning value(rval) type random=>value,
      computes a random character from the set {A-Za-z0-9}
          c returning value(rval) type char01,
      computes a random string consisting of "len" random characters
          string importing len type i
                 returning value(rval) type string,
      computes a date
          dats returning value(rval) type d,
      computes a time
          time returning value(rval) type t,
      computes a random numc from the set {low, ..., high}
          numc importing low type random=>numcv high type random=>numcv
            returning value(rval) type random=>numcv,
      computes a random integer from the set {low, ..., high}
          i importing low type i high type i
            returning value(rval) type i,
      computes a random integer from the set {low, ..., high}
          int2 importing low type int2 high type int2
               returning value(rval) type int2,
      computes a random integer from the set {low, ..., high}
          int1 importing low type int1 high type int1
               returning value(rval) type int1,
      computes a random float from the interval [low ; high]
          f importing low type f high type f
            returning value(rval) type f,
      computes a random character from the set {A-F0-9}
          hex returning value(rval) type char01,
      computes a random character from the set {0-1}
          x returning value(rval) type char01,
      method "random=>class_constructor"
          class_constructor.
      private section.
        class-data:
      precomputed maximal index (= string length - 1) of "random=>chars"
      or of "random=>x_data".
          charsmax type i,
          xmax type i,
      random number seed value.
      (Used in method "random=>number".)
          seed type random=>value.
        constants:
      characters for class-method "random=>hex"
          hex_data(100) type c value 'ABCDEF' &
                                     '0123456789',
      characters for class-method "random=>x"
          x_data(100) type c value '01',
      characters for class-metshod "random=>c"
          chars(100) type c value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' &
                                  'abcdefghijklmnopqrstuvwxyz' &
                                  '0123456789'.
    endclass.                    "random DEFINITION
          CLASS random IMPLEMENTATION
    class random implementation.
    implementation of the methods for randomizing the values
      method x.
        data: ri type i.
        ri = random=>i( low = 0  high = random=>xmax ).
        move x_data+ri(1) to rval.
      endmethod.                    "x
      method hex.
        data: ri type i.
        ri = random=>i( low = 0  high = random=>charsmax ).
        move hex_data+ri(1) to rval.
      endmethod.                    "hex
      method number.
        constants:
          a(3) type p  value 67301,        " Coefficient
          c(1) type p  value 1,            " Increment
          m(6) type p  value 4294967296.   " Modulus 2**32
        random=>seed = ( a * random=>seed + c ) mod m.
        rval = random=>seed.
      endmethod.                    "number
      method c.
        data:
          ri type i.
        ri = random=>i( low = 0  high = random=>charsmax ).
        move chars+ri(1) to rval.
      endmethod.                    "c
      method string.
        data:
          char(1) type c.
        clear rval.
        do len times.
          char = random=>c( ).
          concatenate rval char into rval.
        enddo.
      endmethod.                    "string
      method dats.
        data: l_date      type sy-datum,
              l_day(2)    type n,
              l_month(2)  type n,
              l_year(4)   type n,
              l_value     type random=>numcv,
              l_low       type random=>numcv,
              l_high      type random=>numcv.
        l_year  = sy-datum+0(4).
        l_low   = l_year - 5.
        l_high  = l_year + 5.
        l_value = random=>numc( low = l_low high = l_high ).
        l_year  = l_value+11(4).
        l_value = random=>numc( low = 1 high = 12 ).
        l_month = l_value+13(2).
        case l_month.
          when 2.
            l_high = 28.
          when 4 or 6 or 9 or 11.
            l_high = 30.
          when others.
            l_high = 31.
        endcase.
        l_value = random=>numc( low = 1 high = l_high ).
        l_day   = l_value+13(2).
        l_date+0(4) = l_year.
        l_date+4(2) = l_month.
        l_date+6(2) = l_day.
        rval = l_date.
      endmethod.                    "dats
      method time.
        data: l_time      type t,
              l_hour(2)   type n,
              l_min(2)    type n,
              l_sec(2)    type n,
              l_value     type random=>numcv.
        l_value = random=>numc( low = 0 high = 60 ).
        l_sec   = l_value+13(2).
        l_value = random=>numc( low = 0 high = 60 ).
        l_min   = l_value+13(2).
        l_value = random=>numc( low = 1 high = 24 ).
        l_hour  = l_value+13(2).
        l_time+0(2) = l_hour.
        l_time+2(2) = l_min.
        l_time+4(2) = l_sec.
        rval = l_time.
      endmethod. "time
      method numc.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method i.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method int2.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method int1.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method f.
      Go from {0,...,random=>max} to [low;high]
        rval = ( ( high - low ) * random=>number( ) ) / random=>max
               + low.
      endmethod.                    "f
      method class_constructor.
        charsmax = strlen( chars ) - 1.
        xmax = strlen( x_data ) - 1.
        seed = 1.
      endmethod.                    "class_constructor
    endclass.                    "random IMPLEMENTATION
    SELECTION-SCREEN                                                     *
    selection-screen begin of block gen with frame.
    parameters:
    p_amount type i default 30,
    p_dbinfo as checkbox,
    p_dbshrt as checkbox.
    selection-screen end of block gen.
    parameters:
    p_list type num1 default 3.
    selection-screen begin of block tit with frame title text-tit.
    parameters:
    p_tit01 type lvc_s_layo-grid_title default text-p01. "TITLE
    selection-screen end of block tit.
    selection-screen begin of block lay with frame title text-lay.
    parameters:
    p_lay01 as checkbox. "ZEBRA
    selection-screen skip.
    parameters:
    p_lay02 as checkbox, "NO HORIZONTAL LINES
    p_lay03 as checkbox. "NO VERTICAL LINES
    selection-screen skip.
    parameters:
    p_lay04 as checkbox. "NO SCROLLING
    selection-screen skip.
    parameters:
    p_lay06 type syucomm,                                       "F2CODE
    p_lay07 as checkbox. "CONFIRMATION PROMPT
    selection-screen end of block lay.
    selection-screen begin of block spa with frame title text-spa.
    parameters:
    p_spa01 as checkbox, "BOX
    p_spa02 as checkbox, "COUNT FELD
    p_spa03 as checkbox, "NO COLUMN HEADERS
    p_spa04 as checkbox. "COLUMN OPTIMIZE
    selection-screen begin of block hot with frame title text-hot.
    parameters:
    p_hot01 as checkbox. "NO HOTSPOT
    parameters:
    p_hot02 as checkbox. "Hotspot auf Zeilenebene
    select-options:
    p_hotf02 for g_int_field no intervals default 1.
    parameters:
    p_hot03 as checkbox.
    select-options:
    p_hotf03 for g_field no intervals.
    selection-screen end of block hot.
    selection-screen begin of block mrg with frame title text-mrg.
    parameters:
    p_mrg01 radiobutton group mrge, "Default
    p_mrg02 radiobutton group mrge, "kein Merge
    p_mrg03 radiobutton group mrge. "Merge
    selection-screen end of block mrg.
    selection-screen begin of block out with frame title text-out.
    parameters:
    p_out01 as checkbox.
    select-options:
    p_outf01 for g_field no intervals.
    selection-screen end of block out.
    selection-screen begin of block tec with frame title text-tec.
    parameters:
    p_tec01 as checkbox.
    select-options:
    p_tecf01 for g_field no intervals.
    selection-screen end of block tec.
    selection-screen begin of block fix with frame title text-fix.
    parameters:
    p_fix01 as checkbox.
    select-options:
    p_fixf01 for g_field no intervals.
    selection-screen end of block fix.
    selection-screen begin of block txt with frame title text-txt.
    selection-screen pushbutton /1(50) text-pb2 user-command pb02.
    selection-screen end   of block txt.
    selection-screen begin of block cur with frame title text-cur.
    parameters:
    p_curanz type i,
    p_curspc as checkbox default space.
    selection-screen skip.
    select-options:
    p_curf00 for g_field no intervals.
    parameters:
    p_cur01 radiobutton group cur default 'X',
    p_curf01 type lvc_s_fcat-fieldname.
    parameters:
    p_cur02 radiobutton group cur,
    p_curf02 type g_ty_s_sflight-currency.
    selection-screen end of block cur.
    selection-screen begin of block sort with frame title text-srt.
    selection-screen pushbutton /1(20) text-pb1 user-command pb01.
    selection-screen end   of block sort.
    selection-screen end of block spa.
    selection-screen begin of block key with frame title text-key.
    parameters:
    p_key01 as checkbox, "KEYFELDER ALS HOTSPOT
    p_key02 as checkbox. "NO KEY FIXIERUNG
    selection-screen end of block key.
    selection-screen begin of block exp with frame title text-exp.
    parameters:
    p_excp01 as checkbox, "EXCEPTION
    p_excp_c as checkbox. "EXCEPTION CONDENSE
    selection-screen end of block exp.
    selection-screen begin of block sum with frame title text-sum.
    parameters:
    p_sum01 as checkbox, "SUM BEFORE
    p_sum02 as checkbox, "NUMC
    p_sum03 as checkbox, "NO UNITSPLIT
    p_sum04 as checkbox, "TOTALS ONLY
    p_sum05 as checkbox, "NO SUMCHOICE
    p_sum06 as checkbox, "NO SUMLINE
    p_sum07 type sy-msgli, "TOTALS TEXT
    p_sum08 as checkbox, "NO SUBCHOICE
    p_sum09 as checkbox, "NO SUBTOTALS
    p_sum10 type sy-msgli. "SUBTOTALS TEXT
    selection-screen begin of block dos with frame title text-dos.
    parameters:
    p_dos01 as checkbox.
    select-options:
    p_dosf01 for g_field no intervals.
    selection-screen end of block dos.
    selection-screen begin of block nos with frame title text-nos.
    parameters:
    p_nos01 as checkbox.
    select-options:
    p_nosf01 for g_field no intervals.
    selection-screen end of block nos.
    selection-screen end of block sum.
    selection-screen begin of block col with frame title text-col.
    parameters:
    p_col01 as checkbox.
    select-options:
    p_colf01 for g_int_field no intervals default 1.
    parameters:
    p_col02 as checkbox.
    select-options:
    p_colf02 for g_field no intervals.
    parameters:
    p_col03 as checkbox.
    select-options:
    p_colf03 for g_field no intervals.
    selection-screen end of block col.
    selection-screen begin of block prn with frame title text-prn.
    parameters:
    p_lpr01 as checkbox default 'X'. "GROUP CHANGE EDIT
    selection-screen skip.
    parameters:
    p_lpr02 as checkbox. "GET SELINFO
    selection-screen skip.
    parameters:
    p_lpr03 as checkbox, "NO MIN LINESIZE
    p_lpr04 type sylinsz, "MIN LINESIZE
    p_lpr05 type sylinsz. "MAX LINESIZE
    selection-screen skip.
    parameters:
    p_prn01 as checkbox, "PRINT
    p_prn02 type lvc_s_prnt-reservelns, "RESERVE LINES
    p_prn03 as checkbox, "NO LISTINFO
    p_prn04 as checkbox, "NO SELINFO
    p_prn05 as checkbox, "TITEL
    p_prn06 type lvc_s_prnt-footline, "FOOTLINE
    p_prn07 as checkbox, "PRINT INFO
    p_prn08 as checkbox, "NO COVERPAGE
    p_prn09 as checkbox, "NO NEW PAGE
    p_prn10 as checkbox. "NO CHANGE PRINT PARAMS
    selection-screen end of block prn.
    selection-screen begin of block evt with frame.
    parameters:
    p_evt01 as checkbox, "PF_STATUS_SET
    p_evt02 as checkbox. "USER_COMMAND
    selection-screen skip.
    parameters:
    p_evt03 as checkbox, "CALLER_EXIT
    p_evt04 as checkbox, "LIST_MODIFY
    p_evt05 as checkbox, "BEFORE_LINE_OUTPUT
    p_evt06 as checkbox. "AFTER_LINE_OUTPUT
    selection-screen skip.
    parameters:
    p_evt07 as checkbox, "SUBTOTAL_TEXT
    p_evt08 as checkbox. "REPREP_SEL_MODIFY
    selection-screen skip.
    parameters:
    p_evt09 as checkbox, "TOP_OF_PAGE
    p_evt10 as checkbox, "END_OF_PAGE
    p_evt11 as checkbox, "TOP_OF_LIST
    p_evt12 as checkbox. "END_OF_LIST
    selection-screen skip.
    parameters:
    p_evt13 as checkbox, "TOP_OF_COVERPAGE
    p_evt14 as checkbox. "END_OF_COVERPAGE
    selection-screen skip.
    parameters:
    p_evt15 as checkbox, "FOREIGN_TOP_OF_PAGE
    p_evt16 as checkbox. "FOREIGN_END_OF_PAGE
    selection-screen skip.
    parameters:
    p_evt17 as checkbox. "GROUPLEVEL_CHANGE
    selection-screen end of block evt.
    INITIALIZATION                                                       *
    initialization.
      perform f01_f4_field using 'SUM' space changing p_dosf01-low.
      p_dosf01-option = 'EQ'.
      p_dosf01-sign   = 'I'.
      append p_dosf01.
      perform f01_f4_field using 'SUM' space changing p_nosf01-low.
      p_nosf01-option = 'EQ'.
      p_nosf01-sign   = 'I'.
      append p_nosf01.
      perform f01_f4_field using 'KEY' space changing p_outf01-low.
      p_outf01-option = 'EQ'.
      p_outf01-sign   = 'I'.
      append p_outf01.
      perform f01_f4_field using space space changing p_tecf01-low.
      p_tecf01-option = 'EQ'.
      p_tecf01-sign   = 'I'.
      append p_tecf01.
      perform f01_f4_field using space space changing p_fixf01-low.
      p_fixf01-option = 'EQ'.
      p_fixf01-sign   = 'I'.
      append p_fixf01.
      perform f01_f4_field using 'CURR' space changing p_curf00-low.
      p_curf00-option = 'EQ'.
      p_curf00-sign   = 'I'.
      append p_curf00.
      perform f01_f4_field using 'CUKY' space changing p_curf01.
      perform f01_f4_field using space space changing p_hotf03-low.
      p_hotf03-option = 'EQ'.
      p_hotf03-sign   = 'I'.
      append p_hotf03.
      perform f01_f4_field using space space changing p_colf02-low.
      p_colf02-option = 'EQ'.
      p_colf02-sign   = 'I'.
      append p_colf02.
      perform f01_f4_field using space space changing p_colf03-low.
      p_colf03-option = 'EQ'.
      p_colf03-sign   = 'I'.
      append p_colf03.
    AT SELECTION-SCREEN                                                  *
    at selection-screen.
      case sscrfields-ucomm.
        when 'PB01'.
          call screen 1001 starting at 1 1 ending at 80 20.
        when 'PB02'.
          call screen 1002 starting at 1 1 ending at 80 20.
      endcase.
    AT SELECTION-SCREEN ON VALUE-REQUEST                                 *
    at selection-screen on value-request for p_dosf01-low.
      perform f01_f4_field using 'SUM' 'X' changing p_dosf01-low.
    at selection-screen on value-request for p_nosf01-low.
      perform f01_f4_field using 'SUM' 'X' changing p_nosf01-low.
    at selection-screen on value-request for p_outf01-low.
      perform f01_f4_field using 'KEY' 'X' changing p_outf01-low.
    at selection-screen on value-request for p_tecf01-low.
      perform f01_f4_field using space 'X' changing p_tecf01-low.
    at selection-screen on value-request for p_fixf01-low.
      perform f01_f4_field using space 'X' changing p_fixf01-low.
    at selection-screen on value-request for p_curf00-low.
      perform f01_f4_field using 'CURR' 'X' changing p_curf00-low.
    at selection-screen on value-request for p_curf01.
      perform f01_f4_field using 'CUKY' 'X' changing p_curf01.
    at selection-screen on value-request for p_hotf03-low.
      perform f01_f4_field using space 'X' changing p_hotf03-low.
    at selection-screen on value-request for p_colf02-low.
      perform f01_f4_field using space 'X' changing p_colf02-low.
    at selection-screen on value-request for p_colf03-low.
      perform f01_f4_field using space 'X' changing p_colf03-low.
    at selection-screen on value-request for p_lay06.
      perform f01_f4_fcode using space
                                 space
                        changing p_lay06.
    START-OF-SELECTION                                                   *
    start-of-selection.
      g_repid               = sy-repid.
      gs_test-select_amount = p_amount.
      gs_test-only_db_info  = p_dbinfo.
      gs_test-db_short      = p_dbshrt.
      gs_test-list_amount = p_list.
      gs_test-layo_title               = p_tit01.
      gs_test-layo_zebra               = p_lay01.
      gs_test-layo_no_horiz_lines      = p_lay02.
      gs_test-layo_no_vert_lines       = p_lay03.
      gs_test-layo_no_scrolling        = p_lay04.
      gs_test-layo_f2code              = p_lay06.
      gs_test-layo_confirmation_prompt = p_lay07.
      gs_test-layo_box                 = p_spa01.
      gs_test-layo_count               = p_spa02.
      gs_test-layo_no_colhead          = p_spa03.
      gs_test-layo_column_optimize     = p_spa04.
      gs_test-layo_no_hotspot          = p_hot01.
      if p_hot02 eq con_true.
        loop at p_hotf02.
          if not p_hotf02-low is initial.
            append p_hotf02-low to gs_test-layo_hotspot_rows.
          endif.
        endloop.
      endif.
      if p_hot03 eq con_true.
        loop at p_hotf03.
          if not p_hotf03-low is initial.
            append p_hotf03-low to gs_test-layo_hotspot_columns.
          endif.
        endloop.
      endif.
      case con_true.
        when p_mrg01.
          gs_test-layo_cell_merge          = space.
        when p_mrg02.
          gs_test-layo_cell_merge          = 'N'.
        when p_mrg03.
          gs_test-layo_cell_merge          = 'Y'.
      endcase.
      if p_out01 eq con_true.
        loop at p_outf01.
          if not p_outf01-low is initial.
            append p_outf01-low to gs_test-fcat_no_out_fields.
          endif.
        endloop.
      endif.
      if p_tec01 eq con_true.
        loop at p_tecf01.
          if not p_tecf01-low is initial.
            append p_tecf01-low to gs_test-fcat_tech_fields.
          endif.
        endloop.
      endif.
      if p_fix01 eq con_true.
        loop at p_fixf01.
          if not p_fixf01-low is initial.
            append p_fixf01-low to gs_test-fcat_fix_column_fields.
          endif.
        endloop.
      endif.
      gs_test-curr_amount = p_curanz.
      gs_test-curr_space  = p_curspc.
      if p_cur01 eq con_true or p_cur02 eq con_true.
        data: ls_fcat_curr type g_ty_s_fcat_curr.
        loop at p_curf00.
          clear ls_fcat_curr.
          if not p_curf00-low is initial.
            ls_fcat_curr-fieldname = p_curf00-low.
            case con_true.
              when p_cur01.
                ls_fcat_curr-cfieldname = p_curf01.
              when p_cur02.
                ls_fcat_curr-currency   = p_curf02.
            endcase.
            append ls_fcat_curr to gs_test-fcat_curr_fields.
          endif.
        endloop.
      endif.
      gs_test-layo_keys_hotspot        = p_key01.
      gs_test-layo_no_keyfix           = p_key02.
      gs_test-excp_display             = p_excp01.
      gs_test-excp_condense            = p_excp_c.
      gs_test-sum_before               = p_sum01.
      gs_test-sum_numc                 = p_sum02.
      gs_test-sum_no_unitsplit         = p_sum03.
      gs_test-sum_totals_only          = p_sum04.
      gs_test-sum_no_sumchoice         = p_sum05.
      gs_test-sum_no_sumline           = p_sum06.
      gs_test-sum_totals_text          = p_sum07.
      gs_test-sum_no_subchoice         = p_sum08.
      gs_test-sum_no_subtotals         = p_sum09.
      gs_test-sum_subtotals_text       = p_sum10.
      if p_dos01 eq con_true.
        loop at p_dosf01.
          if not p_dosf01-low is initial.
            append p_dosf01-low to gs_test-fcat_do_sum_fields.
          endif.
        endloop.
      endif.
      if p_nos01 eq con_true.
        loop at p_nosf01.
          if not p_nosf01-low is initial.
            append p_nosf01-low to gs_test-fcat_no_sum_fields.
          endif.
        endloop.
      endif.
      gs_test-layo_group_change_edit   = p_lpr01.
      gs_test-layo_get_selinfo         = p_lpr02.
      gs_test-layo_no_min_linesize     = p_lpr03.
      gs_test-layo_min_linesize        = p_lpr04.
      gs_test-layo_max_linesize        = p_lpr05.
      gs_test-prnt_print                  = p_prn01.
      gs_test-prnt_reserve_lines          = p_prn02.
      gs_test-prnt_no_listinfo            = p_prn03.
      gs_test-prnt_no_selinfo             = p_prn04.
      gs_test-prnt_with_title             = p_prn05.
      gs_test-prnt_footline               = p_prn06.
      gs_test-prnt_printinfo              = p_prn07.
      gs_test-prnt_no_coverpage           = p_prn08.
      gs_test-prnt_no_new_page            = p_prn09.
      gs_test-prnt_no_change_print_params = p_prn10.
      if p_col01 eq con_true.
        loop at p_colf01.
          if not p_colf01-low is initial.
            append p_colf01-low to gs_test-color_rows.
          endif.
        endloop.
      endif.
      if p_col02 eq con_true.
        loop at p_colf02.
          if not p_colf02-low is initial.
            append p_colf02-low to gs_test-color_fields_column.
          endif.
        endloop.
      endif.
      if p_col03 eq con_true.
        loop at p_colf03.
          if not p_colf03-low is initial.
            append p_colf03-low to gs_test-color_fields_cell.
          endif.
        endloop.
      endif.
      if p_evt01 eq con_true.
        append con_event_01 to gs_test-events.
      endif.
      if p_evt02 eq con_true.
        append con_event_02 to gs_test-events.
      endif.
      if p_evt03 eq con_true.
        append con_event_03 to gs_test-events.
      endif.
      if p_evt04 eq con_true.
        append con_event_04 to gs_test-events.
      endif.
      if p_evt05 eq con_true.
        append con_event_05 to gs_test-events.
      endif.
      if p_evt06 eq con_true.
        append con_event_06 to gs_test-events.
      endif.
      if p_evt07 eq con_true.
        append con_event_07 to gs_test-events.
      endif.
      if p_evt08 eq con_true.
        append con_event_08 to gs_test-events.
      endif.
      if p_evt09 eq con_true.
        append con_event_09 to gs_test-events.
      endif.
      if p_evt10 eq con_true.
        append con_event_10 to gs_test-events.
      endif.
      if p_evt11 eq con_true.
        append con_event_11 to gs_test-events.
      endif.
      if p_evt12 eq con_true.
        append con_event_12 to gs_test-events.
      endif.
      if p_evt13 eq con_true.
        append con_event_13 to gs_test-events.
      endif.
      if p_evt14 eq con_true.
        append con_event_14 to gs_test-events.
      endif.
      if p_evt15 eq con_true.
        append con_event_15 to gs_test-events.
      endif.
      if p_evt16 eq con_true.
        append con_event_16 to gs_test-events.
      endif.
      if p_evt17 eq con_true.
        append con_event_17 to gs_test-events.
      endif.
      gs_test-buffer_active            = space.
      gs_test-bypassing_buffer         = space.
    END-OF-SELECTION                                                     *
    end-of-selection.
      perform f01_call_list.
    *&      Form  f01_call_list
          text
    form f01_call_list .
      data: ls_prnt   type slis_print_alv,
            lt_excl   type slis_t_extab,
            l_exit    type char1,
            ls_exit   type slis_exit_by_user,
            l_list    type num1.
      call function 'REUSE_ALV_BLOCK_LIST_INIT'
        exporting
          i_callback_program       = g_repid
          i_callback_pf_status_set = ' '
          i_callback_user_command  = ' '
          it_excluding             = lt_excl.
      do gs_test-list_amount times.
        add 1 to l_list.
        perform f01_append_list using l_list.
      enddo.
      perform f01_set_prnt changing ls_prnt.
      call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
        exporting
          i_interface_check       = ' '
          is_print                = ls_prnt
          i_screen_start_column   = 0
          i_screen_start_line     = 0
          i_screen_end_column     = 0
          i_screen_end_line       = 0
        importing
          e_exit_caused_by_caller = l_exit
          es_exit_caused_by_user  = ls_exit
        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.                    " f01_call_list
    *&      Form  f01_append_list
          text
    form f01_append_list using value(i_list) type num1.
      data: ls_layo   type slis_layout_alv,
            lt_fcat   type slis_t_fieldcat_alv,
            lt_sort   type slis_t_sortinfo_alv,
            lt_evts   type slis_t_event,
            l_tabname type slis_tabname.
      field-symbols: <l_table> type any.
      perform f01_get_outtab using i_list.
      case i_list.
        when 1.
          gt_outtab1 = gt_outtab[].
        when 2.
          gt_outtab2 = gt_outtab[].
        when 3.
          gt_outtab3 = gt_outtab[].
        when 4.
          gt_outtab4 = gt_outtab[].
        when 5.
          gt_outtab5 = gt_outtab[].
        when 6.
          gt_outtab6 = gt_outtab[].
        when 7.
          gt_outtab7 = gt_outtab[].
        when 8.
          gt_outtab8 = gt_outtab[].
        when 9.
          gt_outtab9 = gt_outtab[].
      endcase.
      perform f01_set_layo changing ls_layo.
      perform f01_set_fcat changing lt_fcat.
      perform f01_set_evts changing lt_evts.
      concatenate 'LIST_' i_list into l_tabname.
      case i_list.
        when 1.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab1
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 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.
        when 2.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab2
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 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.
        when 3.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab3
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 2
              others                     = 3.
          if sy-subrc <> 0.
            message id sy-msgid type sy-msgty number sy-msgno
                    with sy-ms

  • How to get check box in alv grid list output

    hi gurus,
    can anyone inform me
    how to get check box in alv output it should not be a pop up window
    thank you
    regards
    kals.

    or
    hi go through the fallowing code.
    code*&----
    *& Report YGS_ALV_BOM *
    REPORT YGS_ALV_BOM .
    TABLES : MAST,STKO,STPO.
    TYPE-POOLS: SLIS.
    TYPES : BEGIN OF TY_MAST,
    CHECK_BOX,
    MATNR TYPE MAST-MATNR,
    WERKS TYPE MAST-WERKS,
    STLAN TYPE MAST-STLAN,
    STLNR TYPE MAST-STLNR,
    STLAL TYPE MAST-STLAL,
    END OF TY_MAST.
    TYPES : BEGIN OF TY_STKO,
    STLTY TYPE STKO-STLTY,
    STLNR TYPE STKO-STLNR,
    STLAL TYPE STKO-STLAL,
    STKOZ TYPE STKO-STKOZ,
    BMENG TYPE STKO-BMENG,
    BMEIN TYPE STKO-BMEIN,
    END OF TY_STKO.
    TYPES : BEGIN OF TY_STPO,
    LIGHTS,
    STLTY TYPE STPO-STLTY,
    STLNR TYPE STPO-STLNR,
    STLKN TYPE STPO-STLKN,
    STPOZ TYPE STPO-STPOZ,
    IDNRK TYPE STPO-IDNRK,
    MENGE TYPE STPO-MENGE,
    MEINS TYPE STPO-MEINS,
    END OF TY_STPO.
    DATA : IT_MAST TYPE TABLE OF TY_MAST,
    WA_MAST TYPE TY_MAST,
    IT_STKO TYPE TABLE OF TY_STKO,
    WA_STKO TYPE TY_STKO,
    IT_STPO TYPE TABLE OF TY_STPO,
    WA_STPO TYPE TY_STPO.
    DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
    ls_layout TYPE slis_layout_alv,
    ls_event TYPE slis_alv_event,
    lt_event TYPE slis_t_event,
    it_sortinfo type slis_t_sortinfo_alv,
    ls_header TYPE slis_listheader,
    lt_header TYPE slis_t_listHEADER.
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    SELECT-OPTIONS : S_MATNR FOR MAST-MATNR.
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM BUILD_FIELDCAT USING LT_FIELDCAT.
    PERFORM BUILD_LAYOUT.
    END-OF-SELECTION.
    PERFORM DISPLAY_DATA.
    *& Form GET_DATA
    text
    --> p1 text
    <-- p2 text
    form GET_DATA .
    REFRESH : IT_MAST.
    SELECT MATNR
    WERKS
    STLAN
    STLNR
    FROM MAST
    INTO CORRESPONDING FIELDS OF TABLE IT_MAST
    WHERE MATNR IN S_MATNR.
    endform. " GET_DATA
    *& Form BUILD_FIELDCAT
    text
    --> p1 text
    <-- p2 text
    form BUILD_FIELDCAT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    REFRESH : LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 1.
    L_FIELDCAT-FIELDNAME = 'MATNR'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'MATNR'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 2.
    L_FIELDCAT-FIELDNAME = 'WERKS'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'WERKS'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 3.
    L_FIELDCAT-FIELDNAME = 'STLNR'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    endform. " BUILD_FIELDCAT
    *& Form BUILD_LAYOUT
    text
    --> p1 text
    <-- p2 text
    form BUILD_LAYOUT .
    CLEAR LS_LAYOUT.
    LS_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
    LS_LAYOUT-BOX_TABNAME = 'IT_MAST'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_DATA
    text
    --> p1 text
    <-- p2 text
    form DISPLAY_DATA .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_STRUCTURE_NAME =
    IS_LAYOUT = LS_LAYOUT
    IT_FIELDCAT = LT_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
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = IT_MAST
    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_DATA
    FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
    SET PF-STATUS 'YSTATUS' OF PROGRAM SY-REPID
    EXCLUDING RT_EXTAB.
    ENDFORM.
    FORM USER_COMMAND USING RF_UCOMM TYPE SY-UCOMM
    SELFIELD TYPE SLIS_SELFIELD.
    CASE RF_UCOMM.
    WHEN '&NEXT'.
    PERFORM GET_DATA_BOM .
    PERFORM BUILD_FIELDCAT_BOM USING LT_FIELDCAT.
    PERFORM BUILD_LAYOUT_BOM.
    PERFORM DISPLAY_DATA_BOM.
    ENDCASE.
    ENDFORM.
    *& Form GET_DATA_BOM
    text
    --> p1 text
    <-- p2 text
    form GET_DATA_BOM .
    CLEAR : WA_STPO,
    WA_MAST.
    REFRESH : IT_STPO.
    DATA : IT_CHECK TYPE TABLE OF TY_MAST.
    LOOP AT IT_MAST INTO WA_MAST.
    IF WA_MAST-CHECK_BOX EQ 'X'.
    APPEND WA_MAST TO IT_CHECK.
    ENDIF.
    ENDLOOP.
    SELECT STLTY
    STLNR
    STLKN
    VGKNT
    IDNRK
    MENGE
    MEINS
    FROM STPO
    INTO CORRESPONDING FIELDS OF TABLE IT_STPO
    FOR ALL ENTRIES IN IT_CHECK
    WHERE IDNRK EQ IT_CHECK-MATNR.
    CLEAR WA_STPO.
    LOOP AT IT_STPO INTO WA_STPO.
    SELECT SINGLE * FROM MAST WHERE MATNR EQ WA_STPO-IDNRK.
    IF SY-SUBRC = 0.
    WA_STPO-LIGHTS = '2'.
    ELSE.
    WA_STPO-LIGHTS = '1'.
    ENDIF.
    MODIFY IT_STPO FROM WA_STPO.
    ENDLOOP.
    endform. " GET_DATA_BOM
    *& Form BUILD_FIELDCAT_BOM
    text
    --> p1 text
    <-- p2 text
    form BUILD_FIELDCAT_BOM USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    REFRESH : LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 1.
    L_FIELDCAT-FIELDNAME = 'STLTY'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLTY'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 2.
    L_FIELDCAT-FIELDNAME = 'STLNR'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 3.
    L_FIELDCAT-FIELDNAME = 'STLKN'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLKN'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 4.
    L_FIELDCAT-FIELDNAME = 'IDNRK'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'IDNRK'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 5.
    L_FIELDCAT-FIELDNAME = 'MENGE'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'MENGE'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    endform. " BUILD_FIELDCAT_BOM
    *& Form BUILD_LAYOUT_BOM
    text
    --> p1 text
    *<-- p2 text
    form BUILD_LAYOUT_BOM .
    CLEAR : LS_LAYOUT.
    LS_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
    LS_LAYOUT-LIGHTS_TABNAME = 'IT_STPO'.
    endform. " BUILD_LAYOUT_BOM
    *& Form DISPLAY_DATA_BOM
    text
    --> p1 text
    <-- p2 text
    form DISPLAY_DATA_BOM .
    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_BOM'
    I_CALLBACK_TOP_OF_PAGE = 'TOP9'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = 'ALV_BACKGROUND'
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT = LS_LAYOUT
    IT_FIELDCAT = LT_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
    IT_ALV_GRAPHICS =
    IT_HYPERLINK =
    IT_ADD_FIELDCAT =
    IT_EXCEPT_QINFO =
    I_HTML_HEIGHT_TOP =
    I_HTML_HEIGHT_END =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = IT_STPO
    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_DATA_BOM
    FORM TOP9 .
    CLEAR LS_HEADER.
    REFRESH LT_HEADER.
    LS_HEADER-TYP = 'H'.
    LS_HEADER-INFO = 'BILL OF MATERIALS'.
    APPEND LS_HEADER TO LT_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = LT_HEADER
    I_LOGO = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID =
    ENDFORM.
    FORM USER_COMMAND_BOM USING RF_UCOMM_BOM LIKE SY-UCOMM
    SEL_FIELD TYPE SLIS_SELFIELD.
    CASE RF_UCOMM_BOM.
    WHEN '&IC1'.
    SET PARAMETER ID 'MAT' FIELD WA_STPO-IDNRK.
    SET PARAMETER ID 'WRK' FIELD WA_MAST-WERKS.
    SET PARAMETER ID 'CSA' FIELD WA_MAST-STLAN.
    CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
    ENDCASE.[/code]

  • ALV with Check Box

    Hi Experts,
    I have an ALV grid display with check box.
    I need to display the ALV with only check box. I don't need the Grid towards the left.
    So can anyone tell me how to avoid the Grid which is at the left.
    I am using "REUSE_ALV_GRID_DISPLAY" Function Module.
    Thanks,
    Karthik MD

    Hi,
    I am pasted my code below.
    wa_fieldcat_s-fieldname = 'FLAG'.
    wa_fieldcat_s-outputlen = 1.
      wa_fieldcat_s-checkbox = c_check.
      wa_fieldcat_s-edit = c_check.
      wa_fieldcat_s-col_pos = 1.
      wa_fieldcat_s-seltext_l = 'Select'.
    wa_fieldcat_s-no_out = 'X'.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
      wa_fieldcat_s-fieldname = 'SRID'.
      wa_fieldcat_s-key = 'X'.
      wa_fieldcat_s-fix_column = 'X'.
      wa_fieldcat_s-seltext_l = 'SR Global ID'(101).
      wa_fieldcat_s-col_pos = 2.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
      wa_fieldcat_s-fieldname = 'PERNR'.
      wa_fieldcat_s-seltext_l = 'Employee Number'(102).
      wa_fieldcat_s-col_pos = 3.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
      wa_fieldcat_s-fieldname = 'ZZAGREEMENT_ID'.
      wa_fieldcat_s-seltext_l = 'Agreement ID'(103).
      wa_fieldcat_s-col_pos = 4.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
      wa_fieldcat_s-fieldname = 'IT0041ENDDA'.
      wa_fieldcat_s-seltext_l = 'HCMS END DATE'(104).
      wa_fieldcat_s-col_pos = 5.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
      wa_fieldcat_s-fieldname = 'ASSIGN_END_DATE'.
      wa_fieldcat_s-seltext_l = 'Assignment End Date'(105).
      wa_fieldcat_s-col_pos = 6.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
      wa_fieldcat_s-fieldname = 'FNAME'.
      wa_fieldcat_s-seltext_l = 'First Name'(106).
      wa_fieldcat_s-col_pos = 7.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
      wa_fieldcat_s-fieldname = 'LNAME'.
      wa_fieldcat_s-seltext_l = 'Last Name'(106).
      wa_fieldcat_s-col_pos = 8.
      APPEND wa_fieldcat_s TO fieldcat_s.
      CLEAR wa_fieldcat_s.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program       = prog_name
            i_callback_pf_status_set = 'PF_STATUS'
            i_callback_user_command  = 'USER_COMMAND'
            is_layout                = l_layout
            it_fieldcat              = fieldcat_s[]
            it_events                = t_events[]
            i_save                   = 'X'
          TABLES
            t_outtab                 = lt_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.
    Thanks,
    Karthik MD

  • Add check box in ALV output  List.

    Hi
    I want to add check box in alv out put list . i m trying but not getting succsses .
    please tell me the process .
    thanks
    chandra

    Hi Chandra,
    Types: begin of ty_output,
          u201C Included these two types in your output structure.
       celltab     TYPE lvc_t_styl,   
       checkbox    TYPE c,
           end of ty_output.     
    Data: it_output type standard table of ty_output,
          wa_output type ty_output.
    Loop at it_output into wa_output.
    * Initially, set all checkbox cells editable.
       ls_celltab-fieldname = 'CHECKBOX'.
       ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
       INSERT ls_celltab INTO TABLE lt_celltab.
       INSERT LINES OF lt_celltab INTO TABLE wa_coupon-celltab.
    MODIFY it_coupon FROM wa_coupon TRANSPORTING celltab.
    Endloop.
    Form build_field_catalog.
      wa_fieldcat-fieldname = 'CHECKBOX'.
      ADD 1 TO wf_pos.
      wa_fieldcat-col_pos  = wf_pos.
      wa_fieldcat-datatype = 'C'.
      wa_fieldcat-outputlen  = '6'.
      wa_fieldcat-reptext   = 'Select'.
      wa_fieldcat-coltext  = 'Select'.
      wa_fieldcat-seltext  = 'Select'.
      wa_fieldcat-tooltip  = 'Select'.
      wa_fieldcat-checkbox = 'X'.
      wa_fieldcat-edit     = 'X'.
      wa_fieldcat-key      = ''.
      wa_fieldcat-icon      = ''.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    Endform.
    Form display_alv.
    ls_variant-report = sy-cprog..
      gs_layout-stylefname = 'CELLTAB'.  u201C Please  do not forget to include this statement
    gs_layout-zebra = 'X'.
      CALL METHOD alv_grid->set_table_for_first_display
        EXPORTING
          is_layout                     = gs_layout
          it_toolbar_excluding          = lt_exclude
        CHANGING
          it_outtab       = it_output
          it_fieldcatalog = it_fieldcat.
      CLEAR gt_fieldcat.
    Endform.
    Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 4:31 PM

  • How to create check box in ALV Reports?

    how to create check box in ALV Reports?

    Hi
    check the report  BCALV_TEST_GRID_EDITABLE
    or
    check this report
    REPORT ZRFC346_TST.
    TABLES:SFLIGHT,RL034.
    TYPE-POOLS:SLIS.
    INCLUDE:<ICON>,<SYMBOL>.
    DATA: G_REPID          LIKE SY-REPID,
          G_FIELDCAT       TYPE SLIS_T_FIELDCAT_ALV,
          G_IT_SORT        TYPE SLIS_T_SORTINFO_ALV,
          G_LAYOUT         TYPE SLIS_LAYOUT_ALV,
          G_TABNAME_HEADER TYPE SLIS_TABNAME,
          G_TABNAME_ITEM   TYPE SLIS_TABNAME,
          G_KEYINFO        TYPE SLIS_KEYINFO_ALV,
          G_VARIANT        LIKE DISVARIANT,
          G_EXTAB          TYPE SLIS_T_EXTAB,
          I_SLIS_EXIT_BY_USER TYPE SLIS_EXIT_BY_USER.
    DATA: XEVENT         TYPE SLIS_T_EVENT,
          AEVENT         TYPE SLIS_ALV_EVENT,
          VARIANT        LIKE DISVARIANT,
          LAYOUT         TYPE SLIS_LAYOUT_ALV,
          ASP_GROUP      TYPE SLIS_SP_GROUP_ALV,
          GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
          EXTAB          TYPE SLIS_T_EXTAB WITH HEADER LINE,
          XFIELD         TYPE SLIS_T_FIELDCAT_ALV,
          AFIELD         TYPE SLIS_FIELDCAT_ALV,
          G_SUCOMM      LIKE SY-UCOMM,
          G_SELFLD       TYPE SLIS_SELFIELD.
    DATA: SAV_SY_REPID      LIKE SY-REPID.
    CONSTANTS: CON_SFLIGHT TYPE LVC_FNAME VALUE 'SFLIGHT',
               CON_DISPLAY_FULL TYPE I VALUE 3.
    Data to be displayed
    DATA: BEGIN OF GT_SFLIGHT OCCURS 0.
            INCLUDE STRUCTURE SFLIGHT.
    DATA:ACTIVATE(1).
    DATA: END OF GT_SFLIGHT.
    INITIALIZATION.
    *........Initialisierung...............................................
      PERFORM INITIALIZATION_RL034.
    *........Field cata....................................................
      PERFORM FIELD_CAT.
    *........SPECIAL GROUP.................................................
      PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
    START-OF-SELECTION.
    Selection
      SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
    *........ALV CALL.......................................................
      PERFORM ALV_CALL.
      PERFORM USER_COMMAND_LOCAL USING G_SUCOMM G_SELFLD.
          FORM USER_COMMAND_LOCAL                                       *
    -->  G_UCOMM                                                       *
    -->  G_SELFIELD                                                    *
    FORM USER_COMMAND_LOCAL USING G_UCOMM LIKE SY-UCOMM
                                  G_SELFIELD TYPE SLIS_SELFIELD.
      CASE G_UCOMM.
        WHEN 'ACT'.
      ENDCASE.
    ENDFORM.
          FORM ALV_CALL                                                 *
    FORM ALV_CALL.
    Call ABAP List Viewer (ALV)
    G_LAYOUT-BOX_FIELDNAME = 'ACTIVATE'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                 EXPORTING
                I_BACKGROUND_ID         = 'ALV_BACKGROUND'
                   I_BYPASSING_BUFFER                = SPACE
                   I_BUFFER_ACTIVE                   = SPACE
                    I_CALLBACK_PROGRAM                = SAV_SY_REPID
                    I_CALLBACK_PF_STATUS_SET          = 'STATUS'
                   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND_LOCAL'
                I_CALLBACK_TOP_OF_PAGE            = ' '
                I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
                I_CALLBACK_HTML_END_OF_LIST       = ' '
                 I_STRUCTURE_NAME                  = 'SFLIGHT'
                I_BACKGROUND_ID                   = ' '
                I_GRID_TITLE                      =
                I_GRID_SETTINGS                   =
                  IS_LAYOUT                         = G_LAYOUT
                  IT_FIELDCAT                       = XFIELD[]
                IT_EXCLUDING                      =
                  IT_SPECIAL_GROUPS                 = GT_SP_GROUP[]
                IT_SORT                           =
                IT_FILTER                         =
                 IS_SEL_HIDE                       = 'X'
                I_DEFAULT                         = 'X'
                  I_SAVE                            = 'A'
                IS_VARIANT                        =
                 IT_EVENTS                         = XEVENT
                IT_EVENT_EXIT                     =
                IS_PRINT                          =
                IS_REPREP_ID                      =
                I_SCREEN_START_COLUMN             = 0
                I_SCREEN_START_LINE               = 0
                I_SCREEN_END_COLUMN               = 0
                I_SCREEN_END_LINE                 = 0
                IT_ALV_GRAPHICS                   =
                IT_ADD_FIELDCAT                   =
                IT_HYPERLINK                      =
                I_HTML_HEIGHT_TOP                 =
                I_HTML_HEIGHT_END                 =
                IT_EXCEPT_QINFO                   =
              IMPORTING
                E_EXIT_CAUSED_BY_CALLER           =
                ES_EXIT_CAUSED_BY_USER            =
                  TABLES
                    T_OUTTAB                          = GT_SFLIGHT
              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.
          FORM status                                                   *
    -->  EXTAB                                                         *
    FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STAT' EXCLUDING EXTAB.
    ENDFORM.                               " STATUS
    *&      Form  INITIALIZATION_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM INITIALIZATION_RL034.
      SAV_SY_REPID = SY-REPID.
    ENDFORM.                    " INITIALIZATION_RL034
    *&      Form  DEFINE_EVENTS_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM DEFINE_EVENTS_RL034.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = XEVENT.
       exceptions
            list_type_wrong = 1
            others          = 2.
    ENDFORM.                    " DEFINE_EVENTS_RL034
    *&      Form  FIELD_CAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELD_CAT.
      DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN   TYPE I.
      REFRESH XFIELD.
           1. per Default eingeblendete Felder                          *
    *........Ikone/Symbol..................................................
      CLEAR AFIELD.
      DATA: LS1_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN1   TYPE I.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME       = CON_SFLIGHT
                I_BYPASSING_BUFFER     = SPACE
                I_BUFFER_ACTIVE        = SPACE
           CHANGING
                CT_FIELDCAT            = XFIELD
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      DESCRIBE TABLE XFIELD LINES L_LIN1.
      ADD 1 TO L_LIN1.
      CLEAR LS_FCAT.
      LS1_FCAT-FIELDNAME = 'ACTIVATE'.
      LS1_FCAT-CHECKBOX  = 'X'.
    LS1_FCAT-KEY       = 'X'.
      LS1_FCAT-INPUT     = 'X'.
      LS1_FCAT-EDIT     = 'X'.
      LS1_FCAT-INTTYPE   = 'C'.
      LS1_FCAT-DATATYPE  = 'CHAR'.
      LS1_FCAT-INTLEN    = 1.
      LS1_FCAT-COL_POS   = L_LIN1.
      LS1_FCAT-SELTEXT_S = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_M = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_L = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SP_GROUP = 'A'.
      APPEND LS1_FCAT TO XFIELD.
      ADD 1 TO L_LIN.
    ENDFORM.                    " FIELD_CAT
    FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
      DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
      CLEAR  LS_SP_GROUP.
      LS_SP_GROUP-SP_GROUP = 'A'.
      LS_SP_GROUP-TEXT     = 'SPECIAL'.
      APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
    ENDFORM.
    Regards
    Shiva

Maybe you are looking for