10-19-2006 7:53 AM
COULD ANYONE PLEASE SEND SOME STANDARD HR ABAP OBJECTS OR PROGRAMMS OR REPORTS WHERE I CAN WORK ON AND STRENTHEN MY SKILLS IN ABAP-HR .MY MAILID : veni062@yahoo.co.in .
THANKS IN ADVANCE
KRISHNAVENI .
10-19-2006 6:14 PM
Hi
Here is part of an HR simple report.
HR reports are based on logical database programs, where the logical database programs get employees, PUT PERNR and send their records to the front end program (the program we write) We use GET pernr to get this information. In the Attribute section of the program, we need to specify the logical database we are using, which for HR is mainly PNP. The code between
START-OF-SELECTION.
GET PERNR
END-OF-SELECTION.
Is where we read data for employees, check, process and put in an internal table. this is looping in the logical database program and our program to get records.
After END-OF-SELECTION we can display, further manipulate our internal table etc.
We sometimes need to read data from payroll clusters. In that case we will need to use macros to extract data from payroll result.That is not part of this simple program. Please note this program is not complete and parts of this has been deleted. I assmed that you are familiar with the use of ALV etc.I am just showing the structure of the program. Hope it is useful.
REPORT ZTEST19.
LINE-SIZE 132. " line-count 65.
*Tables:-(tables you need)--
TABLES: PERNR, "Standard Selections for HR Master Data Reporting
t510, "Pay Scale Groups
t510n, "Pay Scales for Annual Salaries (NA)
t501t, "Employee Group Names
.....
*Infotypes-(Infotype required)--
INFOTYPES: 0000,
0001,
0041,
0102,
2001
...
*Data----(Internal table)--
*Line ITEM TABLE
types: Begin of t_tab,
Sname like p0001-Sname, "Employee Name
pernr like pernr-pernr, "Employee Number
persg like p0001-persg, "Employee group
ptext like t501t-ptext, "Name of Employee Group
plans like p0001-plans, "Position
PLSTX like t528t-plstx, "Position text
kostl like p0001-kostl, "Cost Centre
orgeh like p0001-orgeh, "Org Unit
orgtx like T527X-orGTX, "Org Unit Text
DAT02 like p0041-dat02, "Start Date
sdat like sy-datum, "Date 25 yrs service reached
awart like p2001-awart, "Absence type
UMSCH like p2001-UMSCH, "Illness desc
abwtg like p2001-abwtg, "No of days
ATEXT like t554t-atext, "Text for absence type
grsty like p0102-grsty, "Disciplinary Type
ltext like t505p-ltext, "Grievence reasons
end of t_tab.
*
**-(For ALV GRID)--
TYPE-POOLS: slis, gsetc.
*
**----
*
DATA: l_dar LIKE p0041-dar01,
l_dat LIKE p0041-dat01,
l_fire_date like sy-datum,
l_hire_date like sy-datum,
gt_fieldcat TYPE slis_t_fieldcat_alv,
alv_header TYPE slis_listheader,
gt_sortcat TYPE slis_t_sortinfo_alv,
gt_sort_ln LIKE LINE OF gt_sortcat,
gt_events TYPE slis_t_event,
gt_event_exit TYPE slis_t_event_exit,
gt_layout TYPE slis_layout_alv.
DATA: w_lin TYPE i,
w_headline(60) TYPE c,
w_col_pos TYPE i.
data: d_rdate type sy-datum,
d_firstdate type sy-datum,
d_lastdate type sy-datum,
d_calyear(4) type c,
d_seryear type sy-datum.
*
**Constants----
*
constants: c_job type c value 'S',
c_beg type dats value '18000101',
c_end type dats value '99991231',
c_hire type dats value '20050101'.
*
**Selection Screen----
SELECTION-SCREEN BEGIN OF BLOCK ext WITH FRAME TITLE text-001.
parameters: p_month(2) type c default sy-datum+4(2).
parameters: p_year(4) type c default sy-datum(4).
parameters: p_ser(2) type c default '25'.
select-options: s_orgeh for p0001-orgeh.
parameters: p_stat2 like p0000-stat2 default '3'.
select-options: s_ansvh for p0001-ansvh.
SELECTION-SCREEN END OF BLOCK ext.
*
*
*
START-OF-SELECTION.
gETS EMPLOYEE
GET PERNR.
perform extract_data.
*tHIS IS EXTRACT DATA routine
*Last records are selected for the PERNR or employee from various infotypes
*ie here we are gettinglast records of employee for disiplinary type, absence type etc. as we want to report on this
rp-provide-from-last p0000 space pn-begda pn-endda.
rp-provide-from-last p0001 space pn-begda pn-endda.
rp-provide-from-last p0041 space pn-begda pn-endda.
rp-provide-from-last p2001 space pn-begda pn-endda.
rp-provide-from-last p0102 space pn-begda pn-endda.
CLEAR W_ITAB.
*If these records meet our condition or the selection screen condition we accept them into internal table
IF ( P0001-ORGEH IN S_ORGEH ) AND
( p0000-stat2 = p_stat2 ) AND
( p0001-ansvh IN s_ansvh ).
MOVE P0001-SNAME TO W_ITAB-SNAME.
MOVE PERNR-PERNR TO W_ITAB-PERNR.
MOVE P0001-PERSG TO W_ITAB-PERSG.
*ETC..
*Absence
if p2001-endda gt sy-datum.
move p2001-awart to w_itab-awart.
*move p2001-abwtg to w_itab-abwtg.
move p2001-umsch to w_itab-umsch.
select single * from t554t where
SPRSL EQ SY-LANGU AND
awart = p2001-awart.
if sy-subrc = 0.
move t554t-atext to w_itab-atext.
endif.
endif.
*get disc.
if p0102-endda gt sy-datum.
move p0102-grsty to w_itab-grsty.
select single * from t505p where
SPRSL EQ SY-LANGU AND
subty = p0102-subty and
grsty = p0102-grsty.
if sy-subrc = 0.
move t505p-ltext to w_itab-ltext.
endif.
endif.
...
..
*if conditions are met, we append the internal table
APPEND W_ITAB TO ITAB.
endif.
*end of extract data routine
The logical database program behind this program keeps 'PUT PERNR' or LOOPING AT TABLES AND
*READING AND EXPORTING THEIR INFO TO THIS PROGRAM,
*where the GET PERNR gets that data and processes the data
*End of selection is the event where the LOOPING OR (GET PERNR PUT PERNR) is finished.
END-OF-SELECTION.
*report printing using ALV
gt_layout-numc_sum = ''.
gt_layout-colwidth_optimize = 'X'.
gt_layout-max_linesize = '120'.
gt_layout-zebra = 'X'.
PERFORM field_header USING gt_fieldcat[].
PERFORM alv_fill_events USING gt_events[].
PERFORM set_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'Y0PR_HR_25_YRS_SRVC'
i_callback_top_of_page = 'ALV_TOP_OF_PAGE'
it_fieldcat = gt_fieldcat[]
it_sort = gt_sortcat
is_layout = gt_layout
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*
&----
&----
*& Form field_header
&----
text
----
-->P_GT_FIELDCAT[] text
----
FORM field_header USING RT_FC TYPE slis_t_fieldcat_alv .
data: d_menu(60) type c.
constants: c_menu(16) type c value 'Yrs Reached'.
concatenate 'Date' p_ser c_menu into d_menu separated by space.
PERFORM add_field USING rt_fc 'SNAME' 'NAME' '35' '' ''.
PERFORM add_field USING rt_fc 'PERNR' 'Employee Number' '10' '' ''.
PERFORM add_field USING rt_fc 'PERSG' 'Job Family' '12' '' ''.
PERFORM add_field USING rt_fc 'PTEXT' 'Job Family Text' '20' '' ''.
*ETC
PERFORM add_field USING rt_fc 'SDAT' d_menu '10' '' ''.
PERFORM add_field USING rt_fc 'AWART' 'Absence Type.' '10' '' ''.
PERFORM add_field USING rt_fc 'UMSCH' 'Absence Reason' '20' '' ''.
PERFORM add_field USING rt_fc 'ABWTG' 'Days' '6' '' ''.
PERFORM add_field USING rt_fc 'ATEXT' 'Absence Description' '25' '' ''.
PERFORM add_field USING rt_fc 'GRSTY' 'Discip. Type' '10' '' ''.
PERFORM add_field USING rt_fc 'LTEXT' 'Disciplinary text ' '20' '' ''.
ENDFORM. " field_header
&----
*& Form add_field
&----
text
----
-->P_RT_FC text
-->P_0257 text
-->P_0258 text
-->P_0259 text
-->P_0260 text
-->P_0261 text
----
FORM add_field USING P_RT_fieldcat TYPE slis_t_fieldcat_alv
p_fieldname
p_seltext_m
p_outputlen
p_sum
p_col.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ADD 1 TO w_col_pos.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = p_fieldname.
ls_fieldcat-seltext_m = p_seltext_m.
ls_fieldcat-outputlen = p_outputlen.
ls_fieldcat-col_pos = w_col_pos.
ls_fieldcat-do_sum = p_sum.
IF p_sum = 'X'.
ls_fieldcat-no_zero = 'X'.
ENDIF.
ls_fieldcat-emphasize = p_col.
APPEND ls_fieldcat TO p_rt_fieldcat.
ENDFORM. " add_field
&----
*& Form alv_fill_events
&----
text
----
-->P_GT_EVENTS[] text
----
FORM alv_fill_events USING rt_events TYPE slis_t_event.
.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
User Command
READ TABLE rt_events WITH KEY name = slis_ev_user_command
INTO ls_event.
IF sy-subrc = 0.
MOVE f_user_command TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
READ TABLE gt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. " alv_fill_events
&----
*& Form set_sort
&----
text
----
--> p1 text
<-- p2 text
----
*----
FORM alv_top_of_page.
"#EC CALLED
DATA: ls_line TYPE slis_listheader.
DATA: lt_top_of_page TYPE slis_t_listheader.
DATA: c_begda(10),
c_endda(10).
DATA: c_sysdate(10),
c_fdate(10),
c_ldate(10),
c_page(2) type c.
CLEAR ls_line.
10-23-2006 6:01 AM
Hi,
Try with these links.
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
http://www.atomhr.com/training/Technical_Topics_in_HR.htm
http://www.planetsap.com/hr_abap_main_page.htm
you can see some Standard Program examples in this one..
http://www.sapdevelopment.co.uk/programs/programshr.htm
These are the FAQ's that might helps you