728x90
반응형
PERFORM fieldcatalog_merge USING '스트럭쳐 이름' 'GT_FIELDCAT'.
PERFORM field_setting_call USING 'GT_FIELDCAT'.
PERFORM alv_init USING gs_layout gs_variant gi_grid.
TOP
FIELD-SYMBOLS : <fs_t_fcat> TYPE lvc_t_fcat,
<fs_s_fcat> TYPE lvc_s_fcat. `
FORM fieldcatalog_merge USING pv_table pv_fcat.
ASSIGN (pv_fcat) TO <fs_t_fcat>.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = pv_table
CHANGING
ct_fieldcat = <fs_t_fcat>
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE s010 DISPLAY LIKE 'E'. " 필드카탈로그를 생성하지 못하였습니다.
LEAVE TO SCREEN 0.
ENDIF.
ENDFORM.
FORM field_setting_call USING pv_fcat.
ASSIGN (pv_fcat) TO <fs_t_fcat>.
LOOP AT <fs_t_fcat> ASSIGNING <fs_s_fcat>.
CASE pv_fcat.
WHEN 'GT_FIELDCAT'.
CASE <fs_s_fcat>-fieldname.
<fs_s_fcat>-colddictxt = 'L'.
WHEN 'STATS'.
<fs_s_fcat>-coltext = TEXT-t01."상태
<fs_s_fcat>-just = 'C'.
WHEN 'MARK'.
<fs_s_fcat>-no_out = abap_true.
WHEN 'BANFN'.
<fs_s_fcat>-hotspot = abap_true.
WHEN 'PRIORITY'.
<fs_s_fcat>-f4availabl = abap_true.
WHEN OTHERS.
ENDCASE.
ENDCASE.
MODIFY <fs_t_fcat> FROM <fs_s_fcat>.
ENDLOOP.
ENDFORM.
FORM alv_init USING ps_layout TYPE lvc_s_layo
ps_variant TYPE disvariant
pi_grid TYPE REF TO cl_gui_alv_grid.
" Layout Setting
CLEAR ps_layout.
ps_layout-cwidth_opt = abap_true.
ps_layout-no_rowmark = space.
ps_layout-sel_mode = 'D'.
ps_layout-zebra = abap_true.
ps_layout-no_totline = space.
ps_layout-numc_total = abap_true.
ps_layout-no_rowins = abap_true.
ps_layout-smalltitle = space.
" Layout Variant
CLEAR ps_variant.
ps_variant-report = sy-repid.
ps_variant-username = sy-uname.
gv_save = 'A'.
CREATE OBJECT gi_event_receiver.
SET HANDLER gi_event_receiver->handle_hotspot FOR pi_grid.
SET HANDLER gi_event_receiver->handle_help_f4 FOR pi_grid.
ENDFORM.
728x90
반응형
'ABAP' 카테고리의 다른 글
Pop up Message (0) | 2023.02.24 |
---|---|
ALV All select (0) | 2023.02.24 |
ALV 체크박스 클릭시 Cell edit (1) | 2023.02.21 |
Dynamic table Calculation (0) | 2023.02.21 |
RANGES 변수 (0) | 2023.02.21 |
댓글