Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

querying based on list

Former Member
0 Likes
426

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

2 REPLIES 2
Read only

former_member386202
Active Contributor
0 Likes
410

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

Read only

Former Member
0 Likes
410

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.