두개의 cbo테이블에서 모든 필드를 가져와서 화면 상,하로 나누어서
보여주는 alv를 작성했습니다.
출력까지는 되는데 칼럼마다 정리를 좀 하려 하니
필드수가 4~50개가 되다보니 하나씩 만들기도 힘들고해서..
교재 소스참고해서 구조를 기본으로 부분 편집하는부분을 해봤는데
아래 소스대로 실행하면 필드 카탈로그를 찾을수 없다는 오류가 발생합니다.
어디가 문제가 있는지 잘모르겠습니다.. 지적좀 부탁드리겠습니다..
*&---------------------------------------------------------------------*
* intenel table
*&---------------------------------------------------------------------*
DATA : it_zmmpr TYPE TABLE OF zmmpr001.
DATA : it_zep TYPE TABLE OF zep_single_log.
DATA : gt_zmmpr TYPE TABLE OF zmmpr001 WITH HEADER LINE.
DATA : gt_zep TYPE TABLE OF zep_single_log WITH HEADER LINE.
*&---------------------------------------------------------------------*
* Alv variants
*&---------------------------------------------------------------------*
DATA : g_grid TYPE REF TO cl_gui_alv_grid,
g_grid2 TYPE REF TO cl_gui_alv_grid.
DATA : con1_ref TYPE REF TO cl_gui_custom_container,
con2_ref TYPE REF TO cl_gui_custom_container.
DATA : zmmpr_cat TYPE lvc_t_fcat,
zep_cat TYPE lvc_t_fcat.
DATA : gs_layout TYPE lvc_s_layo.
DATA : gt_fieldcat TYPE lvc_s_fcat OCCURS 0 WITH HEADER LINE,
ls_fieldcat TYPE lvc_s_fcat.
*&---------------------------------------------------------------------*
*& Form data_display
*&---------------------------------------------------------------------*
FORM data_display .
PERFORM setting_layout USING gs_layout.
PERFORM setting_catalog.
PERFORM getting_catalog.
CALL SCREEN 100.
ENDFORM. " data_display
*&---------------------------------------------------------------------*
*& Module init_con1 OUTPUT
*&---------------------------------------------------------------------*
MODULE init_con1 OUTPUT.
IF con1_ref IS INITIAL.
CREATE OBJECT con1_ref
EXPORTING
container_name = 'CON1'.
CREATE OBJECT g_grid
EXPORTING
i_parent = con1_ref.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
* i_structure_name = 'ZMMPR001'
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fieldcat[]
it_outtab = gt_zmmpr[].
ENDIF.
ENDMODULE. " init_con1 OUTPUT
*&---------------------------------------------------------------------*
*& Module init_con2 OUTPUT
*&---------------------------------------------------------------------*
MODULE init_con2 OUTPUT.
IF con2_ref IS INITIAL.
CREATE OBJECT con2_ref
EXPORTING
container_name = 'CON2'.
CREATE OBJECT g_grid2
EXPORTING
i_parent = con2_ref.
CALL METHOD g_grid2->set_table_for_first_display
EXPORTING
* i_structure_name = 'ZEP_SINGLE_LOG'
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fieldcat[]
it_outtab = gt_zep[].
ENDIF.
ENDMODULE. " init_con2 OUTPUT
*&---------------------------------------------------------------------*
*& Form setting_catalog
*&---------------------------------------------------------------------*
FORM setting_catalog .
ls_fieldcat-fieldname = 'SINGLEPK'.
ls_fieldcat-coltext = 'Single PK'.
ls_fieldcat-just = 'C'.
ls_fieldcat-just = 'X'.
APPEND ls_fieldcat TO gt_fieldcat.
ls_fieldcat-fieldname = 'ZYEAR'.
ls_fieldcat-coltext = '발생년도'.
ls_fieldcat-just = 'C'.
APPEND ls_fieldcat TO gt_fieldcat.
*
* ls_fieldcat-fieldname = 'ZGROUP'.
* ls_fieldcat-coltext = '모듈구분자'.
* ls_fieldcat-just = 'C'.
* APPEND ls_fieldcat TO gt_fieldcat.
*
* ls_fieldcat-fieldname = 'EPPK'.
* ls_fieldcat-coltext = 'EP PK'.
* ls_fieldcat-just = 'C'.
* APPEND ls_fieldcat TO gt_fieldcat.
*
* ls_fieldcat-fieldname = 'ZMOD'.
* ls_fieldcat-coltext = '서브모듈'.
* ls_fieldcat-just = 'C'.
* APPEND ls_fieldcat TO gt_fieldcat.
ENDFORM. " setting_catalog
*&---------------------------------------------------------------------*
*& Form getting_catalog
*&---------------------------------------------------------------------*
FORM getting_catalog .
DATA : lt_fieldcat TYPE kkblo_t_fieldcat.
CALL FUNCTION 'K_KKB_FIELDCAT_MERGE'
EXPORTING
i_tabname = 'GT_ZEP'
CHANGING
ct_fieldcat = lt_fieldcat[].
IF sy-subrc EQ 0.
CALL FUNCTION 'LVC_TRANSFER_FROM_KKBLO'
EXPORTING
it_fieldcat_kkblo = lt_fieldcat[]
IMPORTING
et_fieldcat_lvc = gt_fieldcat[].
ENDIF.
ENDFORM. " getting_catalog
로그인 상단 통합검색 부분에 K_KKB_FIELDCAT_MERGE 를 넣고 조회하면
답을 찾을 수 있습니다.