Regarding enabled check box's in alv grid display

hi ,
in alv output i have three fields i have enabled check boxes of  this three field  i want to display the out put of them
could u please explain clearly with code

Hi,
Go to Se38 --> Input BCALV_EDIT* and press F4. You can find many demo program with chekbox in ALV.
Thanks,
Sriram Ponna.

Similar Messages

  • Regard check box concept in alv grid display

    HI Friends,
            i am displaying the sales order details with check box. so my first field is checkbox. When user click on check box then he press the details icon.
            my question i need a logic for calling the tcode based on the vbeln when it is cheked.
            thanks in advance.
    Regards,
    Purna.

    hi,
    go through this program
    program bcalv_edit_05.
    Purpose:
    ~~~~~~~~
    This example shows how to use checkboxes within an ALV Grid Control.
    You learn:
    o how to define a column for editable checkboxes for an attribute
       of your list (see also remark below)
    o how to evaluate the checked checkboxes
    o how to switch between editable and non-editable checkboxes
    Important Remark
    ~~~~~~~~~~~~~~~~
    The checkbox functionality has been replaced by selection buttons
    in front of each row (field SEL_MODE of the layout structure
    set to 'A' or 'D'; when using the editable ALV Grid Control,
    these selection buttons are always visible).
    Class methods like GET_SELECTED_ROWS work only for this new
    functionality and not for checkboxes.
    Thus checkboxes should not be used for line selection but for
    a column as an additional or for an already existing attribute
    (like field SMOKER in SBOOK).
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Try out the functions displayed in the application toolbar:
    o The first sets all checked lines to initial values.
      (see form reset_selected_entries)
    o The seconds marks all checkboxes that are input enabled
    o The third unmarks all checkboxes that are input enabled
    o To try the forth, you have to select a line first using
      the selection buttons on the left.
      The function deactivates/activates a checkbox.
    Checkboxes may be locked/unlocked using a double click on the
    checkbox cell.
    Essential steps (search for '§')
    ~~~~~~~~~~~~~~~
    This example focusses on two aspects of checkboxes in an
    editable ALV Grid Control:
    A How to integrate, set, reset and evaluate checkboxes
    B What you must do to lock particular checkboxes against input
    A) Integrate, set, reset and evaluate checkboxes
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    A1.Extend your output table by a checkbox field.
    A2.Add an entry for the checkbox in the fieldcatalog
    A3.Optionally, check checkboxes initially after selecting data.
    A4.Before you (a)set, (b)reset, (c)(de)activate or
       (d)evaluate checkboxes, you must check the input cells.
    B) Lock particular checkboxes against input
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    B1.Extend your output table by a field to dis- or enable
        cells for input.
    B2.After selecting data,
        assign a style for each row of your checkbox column.
    B3.Use the layout structure to aquaint additional field to ALV.
    B4.Switch the style to dis- or enable a cell for input
    class lcl_event_receiver definition deferred.  "for event handling
    data: ok_code like sy-ucomm,
          save_ok like sy-ucomm,
          g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
          g_grid  type ref to cl_gui_alv_grid,
          g_custom_container type ref to cl_gui_custom_container,
          g_event_receiver type ref to lcl_event_receiver,
          gt_fieldcat type lvc_t_fcat,
          gs_layout type lvc_s_layo,
          g_max type i value 100.
    *§A1.Extend your output table by a checkbox field.
        If you do not want to lock sole checkboxes against input
        you do not need field 'celltab'.
    types: begin of gs_outtab.
    types: checkbox type c.                "field for checkbox
    §B1.Extend your output table by a field to dis- or enable
        cells for input.
    types: celltab type lvc_t_styl.        "field to switch editability
            include structure sflight.
    types: end of gs_outtab.
    data: gt_outtab type gs_outtab occurs 0 with header line.
    LOCAL CLASSES
    This local class only handles event DOUBLE_CLICK.
    Wenn the user double clicks on a checkbox cell the status of
    this cell is switched from editable to not editable and vice versa.
    class lcl_event_receiver definition.
    public section.
    methods: catch_doubleclick
             for event double_click of cl_gui_alv_grid
             importing
                e_column
                es_row_no
                sender.
    endclass.
    class lcl_event_receiver implementation.
    method catch_doubleclick.
      data: ls_outtab type gs_outtab,
            ls_celltab type lvc_s_styl.
    Function:
    Switch between 'editable' and 'not editable' checkbox.
    If the user clicked on another column there is
    nothing to do.
      if e_column-fieldname ne 'CHECKBOX'.
        exit.
      endif.
      read table gt_outtab into ls_outtab index es_row_no-row_id.
    The loop is only needed if there are other columns that
    use checkboxes. At this point the loop could be
    replaced by a READ of the first line of CELLTAB.
          loop at ls_outtab-celltab into ls_celltab.
            if ls_celltab-fieldname eq 'CHECKBOX'.
    §B4.Switch the style to dis- or enable a cell for input
             if ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
              ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
             else.
              ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
             endif.
             modify ls_outtab-celltab from ls_celltab.
            endif.
          endloop.
          modify gt_outtab from ls_outtab index es_row_no-row_id.
        call method sender->refresh_table_display.
    endmethod.
    endclass.
          MAIN                                                          *
    end-of-selection.
      call screen 100.
          MODULE PBO OUTPUT                                             *
    module pbo output.
      set pf-status 'MAIN100'.
      set titlebar 'MAIN100'.
      if g_custom_container is initial.
        perform create_and_init_alv.
      endif.
    endmodule.
          MODULE PAI INPUT                                              *
    module pai input.
      save_ok = ok_code.
      clear ok_code.
      case save_ok.
        when 'EXIT'.
          perform exit_program.
        when 'SELECT'.
          perform select_all_entries changing gt_outtab[].
        when 'DESELECT'.
          perform deselect_all_entries changing gt_outtab[].
        when 'RESET'.
          perform reset_selected_entries changing gt_outtab[].
        when 'SWITCH'.
          perform switch_activation changing gt_outtab[].
      endcase.
    endmodule.
          FORM EXIT_PROGRAM                                             *
    form exit_program.
      leave program.
    endform.
    *&      Form  BUILD_FIELDCAT
          text
         <--P_GT_FIELDCAT  text
    form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
      call function 'LVC_FIELDCATALOG_MERGE'
           exporting
                i_structure_name = 'SFLIGHT'
           changing
                ct_fieldcat      = pt_fieldcat.
    *§A2.Add an entry for the checkbox in the fieldcatalog
      clear ls_fcat.
      ls_fcat-fieldname = 'CHECKBOX'.
    Essential: declare field as checkbox and
               mark it as editable field:
      ls_fcat-checkbox = 'X'.
      ls_fcat-edit = 'X'.
    do not forget to provide texts for this extra field
      ls_fcat-coltext = text-f01.
      ls_fcat-tooltip = text-f02.
      ls_fcat-seltext = text-f03.
    optional: set column width
      ls_fcat-outputlen = 10.
      append ls_fcat to pt_fieldcat.
    endform.
    *&      Form  CREATE_AND_INIT_ALV
          text
         <--P_GT_OUTTAB  text
         <--P_GT_FIELDCAT  text
         <--P_GS_LAYOUT  text
    form create_and_init_alv.
      data: lt_exclude type ui_functions.
      create object g_custom_container
             exporting container_name = g_container.
      create object g_grid
             exporting i_parent = g_custom_container.
      perform build_fieldcat changing gt_fieldcat.
    Exclude all edit functions in this example since we do not need them:
      perform exclude_tb_functions changing lt_exclude.
      perform build_data.
    *§ B3.Use the layout structure to aquaint additional field to ALV.
      gs_layout-stylefname = 'CELLTAB'.
      call method g_grid->set_table_for_first_display
           exporting is_layout             = gs_layout
                     it_toolbar_excluding  = lt_exclude
           changing  it_fieldcatalog       = gt_fieldcat
                     it_outtab             = gt_outtab[].
      create object g_event_receiver.
      set handler g_event_receiver->catch_doubleclick for g_grid.
    Set editable cells to ready for input initially
      call method g_grid->set_ready_for_input
       exporting
        i_ready_for_input = 1.
    endform.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
          text
         <--P_LT_EXCLUDE  text
    form exclude_tb_functions changing pt_exclude type ui_functions.
      data ls_exclude type ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
      append ls_exclude to pt_exclude.
    endform.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_data
          text
    -->  p1        text
    <--  p2        text
    form build_data.
      data: lt_sflight type table of sflight,
            ls_sflight type sflight,
            ls_celltab type lvc_s_styl,
            lt_celltab type lvc_t_styl,
            l_index type i.
      select * from sflight into table lt_sflight up to g_max rows.
      if sy-subrc ne 0.
    generate own entries if db-table is empty so that this example
    still works
        perform generate_entries changing lt_sflight.
      endif.
    *§A3.Optionally, check checkboxes initially after selecting data.
    (Omitted in this example)
      loop at lt_sflight into ls_sflight.
        move-corresponding ls_sflight to gt_outtab.
      if gt_outtab-connid eq '400'.
        gt_outtab-checkbox = 'X'.
      endif.
        append gt_outtab.
      endloop.
    §B2.After selecting data,
       assign a style for each row of your checkbox column.
    Initially, set all checkbox cells editable.
      ls_celltab-fieldname = 'CHECKBOX'.
      ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
      loop at gt_outtab.
        l_index = sy-tabix.
        refresh lt_celltab.
        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 gt_outtab-celltab.
        modify gt_outtab index l_index.
      endloop.
    endform.                               " build_data
    *&      Form  generate_entries
          text
         <--P_LT_SLFIGHT  text
    form generate_entries changing pt_slfight type standard table.
    This form is only needed for the case that there is no
    data in database table SFLIGHT.
      data: ls_sflight type sflight,
            l_month(2) type c,
            l_day(2) type c,
            l_date(8) type c.
      ls_sflight-carrid = 'LH'.
      ls_sflight-connid = '0400'.
      ls_sflight-currency = 'DEM'.
      ls_sflight-planetype = '747-400'.
      ls_sflight-seatsmax = 660.
      do 110 times.
        ls_sflight-price = sy-index * 100.
        ls_sflight-seatsocc = 660 - sy-index * 6.
        ls_sflight-paymentsum = ls_sflight-seatsocc * ls_sflight-price.
        l_month = sy-index / 10 + 1.
        do 2 times.
          l_day = l_month + sy-index * 2.
          l_date+0(4) = '2000'.
          l_date4(2) = l_month0(2).
          l_date6(2) = l_day0(2).
          ls_sflight-fldate = l_date.
          append ls_sflight to pt_slfight.
        enddo.
      enddo.
    endform.                               " generate_entries
    *&      Form  select_all_entries
          text
         <--P_GT_OUTTAB  text
    form select_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c,
            l_locked type c.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
          you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        loop at pt_outtab into ls_outtab.
          perform check_lock using    ls_outtab
                             changing l_locked.
          if l_locked is initial
             and not ls_outtab-checkbox eq '-'.
            ls_outtab-checkbox = 'X'.
          endif.
          modify pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " select_all_entries
    *&      Form  deselect_all_entries
          text
         <--P_GT_OUTTAB[]  text
    form deselect_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c,
            l_locked type c.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
          you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        loop at pt_outtab into ls_outtab.
          perform check_lock using    ls_outtab
                           changing l_locked.
          if l_locked is initial
             and not ls_outtab-checkbox eq '-'.
            ls_outtab-checkbox = ' '.
          endif.
          modify pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " deselect_all_entries
    *&      Form  reset_selected_entries
          text
         <--P_GT_OUTTAB[]  text
    form reset_selected_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c.
    *§A4b. Before you set, (b)reset or evaluate checkboxes,
         you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        loop at pt_outtab into ls_outtab.
          if     not ls_outtab-checkbox is initial
             and not ls_outtab-checkbox eq '-'.
            clear ls_outtab.
            modify pt_outtab from ls_outtab.
          endif.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " reset_selected_entries
    form switch_activation changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c,
            lt_row_no type lvc_t_roid with header line.
    *§A4c. Before you set, reset, (c)(de)activate
         or evaluate checkboxes, you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
      call method g_grid->check_changed_data
                  importing
                     e_valid = l_valid.
      if l_valid eq 'X'.
        call method g_grid->get_selected_rows
          importing
             et_row_no     = lt_row_no[].
        loop at lt_row_no.
           read table pt_outtab into ls_outtab index lt_row_no-row_id.
           if ls_outtab-checkbox ne '-'.
             ls_outtab-checkbox = '-'.
           else.
             ls_outtab-checkbox = ' '.
           endif.
           modify pt_outtab from ls_outtab index lt_row_no-row_id.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " switch_activation
    *&      Form  check_lock
          text
         -->P_LS_OUTTAB  text
         <--P_L_LOCKED  text
    form check_lock using    ps_outtab type gs_outtab
                    changing p_locked.
      data ls_celltab type lvc_s_styl.
      loop at ps_outtab-celltab into ls_celltab.
        if ls_celltab-fieldname = 'CHECKBOX'.
          if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
            p_locked = 'X'.
          else.
            p_locked = space.
          endif.
        endif.
      endloop.
    endform.                               " check_lock
    Regards,
    Sindhu

  • TO enable the menu button in ALV Grid Display

    Hi Mates,
    I have a peculiar problem while doing ALV Grid display for screens.
    In the main Screen i have Three coloumns.The 1st coloum will interacted
    next screen 101 and 2nd coloum will interacted to screen 102.
    Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen
    101 and same button is disabled in screen 102.
    But the code semms to be fine .
    Below i have pasted the code and please have a look and help to come out of this cris.
    My Code  :
    FORM CREATE_ALV_GRID USING R_SCREEN.
      DATA: LS_LAYOUT TYPE LVC_S_LAYO,
      ITAB_FUNCTIONS     TYPE UI_FUNCTIONS.   "MHTK903257(+)(add)
      CASE R_SCREEN.
    *--> SCREEN 9000
        WHEN C_SCREEN_9000.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' 'WADAT'     'Due date'(004)  'X' 'D' ' ' ' ' ' ' 'C100',
    *'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500',  "MHTK903257(-)
    'ITAB_OVERVIEW' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:
    'ITAB_OVERVIEW' 'EST_TO'    'Estim TO'(030)    ' ' 'I' ' '  ' ' ' ' 'C500'.
          LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'.  "MHTK903418
            ENDLOOP.
          LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1000
            EXPORTING
              I_PARENT  = PT_DOCK_1000.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1000
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_OVERVIEW
              IT_FIELDCATALOG = ITAB_FIELDCAT_9000.
    *--> SCREEN 9100
        WHEN C_SCREEN_1100.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETIAL' 'WAUHR'     'Due time'(007)  ' ' 'T' ' ' 'X' ' ' 'C100',
    'ITAB_DETAIL' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    'ITAB_DETAIL' 'EST_TO'    'Estim TO'(030)   ' ' 'I' ' '  ' ' ' ' 'C500'.
       CLEAR ITAB_INB_LOC.
        LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.
             CHECK SY-SUBRC EQ 0.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.
         ENDLOOP.
         CLEAR: ITAB_STORAGE_TYPE.
          LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.
            CHECK SY-SUBRC EQ 0.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1100
            EXPORTING
              I_PARENT  = PT_DOCK_1100.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1100
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_DETAIL
              IT_FIELDCATALOG = ITAB_FIELDCAT_1100.
    screen 1300 TO detail.
    *--> SCREEN 9300
        WHEN C_SCREEN_1300.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_TO2' 'TANUM' 'TO'(020)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_TO2' 'NLPLA' 'Location'(021) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'LETY1' 'SUT'(013)  ' ' 'C'  ' ' ' ' ' ' 'C500',
    'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    *'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1300
            EXPORTING
              I_PARENT  = PT_DOCK_1300.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1300
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_TO2 BY TANUM VBELN POSNR.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_TO2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1300.
    screen 9400 Pre Processing detail.
    *--> SCREEN 9400
        WHEN C_SCREEN_9400.          "MHTK903418(BEgin Of change)
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' '   'C' ' '  ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' '   'C' ' '  ' ' ' ' 'C500'.
    *'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    **'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1400
            EXPORTING
              I_PARENT  = PT_DOCK_1400.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1400
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_PRE_PROC2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1400.  "MHTK903418(End of change)
      ENDCASE.

    Hi
    U copy from standard program and paste ur report ...It will work..'
    Regards:
    Prabu

  • Selection using check box in std ALV grid!

    Hi all,
    I have written a custom report to show the O/p in ALV grid.
    This is my code:
    TABLES :zpo_loi.
    TYPE-POOLS : slis.
    TYPE-POOLS: icon.
    TABLES : sscrfields.
    DATA : ls_composer TYPE ssfcompop,
               ls_control TYPE ssfctrlop.
    DATA : wa_return TYPE TABLE OF bapiret2  ,
            wa_address TYPE bapiaddr3.
    DATA : wa_crmd_orderadm_h TYPE zpo_loi,
           it_po TYPE TABLE OF crmd_orderadm_h,
           wa_po TYPE bbp_pds_header.
    DATA : it_tab TYPE TABLE OF zpo_loi.
    DATA :  it_data TYPE TABLE OF crmd_orderadm_h,
            wa_data TYPE bbp_pds_header,
            et_data TYPE bbps_sf_po_output.
    DATA : w_formname TYPE tdsfname ,
           w_sfname TYPE rs38l_fnam.
    DATA :it_po_no TYPE TABLE OF select_be_obj_id,
          wa_it_po_no  LIKE LINE OF it_po_no.
    DATA :r_itab TYPE ddshretval OCCURS 0.
    DATA : it_output LIKE TABLE OF zloi,
           wa_output TYPE zloi.
    DATA : w_answer TYPE c.
    DATA : g_repid LIKE sy-repid,
          g_title TYPE lvc_title,
          g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
          g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
          g_layout TYPE slis_layout_alv,
          g_print_alv TYPE slis_print_alv,
          g_variant LIKE disvariant,
          c_char_a(1) VALUE 'A',
          c_char_x(1) VALUE 'X',
          itab_alv_sort TYPE slis_t_sortinfo_alv,
          itab_alv_fcat TYPE slis_t_fieldcat_alv.
    *       Internal tables          Begin with IT_                       *
    DATA : it_fcat TYPE slis_t_fieldcat_alv,                           "---ALV
           it_disp TYPE TABLE OF zloi.
    *       Work Area for Internal tables      Begin with WA_             *
    DATA : wa_fcat TYPE slis_fieldcat_alv ,              "---ALV
           wa_layout           TYPE lvc_s_layo,               "---ALV
           wa_it_disp LIKE LINE OF it_disp.
    DATA : it_sf_po TYPE TABLE OF crmd_orderadm_h,
           wa_sf_po TYPE bbp_pds_header.
    *SELECTION-SCREEN:
    *  BEGIN OF SCREEN 500 AS WINDOW TITLE title,
    *  END OF SCREEN 500.
    *DATA : functxt TYPE smp_dyntxt.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS sel_po FOR zpo_loi-zobject_id.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : pr_loi RADIOBUTTON GROUP grp1 USER-COMMAND ucom,
                 pr_fondo RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN END OF BLOCK b2.
    *       At selection-screen output                                    *
    AT SELECTION-SCREEN OUTPUT.
      IF pr_fondo = 'X'.
        REFRESH sel_po.
        LOOP AT SCREEN.
          IF screen-name = text-003 OR screen-name = text-004.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSEIF pr_loi = 'X'.
        LOOP AT SCREEN.
          IF screen-name = text-003 OR screen-name = text-004.
            screen-input = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *       At selection-screen on radiobutton                            *
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP grp1.
      IF pr_fondo  = 'X'.
        REFRESH sel_po.
        LOOP AT SCREEN.
          IF screen-name = text-003 OR screen-name = text-004.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSEIF pr_loi = 'X'.
        LOOP AT SCREEN.
          IF screen-name = text-003 OR screen-name = text-004.
            screen-input = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-low.
      PERFORM populate_table.
      PERFORM f4_help.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-high.
      PERFORM populate_table.
      PERFORM f4_help.
    *       At selection-screen                                           *
    AT SELECTION-SCREEN.
    *---CHECKING THE INPUT >>>
      IF sy-ucomm = 'ONLI'.
        PERFORM f002-check_input.
        PERFORM f001-check.
      ENDIF.
    *&      Form  POPULATE_TABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM populate_table .
      SELECT zobject_id
               description
      FROM zpo_loi
      INTO CORRESPONDING FIELDS OF TABLE it_tab.
      SORT it_tab BY zobject_id ASCENDING.
    ENDFORM.                    " POPULATE_TABLE
    *&      Form  F4_HELP
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f4_help .
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          ddic_structure = ' '
          retfield       = 'ZOBJECT_ID'
          dynpprog       = sy-repid
          dynpnr         = sy-dynnr
          dynprofield    = 'A'
          value_org      = 'S'
        TABLES
          value_tab      = it_tab
          return_tab     = r_itab.
    ENDFORM.                                                    " F4_HELP
    *&      Form  F001-CHECK
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f001-check .
      IF pr_fondo = 'X'.
        PERFORM display_expiring_fondos.
      ELSEIF pr_loi = 'X'.
        PERFORM fetch_po_det.
        PERFORM build_fcat.
        PERFORM alv_display.
      ENDIF.
    ENDFORM.                    " F001-CHECK
    *&      Form  F002-CHECK_INPUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f002-check_input .
      IF pr_loi = 'X'.
        REFRESH it_po.
        IF sel_po-low IS NOT INITIAL.
          SELECT object_id
          FROM crmd_orderadm_h
          INTO CORRESPONDING FIELDS OF TABLE it_po
          WHERE object_type = 'BUS2201'
          AND object_id = sel_po-low.
          IF sy-subrc NE 0.
            IF sel_po-high IS NOT INITIAL.
              SELECT object_id
              FROM crmd_orderadm_h
              INTO CORRESPONDING FIELDS OF TABLE it_po
              WHERE object_type = 'BUS2201'
              AND  object_id = sel_po-high.
              IF sy-subrc NE 0.
                MESSAGE e009(zsrm).
              ENDIF.
            ENDIF.
            MESSAGE e007(zsrm).
          ENDIF.
        ELSE.
          MESSAGE e010(zsrm).
        ENDIF.
        IF sel_po-high IS NOT INITIAL.
          SELECT object_id
          FROM crmd_orderadm_h
          INTO CORRESPONDING FIELDS OF TABLE it_po
          WHERE object_type = 'BUS2201'
          AND  object_id = sel_po-high.
          IF sy-subrc NE 0.
            MESSAGE e008(zsrm).
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " F002-CHECK_INPUT
    *&      Form  FETCH_PO_DET
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fetch_po_det .
      REFRESH it_po.
      it_po_no[] = sel_po[].
      DATA : w_count TYPE i,
             w_lines TYPE c,
             wa_header TYPE bbp_pds_po_header_d.
      REFRESH : it_po,it_output.
      IF sel_po-high IS NOT INITIAL.
        SELECT object_id
               description
               posting_date
               created_by
        FROM crmd_orderadm_h
        INTO CORRESPONDING FIELDS OF TABLE it_po
        WHERE object_type = 'BUS2201'
        AND object_id BETWEEN sel_po-low AND sel_po-high.
      ELSE.
        SELECT object_id
               description
               posting_date
               created_by
        FROM crmd_orderadm_h
        INTO CORRESPONDING FIELDS OF TABLE it_po
        WHERE object_type = 'BUS2201'
        AND object_id = sel_po-low.
      ENDIF.
      w_lines = sy-dbcnt.
      w_count = 1.
      DO.
        IF w_count LE w_lines.
          READ TABLE it_po INTO wa_po INDEX w_count.
          MOVE wa_po-object_id TO wa_output-zzpono.
          MOVE wa_po-description TO wa_output-zzpodesc.
          MOVE wa_po-posting_date TO wa_output-zzpodate.
          MOVE wa_po-created_by TO wa_output-zzpocreator.
          CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
            EXPORTING
              i_object_id = wa_output-zzpono
            IMPORTING
              e_header    = wa_header.
          CALL FUNCTION 'BAPI_USER_GET_DETAIL'
            EXPORTING
              username = wa_output-zzpocreator
            IMPORTING
              address  = wa_address
            TABLES
              return   = wa_return.
          CLEAR wa_output-zzpocreator.
          CONCATENATE wa_address-firstname '   '  wa_address-lastname INTO wa_output-zzpocreator .
          MOVE wa_header-total_value TO wa_output-zzpoval.
          MOVE wa_header-currency TO wa_output-zzpocur.
          APPEND wa_output TO it_output.
          w_count = w_count + 1.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.                    " FETCH_PO_DET
    *&      Form  BUILD_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fcat .
      g_repid = sy-repid.
      g_title = 'Print LOI details'.
      g_print_alv-no_print_listinfos = 'X'.
      g_variant-report = sy-repid.
      g_variant-variant = sy-title.
      CLEAR g_layout.
      g_layout-f2code = ' '.
      wa_layout-zebra       = 'X'.
      g_layout-flexible_key = 'X'.
      g_layout-colwidth_optimize = 'X'.
      g_layout-detail_initial_lines = 'X'.
      g_layout-box_fieldname = 'ZZCHECK'.
      REFRESH it_fcat.
    *Po no
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'ZZPONO' .
      wa_fcat-tabname = 'IT_DISP'.
      wa_fcat-seltext_m  = 'Purchase Order'.
    *wa_fcat-seltext_s = 'Purchase Order.
      wa_fcat-icon = 'X'.
      wa_fcat-col_pos = '2'.
      wa_fcat-outputlen = 10.
      APPEND wa_fcat TO it_fcat.
    *Description
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'ZZPODESC' .
      wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Description'.
      wa_fcat-seltext_m = 'Description'.
    *wa_fcat-seltext_s = 'Description'.
      wa_fcat-col_pos = '3'.
      wa_fcat-outputlen = 10.
      APPEND wa_fcat TO it_fcat.
    *Posting date
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'ZZPODATE' .
      wa_fcat-tabname = 'IT_DISP'.
      wa_fcat-seltext_l = 'Posting Date'.
      wa_fcat-seltext_m = 'Posting Date'.
    *wa_fcat-seltext_s = 'Posting Date'.
      wa_fcat-col_pos = '4'.
      wa_fcat-outputlen = 8.
      APPEND wa_fcat TO it_fcat.
    *value
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'ZZPOVAL' .
      wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO value'.
      wa_fcat-seltext_m = 'PO value'.
    *wa_fcat-seltext_s = 'PO value'.
      wa_fcat-col_pos = '5'.
      wa_fcat-outputlen = 15.
      wa_fcat-no_zero = 'X'.
      APPEND wa_fcat TO it_fcat.
    *Currency
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'ZZPOCUR' .
      wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO Currency'.
      wa_fcat-seltext_m = 'PO Currency'.
    *wa_fcat-seltext_s = 'PO Currency'.
      wa_fcat-col_pos = '6'.
      wa_fcat-outputlen = 5.
      APPEND wa_fcat TO it_fcat.
    *Creator
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'ZZPOCREATOR' .
      wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Buyer'.
      wa_fcat-seltext_m = 'Buyer'.
    *wa_fcat-seltext_s = 'Buyer'.
      wa_fcat-col_pos = '7'.
      wa_fcat-outputlen = 12.
      APPEND wa_fcat TO it_fcat.
    ENDFORM.                    " BUILD_FCAT
    *&      Form  ALV_DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM alv_display .
      SORT it_output BY zzpono.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = g_repid
          i_callback_pf_status_set = g_set_pf_stat
          i_callback_user_command  = g_user_command
          i_grid_title             = g_title
          is_layout                = g_layout
          it_fieldcat              = it_fcat[]
          is_variant               = g_variant
          is_print                 = g_print_alv
        TABLES
          t_outtab                 = it_output[]
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  user_command
    *       text
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.                             "#EC CALLED
      DATA: gd_repid LIKE sy-repid, "Exists
      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 NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      rs_selfield-refresh = 'X'.
      CASE r_ucomm.
        WHEN 'PRINTLOI'.
          PERFORM call_sf.
        WHEN 'BACK'.
          CALL SELECTION-SCREEN 1000.
        WHEN 'CANCEL'.
          CALL SELECTION-SCREEN 1000.
        WHEN 'EXIT'.
          CALL SELECTION-SCREEN 1000.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  set_pf_status
    *       text
    *      -->RT_EXTAB   text
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZALV' EXCLUDING rt_extab.
      SET TITLEBAR 'ZALV'.
    ENDFORM.                    "set_pf_status
    *&      Form  CALL_SF
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM call_sf .
      REFRESH it_sf_po.
      LOOP AT it_output INTO wa_output WHERE zzcheck = 'X'.
        wa_sf_po-object_id = wa_output-zzpono.
        APPEND wa_sf_po TO it_sf_po.
      ENDLOOP.
      w_formname = 'ZSR_EBP_DOCU_LETTEROFINTENT1'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = w_formname
        IMPORTING
          fm_name            = w_sfname
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
      ENDIF.
      ls_composer-tdnewid = 'X'.
      ls_control-no_dialog = 'X'.
      LOOP AT it_sf_po INTO wa_sf_po.
        CALL FUNCTION w_sfname
          EXPORTING
            control_parameters = ls_control
            output_options     = ls_composer
            wa_object          = wa_sf_po
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
        IF sy-subrc <> 0.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " CALL_SF
    *&      Form  DISPLAY_EXPIRING_FONDOS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display_expiring_fondos .
      SET PF-STATUS 'ZLOI'.
      SET TITLEBAR 'ZLOI'.
      TYPES : BEGIN OF ty_output1,
                guid TYPE bbp_guid,
                object_id TYPE crmt_object_id_db,
                description TYPE crmt_process_description,
                posting_date TYPE crmt_posting_date,
                zzfondo_dat TYPE zfondo_dat,
                created_by TYPE crmt_created_by,
               END OF ty_output1.
      DATA : it_output1 TYPE TABLE OF ty_output1,
             wa_output1 TYPE ty_output1,
              w_lines,
              w_count,
              it_fondo TYPE TABLE OF zsr_fondo,
              it_temp_fondo TYPE TABLE OF zsr_fondo,
              wa_temp_fondo TYPE zsr_fondo,
              wa_fondo TYPE zsr_fondo,
              w_diff TYPE p,
              wa_header1  TYPE bbp_pds_po_header_d.
      CONSTANTS : c_otype(8) VALUE 'BUS2201'.
      REFRESH : it_output1,it_temp_fondo,it_fondo.
      SELECT b~zzfondo_dat
             a~guid
             a~object_id
             a~description
             a~posting_date
             a~created_by
      INTO CORRESPONDING FIELDS OF TABLE it_output1
      FROM bbp_pdhsc AS b
      LEFT OUTER JOIN crmd_orderadm_h AS a ON b~guid = a~guid
      AND a~object_type = c_otype.
      LOOP AT it_output1 INTO wa_output1.
        CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
          EXPORTING
            date1            = sy-datum
            date2            = wa_output1-zzfondo_dat
          IMPORTING
            datediff         = w_diff
          EXCEPTIONS
            invalid_datetime = 1
            OTHERS           = 2.
        IF sy-subrc <> 0.
        ENDIF.
        IF w_diff <= '7'.
          wa_temp_fondo-zzpono = wa_output1-object_id.
          APPEND wa_temp_fondo TO it_temp_fondo.
        ENDIF.
      ENDLOOP.
    *select the final entries for PO whose FONDO is expiring
      DESCRIBE TABLE it_temp_fondo LINES w_lines.
      w_count = 1.
      DO.
        IF w_count LE w_lines.
          READ TABLE it_temp_fondo INTO wa_temp_fondo INDEX w_count.
          IF sy-subrc = 0.
            CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
              EXPORTING
                i_object_id = wa_temp_fondo-zzpono
              IMPORTING
                e_header    = wa_header1.
            wa_fondo-zzpono = wa_temp_fondo-zzpono.
            wa_fondo-zzpodesc = wa_header1-description.
            wa_fondo-zzpodate =  wa_header1-posting_date.
            wa_fondo-zzexpdate = wa_header1-zzfondo_dat.
            wa_fondo-zzpoval = wa_header1-total_value.
            wa_fondo-zzpocur = wa_header1-currency.
            wa_fondo-zzpocreator = wa_header1-created_by.
            CLEAR : wa_address.
            REFRESH wa_return.
            CALL FUNCTION 'BAPI_USER_GET_DETAIL'
              EXPORTING
                username = wa_header1-created_by
              IMPORTING
                address  = wa_address
              TABLES
                return   = wa_return.
            CLEAR wa_fondo-zzpocreator.
            CONCATENATE wa_address-firstname '   '  wa_address-lastname INTO wa_fondo-zzpocreator .
            w_count = w_count + 1.
            APPEND wa_fondo TO it_fondo.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_structure_name = 'ZSR_FONDO'
          i_grid_title     = 'EXPIRING FONDOS'
        TABLES
          t_outtab         = it_fondo[]
        EXCEPTIONS
          program_error    = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    " DISPLAY_EXPIRING_FONDOS
    Now in my ALV grid o/p i can see the check box but if i select one row and then try to select another the first one gets deselected.
    Can anybody tell me what is missing?

    Hi,
    Try like changing  this
    insted of
    g_layout-f2code = ' '.
    use this
    g_layout-f2code = 'DISP'. " Sets fcode for when double
    and
    g_layout-f2code = '&ETA'. " it will display POPUP screen
    Best Regards
    Ranga
    Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
    Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM

  • How to handle check box click in ALV grid

    Hi Experts,
    I use ALV grid using FM.
    I have list of delivery note items with one custom field as check-box. When I check the checkbox, all other lines related to the same delivery note should be automaticaly checked.
    Is there any event or function code, where I can handle single click to checkbox?
    Thanks&regards, 
    Jirka

    HI
    you can use following code in user command function .
    DATA :BEGIN OF IT_MAINDATA OCCURS 0,
          MAINDATA(1),
          IT_RD1(1),
    END OF IT_MAINDATA.
    data: V_INDEX TYPE I.
    DESCRIBE TABLE itab LINES LINE.
      DO. " line times.
        READ LINE SY-INDEX FIELD VALUE Iitab-RD1.
        IF SY-SUBRC NE 0. EXIT. ENDIF.
        CHECK V_INDEX > 0.
        CHECK itab-RD1 = 'X'.
        MODIFY itab INDEX V_INDEX.
        IT_MAINDATA-IT_RD1 = Iitab-RD1.
      ENDDO.
    i think is work.
    regards,
    Abhi

  • Check box color in alv grid

    Hi friends,
    My requirement is , i am displaying data in alv grid with check box,here i want when we select check box then that realated line should be appear in the Blue color,can any one support me , Thanku in advance

    Hi danish,
    Thanku for the reply,but i doesnt work ,can u observe this code and give me your suggestion eloborately.
      gwa_fldcat-col_pos       = 2.
      gwa_fldcat-fieldname     = 'CHK'.
      gwa_fldcat-tabname       = 'GT_FINAL'.
      gwa_fldcat-EMPHASIZE = 'C310'.
       gwa_fldcat-input        = 'X'.
      gwa_fldcat-edit          = 'X'.
      gwa_fldcat-checkbox      = 'X'.
      gwa_fldcat-just          = 'C'.
      gwa_fldcat-key           = 'X'.
      gwa_fldcat-outputlen     = 16.
      gwa_fldcat-seltext_l     = 'Selection'.
      APPEND gwa_fldcat TO git_fldcat.
      CLEAR gwa_fldcat.
    FORM build_catalog .
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-zebra             = 'CHK'.
      gs_layout-info_fieldname = 'LINE_COLOR'.
    gs_layout-box_fieldname     = 'CHK'.
      gs_layout-box_tabname       =  'GT_FINAL-CHK'.
    ENDFORM.                    " BUILD_CATALOG
    *&      Form  USER
    FORM user USING lv_okcode   LIKE sy-ucomm
                           rs_selfield TYPE slis_selfield.
    assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    CASE sy-ucomm.
    handle the code execution based on the function code encountered
      CASE lv_okcode.
    loop at gt_final where chk = 'X'.
      gt_final-line_color = 'C110' .
    endloop.
        WHEN 'EXECUTE'.
          PERFORM execute.
        WHEN 'SELECTALL'.
          PERFORM selectall.
        WHEN 'DESELCTALL'.
          PERFORM deselectall.
        WHEN 'ASCENDING'.
          PERFORM ascending.
        WHEN 'DESCENDING'.
          PERFORM descending.
      ENDCASE.
      PERFORM alv.
    ENDFORM.

  • How to handle the check box in the alv tree display

    Hello,
    in my ALV Tree Report i have a check box in the output.
    I have one check box in the selection screen as select all .
    if this is selected then all the check boxes in the output must be selected that is (X).
    am using CL_GUI_ALV_TREE  for this.
    Please give me some input how to make that check boxes 'X' in the above mentioned case.
    With Regards,
    Sumodh.P

    Sumodh,
    check this
    Re: Select all checkbox in ALV tree
    please search before posting
    Thanks
    Bala Duvvuri

  • ALV Grid Display Editable Field Disables Zebra Style

    Hi all,
    First of all, I want to say: "I did my research." I found a post with a very similar question but not identically my case, or at least I can't solve it the same way. [Here is the reference post.|Re: Check box impact on ALV grid (Using OOPS)]
    My Goal: I have an ALV Grid which I want to display using the ZEBRA style in the layout and also make one field in the field catalog editable.
    My Issue: As soon as you make one field editable in the field catalog using the EDIT option, the ZEBRA style in the layout does not works. I also have key fields in the ALV Grid which I want to keep as KEY and which get painted dark blue.
    I can't use the individual row coloring method used in the reference link above since this overrides the blue coloring of the key fields in the ALV. I haven't gone through all the effort of individually painting each cell on the grid, and honestly I don't think it is efficient.
    My Question: Is there a way to have editable fields in the ALV Grid and keep the ZEBRA setting working?
    Please, I will really appreciate if you can read and try to understand my issue before posting incoherent solutions or answers. I don't want to waste anybody's time nor mine.

    Shiva,
    Thanks for your reply; it someway addresses what I am looking for. Unfortunately, I've already went through that reference code; it has exactly the same problem that I am facing.
    If you take that code for example, and you throw it u201Cas-isu201D in your ABAP editor you'll see that even when the ZEBRA style is being used in the layout, since the EDIT option in the field catalog is being set for field NETPR, the ZEBRA style gets lost; only the whole editable column gets white. You can go ahead and play a little bit with that piece of code and you will see what I am saying.
    Regards

  • 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

  • Cell wise and row wise check box in oops alv

    Normally column wise check box are possible in oops alv but how to possible check box in first row only in oops alv and Cell wise check box in oops alv?

    Hi,
    Try like changing  this
    insted of
    g_layout-f2code = ' '.
    use this
    g_layout-f2code = 'DISP'. " Sets fcode for when double
    and
    g_layout-f2code = '&ETA'. " it will display POPUP screen
    Best Regards
    Ranga
    Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
    Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM

  • How to add check box in the ALV list

    dear Experts,
                 i have a requirement.
    i want show the check boxes in my ALV list.
    can u please give the solution.
    thanks

    TYPE-POOLS: slis.
    *---internal tables
    DATA: BEGIN OF it_flight OCCURS 0,
    SEL, " add a single character field in the final output table
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight,
    *--internal tables for alv
    it_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fcat LIKE LINE OF it_fieldcat,
    layout TYPE slis_layout_alv,
    it_sort type slis_t_sortinfo_alv,
    wa_sort like line of it_sort.
    DATA: BEGIN OF it_flight_sel OCCURS 0,
    SEL,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight_sel.
    data: wa_flight like it_flight.
    In the layout set give the name of the field
    whose checkbox will be created ( SEL as it has 1 char only )
    layout-box_fieldname = 'SEL'.
    *---start-of-selection .
    START-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'IT_FLIGHT'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = it_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2.
    *----get data
    SELECT carrid
    connid
    fldate
    seatsmax
    seatsocc
    FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE it_flight
    UP TO 20 ROWS.
    wa_fcat-do_sum = 'X'.
    MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
    WHERE fieldname = 'SEATSOCC' .
    wa_sort-fieldname = 'CARRID'.
    wa_sort-group = 'UL'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    wa_sort-fieldname = 'CONNID'.
    wa_sort-subtot = 'X'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    is_layout = layout
    it_fieldcat = it_fieldcat
    it_sort = it_sort
    TABLES
    t_outtab = it_flight
    EXCEPTIONS
    program_error = 1.
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
    loop at it_flight into wa_flight.
    if wa_flight-Sel EQ 'X'.
    collecting records in table it_flight_sel to process further
    append wa_flight to it_flight_sel.
    clear wa_flight.
    TYPE-POOLS: slis.
    *---internal tables
    DATA: BEGIN OF it_flight OCCURS 0,
    SEL, " add a single character field in the final output table
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight,
    *--internal tables for alv
    it_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fcat LIKE LINE OF it_fieldcat,
    layout TYPE slis_layout_alv,
    it_sort type slis_t_sortinfo_alv,
    wa_sort like line of it_sort.
    DATA: BEGIN OF it_flight_sel OCCURS 0,
    SEL,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight_sel.
    data: wa_flight like it_flight.
    In the layout set give the name of the field
    whose checkbox will be created ( SEL as it has 1 char only )
    layout-box_fieldname = 'SEL'.
    *---start-of-selection .
    START-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'IT_FLIGHT'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = it_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2.
    *----get data
    SELECT carrid
    connid
    fldate
    seatsmax
    seatsocc
    FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE it_flight
    UP TO 20 ROWS.
    wa_fcat-do_sum = 'X'.
    MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
    WHERE fieldname = 'SEATSOCC' .
    wa_sort-fieldname = 'CARRID'.
    wa_sort-group = 'UL'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    wa_sort-fieldname = 'CONNID'.
    wa_sort-subtot = 'X'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    is_layout = layout
    it_fieldcat = it_fieldcat
    it_sort = it_sort
    TABLES
    t_outtab = it_flight
    EXCEPTIONS
    program_error = 1.
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
    loop at it_flight into wa_flight.
    if wa_flight-Sel EQ 'X'.
    collecting records in table it_flight_sel to process further
    append wa_flight to it_flight_sel.
    clear wa_flight.
    Please follow the code.

  • Regarding output using alv grid display

    Hi experts,
        i have a program
    FS_TAB1-A = P_T1.
    IF P_T1 = 0.
      TEMP1 = 1.
      DO TEMP1 TIMES.
        FS_TAB1-A = P_T1 * DUMMY1.
        APPEND FS_TAB1 TO T_TAB1.
        DUMMY1 = DUMMY1  + 1.
      ENDDO.
    now i have to diplay the p_t1*dummy1 using alv grid display like it goes into thew  loop for ten times then i have to show it 10 times like
    10 1  102 103 104 111 112  like that can u help me

    hi,
        you have to get the result of the multiplication at each row and then concatenate the result and the factor to show the final result in multiples value and multiplication factor...

  • Capture Changes on ALV Grid Display

    Hi,
    I am displaying a check box on ALV Grid Display. I have to provide a push button on the application tool bar through which i have to perform some other action. How can i capture the changes made to that check box?
    I am using the FM 'REUSE_ALV_GRID_DISPLAY'.
    Thanks in Advance.
    Best Regards,
    Phani
    Message was edited by:
            Sivapuram Phani Kumar

    Hi Amit,
    Solved the problem... Thank you very much.
    Yesterday i have raised one more thread regarding an issue with ALV Grid... Can u please check and help me out. Here is the link for that issue...
    Issue with ALV Display
    Regards,
    Phani

  • Disabling "Default layout setting" in ALV grid display

    Hello,
       We have a requirement where we need to disable layout default settings in ALV grid display.
       Only certain users should be able to save the report layout as default.
       We would be creating an authorization group for this and then based on the Authority check we would need to enable or disable Default layout save option.
      I found that using I_SAVE in the FM "REUSE_ALV_GRID_DISPLAY", we can either enable or disable layout save option.
      But our requirement is to disable Default layout save option based on the authority check.
      We will find this option next to User specific option when we save the report layout.
      Can anyone guide me on this?
      Thanks,
    Regards,
    Anid

    Hi Anid,
    First of all check if you can do this excluding the buttons from the ALV with the excluding tab. If not, here is the code for the ALV OO to exclude the buttons.
    FORM F_DISPLAY_ALV.
    * Layout
    PERFORM f_layout.
    * Exclude Buttons
    DATA:  gt_excl           TYPE ttb_button
    REFRESH gt_excl.
    * Append those you want to exclude. These are some of them. Check Class in SE24 -> Atributes of class cl_gui_alv_grid.
    APPEND: cl_gui_alv_grid=>mc_fc_loc_cut            TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_undo           TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_copy           TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_paste          TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_copy_row       TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_move_row       TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_delete_row     TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_insert_row     TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_append_row     TO gt_excl,
            cl_gui_alv_grid=>mc_fc_loc_paste_new_row  TO gt_excl,
            cl_gui_alv_grid=>mc_fc_to_office          TO gt_excl,
            cl_gui_alv_grid=>mc_fc_expcrdesig         TO gt_excl.
    CALL METHOD gv_alv_grid->set_table_for_first_display
        EXPORTING
          it_toolbar_excluding       = gt_excl[]
          is_layout                     = wa_layout_main
          is_variant                    = wa_variant
          i_save                        = 'A'
        CHANGING
          it_outtab                     = gt_alv[]
          it_fieldcatalog               = gt_fieldcat[]
          it_sort                       = gt_sort[].
    Edited by: Ernesto Caballero on Mar 11, 2010 5:59 PM
    Edited by: Ernesto Caballero on Mar 11, 2010 6:03 PM

  • Field Catolgue in alv grid display

    Hi Abapers,
    I need to display the percentage rows with decimals and other rows without decimal . Is their any option in field catalog to do like this. Or tell me any other alternative to achieve this.
    sno  total     col1      col2      col3
    1      220       100        20       100
    2      320      120         50        150
    tot    540       220        70         250
    per               40.74     1.87  and so on
    or ,
    I have two different internal tables how can i put it in one field catalog to pass it to alv grid display.
    Regards,
    Priya

    Don't   do  total  by your  self  in the Pogram.
    in the   Fieldcatalog  there is an Attribute which will do total  &  Average .
    Enable it so that  from one  internal  table   data   it self it will do  good.
    example program
    Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
    display it using the basic ALV grid functionality(including column total). The example details the main
    sections of coding required to implement the ALV grid functionality:
                             Data declaration
                             Data retrieval
                             Build fieldcatalog
                             Build layout setup
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15. 
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
    *            i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
    *            IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    gowri
    Message was edited by:
            Gowri Krishna

Maybe you are looking for

  • Creating and Booting From Backup OS X Tiger Disk 1

    I work on two MacBook Pros (one running OS X 10.4, and one running OS X 10.5), and recently purchased a 2003 imac 1.25Ghz 17 inch model in great condition. It came with 10.3 installed, but also had the retail disks for OS X 10.4 Tiger with it. The Di

  • Cellular data not working after updating to ios 5.01

    After i updated ios 5.01 , i get the error could not suscribe to active cellular network even though i have my data plan package suscribed with my carrier I find that i have my internet plan valid till jan 2012 and some 1.5 GB of data left to transfe

  • Update E-Mail in vendor master

    Hi, As i am new to FI i am asking this basic question....how to update email in vendor master and where. Thanks Rafi

  • Update user staus on production order

    Hi, Can you please let me know if it is possible to update the user status on production order while saving. I have tried with exit PPCO0007 but with no success.    header_exp-astex = 'X'.    header_exp-asttx = 'XDIS'. I have checked exit PPCO0001,bu

  • CRM survey response did not create any activity

    Hi Gurus We are executing campaign with survey in email. It sent out email with survey link to contacts/customers and when survey is submitted with answers it is going to below ABAP dump. Note ■The following error occurred in system VSC : The current