Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

MODULE for ALV grid with selection

Former Member
0 Kudos

Greetings,

I'm in the midst of writing a dialogue application where based upon my screen 1100's entries a subsequent screen is called and an ALV grid is shown where my user can select entries within the ALV grid. The grid is to be filled with data from internal table. My struggle at the moment is building the ALV with the check boxes for selecting entries. I can put my data on the screen in a grid but not with select box capabilites. Any help of sample code or demo program in SAP 46C is appreciated.

Thanks!

1 ACCEPTED SOLUTION
5 REPLIES 5

0 Kudos

I have another stuggle with this now.. I'm able to get my checkbox to appear within my ALV grid and if I set my internal table fill in the field with 'X' / checks by default I'm able to remove the checkboxes in the grid and save it. However if I leave the field blank in my internal it displays an empty checkbox in my ALV grid however if I click into the checkbox to fill it in with a check, a check will appear for 1/2 second and then clear and my changes are not saved... weird.

In my field catalog I create the checkbox with ..

DATA ls_fcat TYPE lvc_s_fcat.

ls_fcat-fieldname = 'CHECK'.

ls_fcat-checkbox = 'X'.

ls_fcat-edit = 'X'.

ls_fcat-inttype = 'C'.

ls_fcat-outputlen = '1'.

ls_fcat-coltext = 'Checkbox'.

ls_fcat-seltext = 'Checkbox'.

APPEND ls_fcat TO pt_fieldcat.

What am I missing where is only lets me change the value from X to blank but not vice versa?

0 Kudos

Are you passing the field

LVC_S_LAYO-BOX_FNAME = 'CHECK' 

??

Regards,

Naimesh Patel

0 Kudos

No I haven't, coule you elaborate a little for as I'm fairly new to editing ALV grids, only used them reports in the past.

Many thanks!

0 Kudos
  DATA:
    wa_layout TYPE slis_layout_alv .


wa_layout-BOX_fieldname = 'CHECK'.   " << this will allow you to select the your Check box

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
    i_callback_program                = sy-cprog
*   I_CALLBACK_PF_STATUS_SET          = ' '
    i_callback_user_command           = 'USER_COMMAND'
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
      is_layout                         = wa_layout
      it_fieldcat                       = t_fcat_summary
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
      i_save                            = 'A'
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab                          = t_summary
   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.

Regards,

Naimesh Patel