* Heirarchy Report On Employee Leave Details *
REPORT ZR_H113_TIME1 NO STANDARD PAGE HEADING
LINE-SIZE 300.
TABLES PERNR.
INFOTYPES:0001,2001,2006.
DATA: BEGIN OF
IT_2006 OCCURS 0,
PERNR TYPE P2006-PERNR,
ENAME TYPE P0001-ENAME,
BEGDA TYPE P2006-BEGDA,
STAT2 TYPE PERNR-STAT2,
KTART TYPE P2006-KTART,
KVERB TYPE P2006-KVERB,
ANZHL TYPE P2006-ANZHL,
EXP(1) TYPE C,
END OF IT_2006.
DATA: BEGIN OF
IT_2001 OCCURS 0,
PERNR TYPE P2001-PERNR,
BEGDA TYPE P2001-BEGDA,
ENDDA TYPE P2001-ENDDA,
AWART TYPE P2001-AWART,
ABWTG TYPE P2001-ABWTG,
END OF IT_2001.
TYPE-POOLS SLIS.
DATA WA_KEYINFO
TYPE SLIS_KEYINFO_ALV.
DATA IT_FIELDCAT
TYPE SLIS_T_FIELDCAT_ALV.
DATA WA_FIELDCAT
TYPE SLIS_FIELDCAT_ALV.
DATA WA_LAYOUT
TYPE SLIS_LAYOUT_ALV.
START-OF-SELECTION.
GET PERNR.
LOOP AT P2006.
LOOP AT P2001.
LOOP AT P0001.
MOVE: P2006-PERNR TO IT_2006-PERNR,
P0001-ENAME TO IT_2006-ENAME,
P2006-BEGDA TO IT_2006-BEGDA,
PERNR-STAT2 TO IT_2006-STAT2,
P2006-KTART TO IT_2006-KTART,
P2006-KVERB TO IT_2006-KVERB,
P2006-ANZHL TO IT_2006-ANZHL,
P2001-PERNR TO IT_2001-PERNR,
P2001-BEGDA TO IT_2001-BEGDA,
P2001-ENDDA TO IT_2001-ENDDA,
P2001-AWART TO IT_2001-AWART,
P2001-ABWTG TO IT_2001-ABWTG.
APPEND IT_2006.
APPEND IT_2001.
ENDLOOP.
ENDLOOP.
ENDLOOP.
END-OF-SELECTION.
*---IT_2006
PERFORM BUILD_FIELD_CAT USING 'PERNR' 'Emp
No' 'IT_2006' ' '.
PERFORM BUILD_FIELD_CAT USING 'ENAME' 'Name'
'IT_2006' ' '.
PERFORM BUILD_FIELD_CAT USING 'BEGDA' 'Hire
Date' 'IT_2006' '__/__/____'.
PERFORM BUILD_FIELD_CAT USING 'STAT2' 'Emp
Status' 'IT_2006' ' '.
PERFORM BUILD_FIELD_CAT USING 'KTART'
'Absence Quota Type' 'IT_2006' ' '.
PERFORM BUILD_FIELD_CAT USING 'KVERB'
'Absence Quota Deduction' 'IT_2006' ' '.
PERFORM BUILD_FIELD_CAT USING 'ANZHL'
'Absence Quota Number' 'IT_2006' ' '.
*---IT_2001
WA_FIELDCAT-FIELDNAME = 'PERNR'.
WA_FIELDCAT-SELTEXT_L = 'Emp No'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-TABNAME = 'IT_2001'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'BEGDA'.
WA_FIELDCAT-SELTEXT_L = 'Leave Start Date'.
WA_FIELDCAT-EDIT_MASK = '__/__/____'.
WA_FIELDCAT-TABNAME = 'IT_2001'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ENDDA'.
WA_FIELDCAT-SELTEXT_L = 'Leave End Date'.
WA_FIELDCAT-EDIT_MASK = '__/__/____'.
WA_FIELDCAT-TABNAME = 'IT_2001'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'AWART'.
WA_FIELDCAT-SELTEXT_L = 'Absence Type'.
WA_FIELDCAT-TABNAME = 'IT_2001'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ABWTG'.
WA_FIELDCAT-SELTEXT_L = 'Absence Days'.
WA_FIELDCAT-TABNAME = 'IT_2001'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
*---KEY
WA_KEYINFO-HEADER01 = 'PERNR'.
WA_KEYINFO-ITEM01 = 'PERNR'.
WA_LAYOUT-EXPAND_FIELDNAME = 'EXP'.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION
'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_CALLBACK_PROGRAM =
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
I_TABNAME_HEADER = 'IT_2006'
I_TABNAME_ITEM = 'IT_2001'
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
IS_KEYINFO = WA_KEYINFO
* IS_PRINT =
* IS_REPREP_ID =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* IR_SALV_HIERSEQ_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = IT_2006
T_OUTTAB_ITEM = IT_2001
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
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
BUILD_FIELD_CAT
**&---------------------------------------------------------------------*
** text
**----------------------------------------------------------------------*
** -->P_0178 text
** -->P_0179 text
** -->P_0180 text
**----------------------------------------------------------------------*
*FORM
BUILD_FIELD_CAT USING VALUE(P_0178)
* VALUE(P_0179)
* VALUE(P_0180).
*
* WA_FIELDCAT-FIELDNAME = P_0178.
* WA_FIELDCAT-SELTEXT_L = P_0179.
* WA_FIELDCAT-TABNAME = P_0180.
*
* APPEND WA_FIELDCAT TO IT_FIELDCAT.
* CLEAR WA_FIELDCAT.
*ENDFORM. " BUILD_FIELD_CAT
*&---------------------------------------------------------------------*
*& Form
BUILD_FIELD_CAT_CAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0178 text
* -->P_0179 text
* -->P_0180 text
* -->P_0181 text
*----------------------------------------------------------------------*
FORM
BUILD_FIELD_CAT USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180)
VALUE(P_0181).
WA_FIELDCAT-FIELDNAME = P_0178.
WA_FIELDCAT-SELTEXT_L = P_0179.
WA_FIELDCAT-TABNAME = P_0180.
WA_FIELDCAT-EDIT_MASK = P_0181.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. " BUILD_FIELD_CAT_CAT