2009 Apr 06 6:15 PM
Hi all,
how to count number of employ in several bukrs.
I have 25 bukrs , I need to display number of employs from every company separated in one report
eg. bukrs 2800 4539 emp
2300 342 emp.
I used pa0000 and pa0001.
2009 Apr 06 6:37 PM
Try this way
ranges : r_bukrs for t001-bukrs.
select * from t001 into table i_t001.
loop at i_t001w.
move 'I' to r_bukrs-sign.
move 'EQ' to r_bukrs-option.
move i_t001-bukrs to r_bukrs-low.
append r_bukrs.
endloop.
if not r_bukrs[] is initial.
select count( distinct pa0001~pernr ) into i_noofemp
from pa0001 inner join pa0000
on pa0001~pernr = pa0000~pernr
where pa0001~bukrs in r_bukrs.
endif.
a®
2009 Apr 06 6:19 PM
Hi,
If you are using the LDB then use the collect statement to get the count.
If you are using the Select statement to get the Pernr 0000 and 0001 infotype data ..you need to loop and find the Count as per bukrs.
Incase LDB.
GET PERNR.
ITAB-bukrs = P0001-bukrs.
ITAB-COUNT = 1.
COLLECT ITAB.
Clear ITAB.
In case Select.
LOOP AT PA0001.
ITAB-bukrs = P0001-bukrs.
ITAB-COUNT = 1.
COLLECT ITAB.
Clear ITAB.
ENDLOOP.
2009 Apr 06 6:37 PM
Try this way
ranges : r_bukrs for t001-bukrs.
select * from t001 into table i_t001.
loop at i_t001w.
move 'I' to r_bukrs-sign.
move 'EQ' to r_bukrs-option.
move i_t001-bukrs to r_bukrs-low.
append r_bukrs.
endloop.
if not r_bukrs[] is initial.
select count( distinct pa0001~pernr ) into i_noofemp
from pa0001 inner join pa0000
on pa0001~pernr = pa0000~pernr
where pa0001~bukrs in r_bukrs.
endif.
a®
2009 Apr 06 9:27 PM
Very vague - do you want only active employees, all employees, something else?
Rob