Skip to Content
author's profile photo Former Member
Former Member

how to place am icon in alv

Dear Freinds,

I have a requirement when i have updated the data coming from alv ( using the function module 'REUSE_ALV_GRID_DISPLAY' or REUSE_ALV_LIST_DISPLAY ) . i want to select the checboxes on ALV ouput and execute( i want an additonal standard button) so that the data which is there on the alv output will be updated . Some times i dont want some data for that reason i require some cheboxes .

Could any please help me how to get an additional button on alv Tool bar and the checkboxes along withe the cells.

i have tried using the below code but iam not getting any new icon additonal to that

of the standard icons which are there from the below FM. If iam passing

CALLBACKPF_STATUS_SET = 'PROCESS_USER_COMMANDS' "'ZBUTTON'

i can seen none of the buttons on the tool bar, including the standard buttons are going

please help me .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_interface_check = ' '

i_callback_program = sy-repid

I_CALLBACK_PF_STATUS_SET = 'PROCESS_USER_COMMANDS' "'ZBUTTON'

i_callback_top_of_page = l_c_top_of_page

i_structure_name = c_i_final

is_layout = l_wa_layout

it_fieldcat = l_i_fieldcat

it_sort = l_i_sort[]

it_events = l_i_get_event

TABLES

t_outtab = fp_it_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE e131. " Displaying the ALV GRID has failed

ENDIF.

FORM PROCESS_USER_COMMANDS USING RT_EXTAB TYPE SLIS_T_EXTAB

systucomm LIKE syst-ucomm

selfield TYPE slis_selfield.

data : wa_fianl_alv type ty_final.

CASE systucomm.

WHEN '&IC1'.

  • get cursor field fieldname.

READ TABLE IT_FINAL into wa_fianl_alv INDEX selfield-tabindex.

SET PARAMETER ID 'EMPNP' FIELD wa_fianl_alv-empno .

  • call Transaction 'PA30' and skip first screen.

SET PF-STATUS 'ZSTANDARD'. " EXCLUDING RT_EXTAB.

ENDCASE.

ENDFORM. " PROCESS_USER_COMMANDS

In the addtion to this i want cheboxes along with the cells so that i can check and then execute ( the additonal button which i want along with ALV Grid).

regards

