cancel
Showing results for 
Search instead for 
Did you mean: 

Retriving Absence data from PNP logical database

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thx Guillaume.

guillaume-hrc
Active Contributor
0 Kudos

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

Former Member
0 Kudos

hi

thx for your replay.

but in my code i was already used that 'DATE_GET_WEEK' function module its working but in different format.

guillaume-hrc
Active Contributor
0 Kudos

Hi,

What do you mean by different format.

The week number is in the 2 last characters, and the year is the four first ones.

  call function 'DATE_GET_WEEK'
    exporting
      date   = sy-datum
    importing
      week = w_week_full.

  w_week = w_week_full+4(2).

Message was edited by:

Guillaume Garcia

guillaume-hrc
Active Contributor
0 Kudos

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