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: 

FM REUSE_ALV_GRID_DISPLAY can't capture check box

calvinkarlo
Explorer
0 Kudos
198

Hi ,

My Requirement: I need to display an ALV grid report along with checkboxes. Further, I need to provide an option wherein the user can checkboxes and select the records that I need to process.

The problem is that I am not able to capture the ticked checkboxes. This means that I am not able to capture which of the records have been selected by the user.

I am not using Object Oriented ALV.

DATA: lt_fieldcat type slis_t_fieldcat_alv.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: lt_fieldcat1 type slis_t_fieldcat_alv.
DATA: LS_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.


DATA: LT_SPRT TYPE SLIS_T_SORTINFO_ALV.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
*DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
Data: gt_events TYPE slis_t_event,
wa_events TYPE slis_alv_event.
wa_events-name = 'CALLER_EXIT'.
wa_events-form = 'CALLER_EXIT'.
APPEND wa_events TO gt_events.
wa_events-name = 'DATA_CHANGED'.
wa_events-form = 'DATA_CHANGED'.
APPEND wa_events TO gt_events.
DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.


Refresh: gt_events.
I_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
I_LAYOUT-NO_MIN_LINESIZE = C_X.
ls_fieldcat-col_pos = '1'.
ls_fieldcat-fieldname = 'LCHECK'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'CHECKBOX'.
ls_fieldcat-edit = 'X'.
ls_fieldcat-input = 'X'.
ls_fieldcat-checkbox = 'X'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.


 ls_fieldcat-col_pos = '2'.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'MATERIAL'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.

 ls_fieldcat-col_pos = '3'.
ls_fieldcat-fieldname = 'CHARG'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'BATCH'.

 APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.

ls_fieldcat-col_pos = '4'.
ls_fieldcat-fieldname = 'EMPFW'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'RECEIVING PLANT'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '5'.
ls_fieldcat-fieldname = 'RESWK'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'SUPPLYING PLANT'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '6'.
ls_fieldcat-fieldname = 'LGORT'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'SLOC'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '7'.
ls_fieldcat-fieldname = 'PRUEFLOS'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'INSPECTION LOT'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '8'.
ls_fieldcat-fieldname = 'STATYPE'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'INSPECTION LOT'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '9'.
ls_fieldcat-fieldname = 'VBEWERTUNG'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'UD STATUS'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '10'.
ls_fieldcat-fieldname = 'CLABS'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'STOCKS IN UR'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '11'.
ls_fieldcat-fieldname = 'CSPEM'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'STOCKS IN BL'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '12'.
ls_fieldcat-fieldname = 'DOCNUM'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'OUTBOUND IDOC NUM'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.
ls_fieldcat-col_pos = '13'.
ls_fieldcat-fieldname = 'COMMENT'.
ls_fieldcat-tabname = 'TS_PFOUTPUTREPORT'.
ls_fieldcat-seltext_m = 'COMMENT'.
APPEND ls_fieldcat to lt_fieldcat.
clear:ls_fieldcat.

 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = lt_fieldcat[]
IT_EVENTS = gt_events
i_default = 'X'
I_SAVE = 'X'
TABLES
T_OUTTAB = TS_PFOUTPUTREPORT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
FORM PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS'. "EXCLUDING RT_EXTAB.
ENDFORM.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
when 'SAVE'.
LOOP AT TS_PFOUTPUTREPORT ASSIGNING FIELD-SYMBOL(<FS_PF>).
IF <FS_PF>-LCHECK = 'X'.
ELSE.
MESSAGE TEXT-E11 TYPE C_S DISPLAY LIKE C_E.
ENDIF.
ENDLOOP.
ENDCASE.
ENDFORM.

Pls Help.

0 REPLIES 0