srini

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 02:57 PM

    Hi Kumar,

    you can get the solution by doing the following way.

    This internal has data and will be passed to the ALV function module later.

    DATA:BEGIN OF tbl_output OCCURS 0,  
          check TYPE charx,            "-----------CHECK BOX APPEARENCE-----
          vbeln LIKE vbak-vbeln,        "Sales Doc
          posnr LIKE vbap-posnr,        "Item-sales Doc
          omeng LIKE vbbe-omeng,        "Open qty
          color_line(04) TYPE c,
       END OF tbl_output.
    *---------------------------------------------------------------------*
    CONSTANTS:    c_standard(20) TYPE c             VALUE 'STANDARD',
                            c_user_command TYPE slis_formname VALUE  'USER_COMMAND',
                            c_pfstatus     TYPE slis_formname VALUE 'PF_STATUS_SET',
                            c_bcgrd        LIKE bapibds01-objkey VALUE 'ALV_BACKGROUND'.
    Start-of-selection.
    Perform get_data.  " fetch data from datbase depending on the selection screen params
    Perform begin_alv_process.
    *&---------------------------------------------------------------------*
    FORM begin_alv_prcoess.
      gv_repid =  sy-repid.
    * initialize layout
      PERFORM initialize_layout USING gs_layout.
    * Subroutine to build events
      PERFORM f_build_events.
    * fill fields to be output
      PERFORM fill_field_catalog.
    * call ALV function module
      PERFORM alv_grid_display.
    ENDFORM.                    " begin_Alv_prcoess }
    *&---------------------------------------------------------------------*
    
    FORM initialize_layout USING rs_layout TYPE slis_layout_alv.
      rs_layout-zebra        = c_x.         "Striped Pattern
      rs_layout-no_keyfix    = c_x.         "Fix Key columns
      rs_layout-max_linesize = 855.
    * Name of the field with color
      rs_layout-info_fieldname = 'COLOR_LINE'.
    ENDFORM.                    " initialize_layout
    *&---------------------------------------------------------------------*
    FORM fill_field_catalog.
      PERFORM build_catalog USING:
       'CHECK'   'TBL_OUTPUT'     'CHECK'     'TBL_OUTPUT'  'X'   ' ',
       'VBELN'   'TBL_OUTPUT'      'VBELN'      'TBL_OUTPUT'         ' '   text-005,
       'OMENG'  'TBL_OUTPUT'     'OMENG'   'TBL_OUTPUT'  'E'   text-008.
    ENDFORM.                    " fill_field_catalog
    *&---------------------------------------------------------------------*
    FORM build_catalog USING    p_ref_fieldname
                                p_ref_table
                                p_fieldname
                                p_table
                                p_check
                                p_short.
    *
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      ls_fieldcat-fieldname        = p_fieldname.
      ls_fieldcat-tabname          = p_table.
      ls_fieldcat-seltext_m        = p_short.
      ls_fieldcat-seltext_l        = p_short.
      ls_fieldcat-outputlen        = p_short.
      IF p_check = c_x.
        ls_fieldcat-checkbox = c_x.
        ls_fieldcat-input    = c_x.
      ENDIF.
      IF p_check = c_e.
        ls_fieldcat-input = c_x.
      ENDIF.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.                    " build_catalog
    *&---------------------------------------------------------------------*
    FORM alv_grid_display.
    * The order quantities in output report can be edited to print datasheet
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program       = gv_repid
                i_background_id          = c_bcgrd
                i_callback_pf_status_set = c_pfstatus
                i_callback_user_command  = c_user_command
                is_layout                = gs_layout
                it_fieldcat              = gt_fieldcat[]
                i_save                   = 'U'
                it_events                = tbl_alv_events[]
           TABLES
                t_outtab                 = tbl_output
           EXCEPTIONS
                program_error            = 1
                OTHERS                   = 2.
    ENDFORM.                    " alv_list_display
    *&---------------------------------------------------------------------*
    FORM pf_status_set USING extab TYPE slis_t_extab .
      REFRESH extab. CLEAR   extab.
      SET PF-STATUS 'ZDATASHEET'.
    ENDFORM.                    " PF_STATUS_SET
    *&---------------------------------------------------------------------*
    FORM user_command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN 'SALL'.
          LOOP AT tbl_output.
            tbl_output-check = c_x.
            MODIFY tbl_output TRANSPORTING check omeng.
          ENDLOOP.
        WHEN 'DSEL'.
          LOOP AT tbl_output.
            CLEAR tbl_output-check.
            MODIFY tbl_output TRANSPORTING check omeng.
          ENDLOOP.
        WHEN 'PRNT'.
          PERFORM  After_output_data.
          ENDCASE.
      selfield-refresh = c_x.
    ENDFORM.                    " USER_COMMAND 

    FORM f_build_events.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = tbl_alv_events

    EXCEPTIONS

    list_type_wrong = 1

    OTHERS = 2.

    • Add event name for User Command

    READ TABLE tbl_alv_events WITH KEY name = slis_ev_user_command

    INTO s_evts.

    IF sy-subrc = 0.

    s_evts-form = c_user_command.

    MODIFY tbl_alv_events FROM s_evts

    TRANSPORTING form

    WHERE name = slis_ev_user_command.

    CLEAR s_evts.

    ENDIF.

    ENDFORM. " f_build_events

    Regds

    Parvathi

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Siva Parvathi,

      Thank you for the solution , it is very much working me iam able to get the check boxes along with data and the Icon on the tool bar.

      Now if select the checkboxes(i.e resepective records) and when i click the button on the tool bar iam getting the interactive report ( the interactive report is for displaying the BDC details -log report) .

      Now could you let me know how can i schedule from here background the report .

      My requirement is i have to select all the records (which are required) through checkboxes and execute the button , then the BDC will trigger for the selected records . When iam executing in foreground the BDC for those selected Records is getting triggered. Further from the SM35 iam able to process those records.

      Now i wanted instead of executing foreground for the selected records can i execute Background? If so could you please let me know, as iam not able to run from the ALV screen in Background.

      thanks & regards

      Srini

  • Posted on Dec 19, 2008 at 02:06 PM

    Hi,

    First thing you need to do is separate the USER_COMMAND from the PF_STATUS_SET. Each one needs its own form routine. Put the names of the USER_COMMAND and PF_STATUS_SET routines in the REUSE_ALV function module in the relevant fields.

    The form for the PF_STATUS_SET should be like the following:

    FORM pf_status_set USING it_extab TYPE slis_t_extab.
    
      SET PF-STATUS 'STANDARD' EXCLUDING it_extab.
    
    ENDFORM.                    "pf_status_set

    The form for the USER_COMMAND should be like the following:

    FORM user_command   USING iv_ucomm     LIKE sy-ucomm
                              is_selfield TYPE slis_selfield.
    
    ENDFORM.                    "user_command

    Then, you need to copy the standard ALV grid from program SAPLKKBL (Function Group KKBL) to your program, and add the button(s) you need there.

    If it's still not showing, try to reset the ALV buffer by running report BALVBUFDEL.

    Best Regards,

    Guy.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 19, 2008 at 05:16 PM

    Hi,

    use these class

    CL_GUI_CUSTOM_CONTAINER

    and

    CL_GUI_ALV_TREE_SIMPLE

    Regard's

    Shaik.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.