TABLES:pa0002,pa0008.
TYPE-POOLS:slis.
CONSTANTS:c VALUE 'X'.
DATA:BEGIN OF it_pa0008 OCCURS 0,
pernr LIKE pa0008-pernr,
begda LIKE pa0008-begda,
endda LIKE pa0008-endda,
preas LIKE pa0008-preas,
ansal LIKE pa0008-ansal,
lga01 LIKE pa0008-lga01,
expand TYPE xfeld,
END OF it_pa0008.
DATA:BEGIN OF it_pa0002 OCCURS 0,
pernr LIKE pa0002-pernr,
vorna LIKE pa0002-vorna,
nachn LIKE pa0002-nachn,
gbdat LIKE pa0002-gbdat,
gblnd LIKE pa0002-gblnd,
sprsl LIKE pa0002-sprsl,
perid LIKE pa0002-perid,
END OF it_pa0002.
DATA: wa_field_cat TYPE slis_fieldcat_alv,
it_field_cat TYPE slis_t_fieldcat_alv,
wa_keyinfo TYPE slis_keyinfo_alv,
it_layout TYPE slis_layout_alv.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_pernr FOR pa0002-pernr NO INTERVALS.
SELECTION-SCREEN: SKIP.
PARAMETERS:p_expand AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select_data.
PERFORM build_field_cat.
PERFORM disply_data.
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM select_data .
SELECT pernr begda endda preas ansal lga01
FROM pa0008
INTO CORRESPONDING FIELDS OF TABLE it_pa0008 UP TO 10 ROWS.
IF NOT it_pa0008[] IS INITIAL.
SELECT pernr vorna nachn gbdat gblnd sprsl perid
FROM pa0002
INTO CORRESPONDING FIELDS OF TABLE it_pa0002
FOR ALL ENTRIES IN it_pa0008
WHERE pernr = it_pa0008-pernr.
ENDIF.
SORT it_pa0008 BY pernr.
ENDFORM.
" SELECT_DATA
*&---------------------------------------------------------------------* *&
Form BUILD_FIELD_CAT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM build_field_cat .
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'PERNR'.
wa_field_cat-seltext_l = 'personnelno'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'BEGDA'.
wa_field_cat-seltext_l = 'begindate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'ENDDA'.
wa_field_cat-seltext_l = 'enddate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'PREAS'.
wa_field_cat-seltext_l = 'reason'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'ANSAL'.
wa_field_cat-seltext_l = 'annualsalary'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'LGA01'.
wa_field_cat-seltext_l = 'wagetype'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'VORNA'.
wa_field_cat-seltext_l = 'firstname'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'NACHN'.
wa_field_cat-seltext_l = 'lastname'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'GBDAT'.
wa_field_cat-seltext_l = 'birhtdate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'GBLND'.
wa_field_cat-seltext_l = 'birthcountry'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'SPRSL'.
wa_field_cat-seltext_l = 'languageused'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'PERID'.
wa_field_cat-seltext_l = 'personnelid'.
APPEND wa_field_cat TO it_field_cat.
ENDFORM. " BUILD_FIELD_CAT
*&---------------------------------------------------------------------*
*& Form DISPLY_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM disply_data .
it_layout-group_change_edit = c.
it_layout-colwidth_optimize = c.
it_layout-zebra = c.
it_layout-detail_popup = c.
it_layout-get_selinfos = c.
IF p_expand = c.
it_layout-expand_fieldname = 'EXPAND'.
ENDIF.
wa_keyinfo-header01 = 'PERNR'.
wa_keyinfo-item01 = 'PERNR'.
* wa_keyinfo-item02 = 'SUBTY'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
is_layout = it_layout
it_fieldcat = it_field_cat
i_tabname_header = 'PA0008'
i_tabname_item = 'PA0002'
is_keyinfo = wa_keyinfo
TABLES
t_outtab_header = it_pa0008
t_outtab_item = it_pa0002.
ENDFORM. " DISPLY_DATA
ALSO READ:
- Header In Bold - ALV Grid/List Display.
- Double Click On ALV Grid/List Report.
- ALV Interactive (Double Clicking).
- Simple Example On How To Display Table Data In ALV Grid/List Display.
..... Back To Index On ALV List/ Grid Display.
..... Back To MAIN INDEX.
No comments:
Post a Comment