Skip to Content
0
Former Member
Jan 21, 2008 at 04:14 PM

alvgrid+checkbox+custombutton+modify+multiplelines

32 Views

TYPE-POOLS: slis.

DATA: BEGIN OF itab OCCURS 0,

mara TYPE matnr,

check TYPE c,

selected type c,

END OF itab.

DATA: git_fieldcat TYPE slis_t_fieldcat_alv ,

gwa_fieldcat TYPE slis_fieldcat_alv.

data: it_event type SLIS_T_EVENT,

wa_event type slis_alv_event.

data: g_layout type slis_layout_alv.

SELECT matnr FROM mara INTO TABLE itab UP TO 10 ROWS

WHERE matnr NE space.

IF sy-subrc EQ 0.

g_layout-box_fieldname = 'SELECTED'.

g_layout-zebra = 'X'.

g_layout-colwidth_optimize = 'X'.

g_layout-no_hline = 'X'.

g_layout-edit = 'X'.

g_layout-box_tabname = 'ITAB'.

gwa_fieldcat-col_pos = 1.

gwa_fieldcat-outputlen = 3.

gwa_fieldcat-fieldname = 'CHECK'.

gwa_fieldcat-tabname = 'ITAB'.

gwa_fieldcat-edit = 'X'.

gwa_fieldcat-checkbox = 'X'.

gwa_fieldcat-seltext_l = 'CHECK'.

APPEND gwa_fieldcat TO git_fieldcat.

CLEAR: gwa_fieldcat.

gwa_fieldcat-col_pos = 2.

gwa_fieldcat-outputlen = 18.

gwa_fieldcat-fieldname = 'MATNR'.

gwa_fieldcat-tabname = 'ITAB'.

gwa_fieldcat-seltext_l = 'MATERIAL'.

APPEND gwa_fieldcat TO git_fieldcat.

gwa_fieldcat-col_pos = 3.

gwa_fieldcat-outputlen = 3.

gwa_fieldcat-fieldname = 'SELECTED'.

gwa_fieldcat-tabname = 'ITAB'.

gwa_fieldcat-edit = 'X'.

gwa_fieldcat-checkbox = 'X'.

gwa_fieldcat-seltext_l = 'CHECK'.

APPEND gwa_fieldcat TO git_fieldcat.

CLEAR:gwa_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_BYPASSING_BUFFER = 'X'

  • I_BUFFER_ACTIVE = ' '

i_callback_program = sy-repid

i_callback_pf_status_set = 'SET_PF_STATUS'

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 = g_layout

it_fieldcat = git_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

I_DEFAULT = 'X'

I_SAVE = 'A'

  • IS_VARIANT =

IT_EVENTS = it_event[]

  • 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 = itab

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.

ENDIF.

FORM set_pf_status USING extab TYPE slis_t_extab. "#EC NEEDED

SET PF-STATUS 'STATUS'.

ENDFORM. "set_pf_status

FORM user_command USING pv_ucomm LIKE sy-ucomm "#EC NEEDED

selfield TYPE slis_selfield. "#EC CALLED

CASE pv_ucomm.

WHEN 'DELE'.

LOOP AT itab WHERE SELECTED EQ 'X'.

IF ITAB-CHECK = 'X'.

it is not going inside.

ENDIF.

ENDLOOP.

ENDCASE.

ENDFORM.