on 02-16-2007 12:52 PM
hi all,
there is an function where i can get the absence data but my client wants in the following order
But my client wants the report in following format:
YEAR--- week number--
number of absence hourse in that week
2006 -
WEEK -
-
HOURS
infotype is pa2001.
thx in advance.
Sunil
Thx Guillaume.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Read the table pa2001 and get all the records for the selected date and Employee (PERNR)
Use the function module 'DATE_GET_WEEK' to compute the week number from the day.
Use a COLLECT statement for summing the STDAZ field.
Please assign points and close the following numerous threads if you have no remaining questions:
...
Best regards,
Guillaume
Message was edited by:
Guillaume Garcia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sunil,
Table PTQUODED may be better suited than PA2001 because in PA2001 it is <b>very difficult to distinguish between absences that overlap between 2 or more weeks</b>.
Here is sample code that does exactly what you need:
REPORT zggar_abs.
DATA: ta_ptquoded TYPE TABLE OF ptquoded.
DATA: l_week TYPE scal-week.
DATA: BEGIN OF ta_abs OCCURS 0,
pernr TYPE pernr,
year(4) TYPE c,
week(2) TYPE c,
abs TYPE f,
END OF ta_abs.
DATA: wa_abs LIKE LINE OF ta_abs.
FIELD-SYMBOLS: <fs_ptquoded> LIKE LINE OF ta_ptquoded.
PARAMETERS : p_pernr TYPE p_pernr.
SELECT * FROM ptquoded
INTO TABLE ta_ptquoded
WHERE pernr = p_pernr.
LOOP AT ta_ptquoded ASSIGNING <fs_ptquoded>.
wa_abs-pernr = <fs_ptquoded>-pernr.
CLEAR: l_week.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = <fs_ptquoded>-datum
IMPORTING
week = l_week.
wa_abs-year = l_week+0(4).
wa_abs-week = l_week+4(2).
wa_abs-abs = <fs_ptquoded>-quode.
COLLECT wa_abs INTO ta_abs.
ENDLOOP.
SORT ta_abs BY year week.
LOOP AT ta_abs INTO wa_abs.
WRITE : wa_abs-year, wa_abs-week, wa_abs-abs.
NEW-LINE.
ENDLOOP.
Please, assign points and close the thread if solved.
Best regards,
Guillaume
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.