제가 연습한것입니다. 테이블 자체로는 보여지는데 필드카탈로그 만들어도 안되네염.
include ztest_129top.
include ztest_129o1.
include ztest_129f1.
start-of-selection.
select * from zfited301 into table gt_alv
where corp >= p_1.
call screen '0200'.
*&---------------------------------------------------------------------*
*& Include ZTEST_129TOP
*&---------------------------------------------------------------------*
*tables zfited301.
*----------------------------------------------------------------------*
* TYPE-POOLS
*----------------------------------------------------------------------*
type-pools: slis.
selection-screen begin of block b1.
parameters: p_1 like zfited301-corp.
selection-screen end of block b1.
data: con1_ref type ref to cl_gui_custom_container.
data: grid1 type ref to cl_gui_alv_grid,
gt_alv type table of zfited301,
gs_layo type lvc_s_layo,
gt_fieldcat type lvc_t_fcat with header line,
gt_sort type lvc_t_sort with header line,
gs_fieldcat type lvc_s_fcat.
*&---------------------------------------------------------------------*
*& Include ZTEST_129O1
*&---------------------------------------------------------------------*
module init_con output.
if con1_ref is initial.
create object con1_ref
exporting
container_name = 'CON1'.
create object grid1
exporting
i_parent = con1_ref.
*perform set_grid_layout.
*perform set_set_sorting_fields.
*perform set_alv_fieldcat.
call method grid1->set_table_for_first_display
exporting
i_structure_name = 'ZFITED301'
changing
it_outtab = gt_alv.
endif.
endmodule. "init_con OUTPUT
it_fieldcatalog = gt_fcat[].를 넣어줄려고 해도 changing 부분이라서 되지도 않고 어떻게 해야 하나염?
댓글 5
-
맨날초보
2010.10.20 18:07
-
꼬마호랑이
2010.10.20 18:56
perform set_alv_fieldcat.
아래와 같이 만들었는데 잘못만든건가여. 어떤걸 변경해야 할지 모르것네염
*&---------------------------------------------------------------------*
*& Form SET_ALV_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form set_alv_fieldcat .
clear: gs_fieldcat. refresh : gt_fieldcat.
perform set_fieldcat using :
'CORP' 'X' '회사고유코드' 'S' 'C' '16' '' '' '' '' '' '' '',
'CORPNM' '' '회사명칭' 'S' 'R' '12' '' '' '' '' '' '' '',
'STCD' '' '사업자등록번호' 'S' 'R' '18' '' '' '' '' '' '' '',
'ADDR1' '' '주소1(도시)' 'S' 'R' '14' '' '' '' '' '' '' '',
'ADDR2' '' '주소2(나머지)' 'S' 'R' '16' '' '' '' '' '' '' '',
'PRES' '' '대표자명' 'S' 'R' '16' '' '' '' '' '' '' '',
'EMPE' '' '직원수' 'S' 'R' '16' '' '' '' '' '' '' ''.
endform. " SET_ALV_FIELDCAT
*&---------------------------------------------------------------------*
*& Form SET_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0035 text
* -->P_0036 text
* -->P_0037 text
* -->P_0038 text
* -->P_0039 text
* -->P_0040 text
* -->P_0041 text
* -->P_0042 text
* -->P_0043 text
* -->P_0044 text
* -->P_0045 text
* -->P_0046 text
* -->P_0047 text
*----------------------------------------------------------------------*
form set_fieldcat using pv_fname
pv_key
pv_scrtext
pv_selddictxt
pv_just
pv_outputlen
pv_hotspot
pv_sum
pv_curr
pv_edit
pv_dec
pv_checkbox
pv_icon.
gs_fieldcat-fieldname = pv_fname.
gs_fieldcat-key = pv_key.
gs_fieldcat-selddictxt = pv_selddictxt.
gs_fieldcat-just = pv_just.
gs_fieldcat-seltext = pv_scrtext.
gs_fieldcat-seltext = pv_scrtext.
gs_fieldcat-seltext = pv_scrtext.
gs_fieldcat-outputlen = pv_outputlen.
gs_fieldcat-hotspot = pv_hotspot.
gs_fieldcat-do_sum = pv_sum.
gs_fieldcat-cfieldname = pv_curr.
gs_fieldcat-edit = pv_edit.
gs_fieldcat-decimals_o = pv_dec.
gs_fieldcat-checkbox = pv_checkbox.
gs_fieldcat-icon = pv_icon.
append gs_fieldcat to gt_fieldcat.
clear gs_fieldcat.
endform. " SET_FIELDCAT
-
꼬마호랑이
2010.10.20 19:18
call method grid1->set_table_for_first_display
exporting
i_buffer_active = 'X'
i_bypassing_buffer = 'X'
changing
it_outtab = gt_alv[]
it_fieldcatalog = gt_fieldcat[]
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
이렇게해서 돌려서 해결하긴 했는데염 문제는 필드명이 마우스커서를 갇다대야지만 나오네여 뭐가 문제일까염
-
꼬마호랑이
2010.10.20 19:33
문제가 하나더 생겼습니다 ㅜ.ㅜ 출력해보니 직원수 부분에 직원수는 안나오고 대표자명필드부분이 한번더 들어가지네염 ㅜ.ㅜ -
꼬마호랑이
2010.10.21 01:34
*&---------------------------------------------------------------------*
*& Form SET_ALV_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form set_alv_fieldcat .
clear: gs_fieldcat. refresh : gt_fieldcat.
perform set_fieldcat using :
'CORP' 'X' '회사고유코드' 'S' 'C' '16' ,
'CORPNM' '' '회사명칭' 'S' 'R' '12' ,
'STCD' '' '사업자등록번호' 'S' 'R' '18',
'ADDR1' '' '주소1(도시)' 'S' 'R' '10',
'ADDR2' '' '주소2(나머지)' 'S' 'R' '18',
'PRES' '' '대표자명' 'S' 'R' '16',
'EMPN' '' '직원수' 'S' 'R' '12'.
endform. " SET_ALV_FIELDCAT
*&---------------------------------------------------------------------*
*& Form SET_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0234 text
* -->P_0235 text
* -->P_0236 text
* -->P_0237 text
* -->P_0238 text
* -->P_0239 text
*----------------------------------------------------------------------*
form set_fieldcat using pv_fname
pv_key
pv_scrtext
pv_selddictxt
pv_just
pv_outputlen.
gs_fieldcat-fieldname = pv_fname.
gs_fieldcat-key = pv_key.
gs_fieldcat-selddictxt = pv_selddictxt.
gs_fieldcat-scrtext_l = pv_scrtext.
gs_fieldcat-scrtext_m = pv_scrtext.
gs_fieldcat-scrtext_s = pv_scrtext.
gs_fieldcat-just = pv_just.
gs_fieldcat-outputlen = pv_outputlen.
append gs_fieldcat to gt_fieldcat.
endform. " SET_FIELDCAT
이렇게 써서 해결했습니다. 수거염
call screen '0200'. <===이 부분을 클릭해서 들어가면..
PROCESS BEFORE OUTPUT.
MODULE pbo_status_0200.
MODULE create_controls. <===== 이런 부분 있어요. (이름은 다를 수 있지만..) 클릭.
*-- set Fieldcatalog
PERFORM set_grid_fieldcatalog TABLES gt_fieldcat[]. <=== 이런 부분 있을거에요.여기 클릭하시면 변경가능할거에요.