on ‎2008 Jun 26 6:44 AM
Hi all,
I am learning HR - ABAP, so can anybody sent me some sample report program, or any document on infotypes.
Also it would be very helpful, if i get some documents on INFOTYPES.
Request clarification before answering.
Hi Tapodipta Khan
In HR module reportin is totally dif compared to other modules
In HR we use LDB to fetch data
For example
PA and Payroll -
PNP/PNPCE
Recruitment -
PAP
Orgmanagement -
PCH
PA report Example
in attrubutes u have to add LDB is PNPCE
REPORT ZHR_TES.
************************************************************************
Type-Pools *
************************************************************************
TYPE-POOLS : slis.
************************************************************************
Nodes *
************************************************************************
NODES: person,
group,
peras.
*************************************************************************
Tables *
************************************************************************
TABLES: pernr,
t512w,
tfkbt,
pa0022,
pa0016,
bkpf.
************************************************************************
Infotypes *
************************************************************************
INFOTYPES : 0000, "Actions
0001, "Org Details
0022, "Education Details
0041, "Date Specification
0002, "Personal Details
0016.
************************************************************************
Internal Tables *
************************************************************************
DATA :BEGIN OF t_output OCCURS 0,
pernr TYPE pernr_d, " Personnel No.
ename TYPE emnam, " Employee Name
btrtl TYPE btrtl, "Personnel Subarea
btext TYPE btext, "Personnel Subarea Text
persk TYPE persk, "Grade
ptext TYPE pktxt, "gradeText
END OF t_output,
t_fcat TYPE slis_t_fieldcat_alv.
*----
ALV Variable
*----
DATA : w_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
************************************************************************
Event : GET Pernr *
************************************************************************
GET peras.
PERFORM read_data. "Data Selection
************************************************************************
Event : End-Of-Selection *
************************************************************************
END-OF-SELECTION.
PERFORM f_addcat. "Field Cat
PERFORM f_display. "Display
&----
*& Form read_data
&----
FORM read_data.
Organizational Assignment
rp_provide_from_last p0001 space pn-begda pn-endda.
IF pnp-sw-found EQ 1.
t_output-pernr = p0001-pernr.
t_output-ename = p0001-ename.
t_output-btrtl = p0001-btrtl.
t_output-persk = p0001-persk.
*Personal sub area text
SELECT SINGLE btext FROM t001p
INTO t_output-btext
WHERE btrtl = t_output-btrtl.
Grade text
SELECT SINGLE ptext FROM t503t
INTO t_output-ptext
WHERE persk = t_output-persk AND
sprsl = 'EN'.
ENDIF.
APPEND t_output.
CLEAR t_output.
ENDFORM. "
&----
*& Form f_addcat
&----
FORM f_addcat .
PERFORM f_fieldcat USING 'T_OUTPUT' 'PERNR' 'Personnel No.' 8 ''.
PERFORM f_fieldcat USING 'T_OUTPUT' 'ENAME' 'Name' 15 ''.
PERFORM f_fieldcat USING 'T_OUTPUT' 'PTEXT' 'Grade' 10 ''.
ENDFORM. " f_addcat
&----
*& Form f_fieldcat
&----
FORM f_fieldcat USING value(p_tname)
value(p_fname)
value(p_desc)
value(p_leng)
value(p_out).
MOVE : p_tname TO wa_fieldcat-tabname,
p_fname TO wa_fieldcat-fieldname,
p_desc TO wa_fieldcat-seltext_l,
p_leng TO wa_fieldcat-outputlen,
p_out TO wa_fieldcat-no_out.
APPEND wa_fieldcat TO t_fcat.
CLEAR wa_fieldcat.
ENDFORM. " f_fieldcat
&----
*& Form f_display
&----
FORM f_display.
Local Variable
DATA : lv_repid LIKE sy-repid,
ls_layout TYPE slis_layout_alv.
lv_repid = sy-repid.
ls_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
is_layout = ls_layout
it_fieldcat = t_fcat
i_save = 'A'
TABLES
t_outtab = t_output
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.
ENDFORM. " f_display
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tapodipta Khan
In HR module reportin is totally dif compared to other modules
In HR we use LDB to fetch data
For example
PA and Payroll -
PNP/PNPCE
Recruitment -
PAP
Orgmanagement -
PCH
PA report Example
in attrubutes u have to add LDB is PNPCE
REPORT ZHR_TES.
************************************************************************
Type-Pools *
************************************************************************
TYPE-POOLS : slis.
************************************************************************
Nodes *
************************************************************************
NODES: person,
group,
peras.
*************************************************************************
Tables *
************************************************************************
TABLES: pernr,
t512w,
tfkbt,
pa0022,
pa0016,
bkpf.
************************************************************************
Infotypes *
************************************************************************
INFOTYPES : 0000, "Actions
0001, "Org Details
0022, "Education Details
0041, "Date Specification
0002, "Personal Details
0016.
************************************************************************
Internal Tables *
************************************************************************
DATA :BEGIN OF t_output OCCURS 0,
pernr TYPE pernr_d, " Personnel No.
ename TYPE emnam, " Employee Name
btrtl TYPE btrtl, "Personnel Subarea
btext TYPE btext, "Personnel Subarea Text
persk TYPE persk, "Grade
ptext TYPE pktxt, "gradeText
END OF t_output,
t_fcat TYPE slis_t_fieldcat_alv.
*----
ALV Variable
*----
DATA : w_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
************************************************************************
Event : GET Pernr *
************************************************************************
GET peras.
PERFORM read_data. "Data Selection
************************************************************************
Event : End-Of-Selection *
************************************************************************
END-OF-SELECTION.
PERFORM f_addcat. "Field Cat
PERFORM f_display. "Display
&----
*& Form read_data
&----
FORM read_data.
Organizational Assignment
rp_provide_from_last p0001 space pn-begda pn-endda.
IF pnp-sw-found EQ 1.
t_output-pernr = p0001-pernr.
t_output-ename = p0001-ename.
t_output-btrtl = p0001-btrtl.
t_output-persk = p0001-persk.
*Personal sub area text
SELECT SINGLE btext FROM t001p
INTO t_output-btext
WHERE btrtl = t_output-btrtl.
Grade text
SELECT SINGLE ptext FROM t503t
INTO t_output-ptext
WHERE persk = t_output-persk AND
sprsl = 'EN'.
ENDIF.
APPEND t_output.
CLEAR t_output.
ENDFORM. "
&----
*& Form f_addcat
&----
FORM f_addcat .
PERFORM f_fieldcat USING 'T_OUTPUT' 'PERNR' 'Personnel No.' 8 ''.
PERFORM f_fieldcat USING 'T_OUTPUT' 'ENAME' 'Name' 15 ''.
PERFORM f_fieldcat USING 'T_OUTPUT' 'PTEXT' 'Grade' 10 ''.
ENDFORM. " f_addcat
&----
*& Form f_fieldcat
&----
FORM f_fieldcat USING value(p_tname)
value(p_fname)
value(p_desc)
value(p_leng)
value(p_out).
MOVE : p_tname TO wa_fieldcat-tabname,
p_fname TO wa_fieldcat-fieldname,
p_desc TO wa_fieldcat-seltext_l,
p_leng TO wa_fieldcat-outputlen,
p_out TO wa_fieldcat-no_out.
APPEND wa_fieldcat TO t_fcat.
CLEAR wa_fieldcat.
ENDFORM. " f_fieldcat
&----
*& Form f_display
&----
FORM f_display.
Local Variable
DATA : lv_repid LIKE sy-repid,
ls_layout TYPE slis_layout_alv.
lv_repid = sy-repid.
ls_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
is_layout = ls_layout
it_fieldcat = t_fcat
i_save = 'A'
TABLES
t_outtab = t_output
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.
ENDFORM. " f_display
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tapodipta Khan,
Please check this link
http://help.sap.com/saphelp_45b/helpdata/en/9a/524035634df01ee10000009b38f889/frameset.htm
HR Infotypes .PDF Document
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/HRINF/HRINF.pdf
Best regards,
raam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
REPORT yh1148_hr_01.
TABLES:
pa0000.
SELECT-OPTIONS:
s_pernr FOR pa0000-pernr.
DATA:
fs_emp TYPE pa0000,
fs_pa0002 TYPE p0002.
DATA:
t_emp LIKE
STANDARD TABLE
OF pa0000.
DATA:
t_pa0002 LIKE
STANDARD TABLE
OF p0002.
START-OF-SELECTION.
PERFORM get_data.
PERFORM hr_read_infotype.
LOOP AT t_pa0002 INTO fs_pa0002.
AT FIRST.
WRITE:/ 'pernr'(001),
20 'name'(003).
ENDAT.
WRITE:/ fs_pa0002-pernr UNDER text-001,
fs_pa0002-vorna UNDER text-003.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form hr_read_infotype
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM hr_read_infotype .
LOOP AT t_emp INTO fs_emp..
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = fs_emp-pernr
infty = '0002'
* BEGDA = '18000101'
* ENDDA = '99991231'
* BYPASS_BUFFER = ' '
* IMPORTING
* SUBRC =
TABLES
infty_tab = t_pa0002
EXCEPTIONS
infty_not_found = 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.
ENDLOOP.
ENDFORM. " hr_read_infotype
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data .
SELECT *
FROM pa0000
INTO TABLE t_emp
WHERE pernr IN s_pernr
AND endda GE sy-datum
AND begda LE sy-datum
AND stat2 EQ '3'.
ENDFORM. " get_data*********Hope this will help u******
******Reward if useful.
Regards,
Bhumika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 15 | |
| 14 | |
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.