Code: Alles auswählen.
DATA: WA_T931C TYPE T931C.
DATA:
BEGIN OF NAME, VORNA(25), NACHN(25), END OF NAME.
DATA: h-stund type p decimals 2.
*$*$- Start of INCLUDE ZPALV_DATA_STRUC --$*$*
*----------------------------------------------------------------------*
* INCLUDE ZPALV_DATA_STRUC *
*----------------------------------------------------------------------*
TYPE-POOLS: slis.
DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,
alv_layout TYPE slis_layout_alv.
TYPES: BEGIN OF data_struc,
pernr LIKE wa_t931c-pernr,
datum LIKE wa_t931c-datum,
kostl LIKE wa_t931c-kostl,
stunx type p decimals 2,
END OF data_struc.
DATA: data_tab TYPE TABLE OF data_struc,
data_tab_wa TYPE data_struc.
DATA: stru_disvar TYPE disvariant.
*$*$--- End of INCLUDE ZPALV_DATA_STRUC --$*$*
START-OF-SELECTION.
select * from t931c client specified into WA_t931C.
check select-options.
* MOVE-CORRESPONDING:
* wa_t931c TO data_tab_wa.
move wa_t931c-pernr to data_tab_wa-pernr.
move wa_t931c-datum to data_tab_wa-datum.
move wa_t931c-kostl to data_tab_wa-kostl.
move wa_t931c-stund to h-stund.
move h-stund to data_tab_wa-stunx.
APPEND data_tab_wa TO data_tab.
endselect.
END-OF-SELECTION.
PERFORM fieldcat_init USING alv_fieldcat.
alv_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'Z_CPTY2001_ALV'
i_grid_title = 'Abwesenheiten (I-Typ 2001)'
is_layout = alv_layout
it_fieldcat = alv_fieldcat
i_save = 'A'
is_variant = stru_disvar
TABLES
t_outtab = data_tab
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*---------------------------------------------------------------------*
* FORM fieldcat_init *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> P_FIELDCAT *
*---------------------------------------------------------------------*
FORM fieldcat_init USING p_fieldcat
TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'PERNR'.
ls_fieldcat-ref_tabname = 'PERNR'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO p_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DATUM'.
ls_fieldcat-ref_tabname = 'DATUM'.
APPEND ls_fieldcat TO p_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'KOSTL'.
ls_fieldcat-ref_tabname = 'KOSTL'.
APPEND ls_fieldcat TO p_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'STUNX'.
ls_fieldcat-ref_tabname = 'STUNX'.
LS_FIELDCAT-REPTEXT_DDIC = 'Stunden'.
APPEND ls_fieldcat TO p_fieldcat.
ENDFORM.
Code: Alles auswählen.
Code: Alles auswählen.
Dein Feldkaltalog ist falsch aufgebaut.KlausB hat geschrieben:Wo liegt der Fehler?
Code: Alles auswählen.
FORM fieldcat_init USING p_fieldcat
TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'PERNR'.
ls_fieldcat-ref_tabname = 'T931C'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO p_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DATUM'.
ls_fieldcat-ref_tabname = 'T931C'.
APPEND ls_fieldcat TO p_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'KOSTL'.
ls_fieldcat-ref_tabname = 'T931C'.
APPEND ls_fieldcat TO p_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'STUNX'.
ls_fieldcat-outputlen = '16''.
ls_fieldcat-datatype = 'FLPT'.
ls_fieldcat-seltext_s = 'Stunden'.
ls_fieldcat-seltext_l = 'StundenX'.
LS_FIELDCAT-REPTEXT_DDIC = 'Stunden'.
APPEND ls_fieldcat TO p_fieldcat.
ENDFORM.