‎2007 Dec 20 9:52 AM
Hi,
I have the employee number in an internal table. I should pick the leave hours for the employees from catsdb.
When I use 'for all entries in itab' , I am not getting all the records.
One employee has 8 , 6 , 8 hours of leave. But I get only first and second record. Not the thrid one.
Is their anyother way without using for all entries in select query.
regards
Balaji
‎2007 Dec 20 9:54 AM
Hi,
Refer this
&----
*& Form sub_read_catsdb
&----
text
----
FORM sub_read_catsdb .
*--Local Variables
DATA : lv_index LIKE sy-tabix.
IF NOT it_pa2010[] IS INITIAL.
*--Select Personnel number Date Receiver Order and Wage Type from
Table catsdb
SELECT pernr "Personnel number
workdate "Date
raufnr "Receiver Order
lgart "Wage Type
FROM catsdb
INTO TABLE it_catsdb
FOR ALL ENTRIES IN it_pa2010
WHERE pernr EQ it_pa2010-pernr
AND workdate GE it_pa2010-begda
AND workdate LE it_pa2010-endda
AND lgart EQ it_pa2010-lgart
AND raufnr IN s_raufnr.
IF sy-subrc EQ 0.
*--Sort Table by personnel number and wage type
SORT it_catsdb BY pernr lgart.
ENDIF.
ENDIF.
Regards,
Prashant
‎2007 Dec 20 9:57 AM
Hi,
Keep employee no as the common field for both internal tables.
select empno from table .. into itab1.
if not itab1 is initial.
select leave from ... into itab2
for all entries in itab1
where empno = itab1-empno.
endif.
Reward points if useful.