04-30-2009 8:26 PM
Hello,
I am using following query to select data from HR infotype tables. Now I want to put a restriction that, select the data below only until maximum number defined.
What I mean to say is if someone enters Last name as 'smith' and I define the maximum number as 5, then only 5 personnel number should be fetched, even if there are 50 personnels with same kind of last name. How can I do this with upto rows ?
SELECT aPERNR bNCHMC b~VNAMC
INTO TABLE itab_data
from PA0001 as a
inner join PA0002 as b
on apernr = bpernr
where a~PERNR in S_PERNR
and a~BUKRS in S_BUKRS
and a~KOSTL in S_KOSTL
and a~PERSG in S_EMPGP
and a~PERSK in S_SUBGP
and b~NCHMC in S_LAST
and b~VNAMC in S_FIRST.
Regards,
Jainam.
Moderator message - Pressing F1 on SELECT should resolve your issue - post locked
Edited by: Rob Burbank on Apr 30, 2009 4:29 PM
04-30-2009 9:29 PM
Hi,
Try this:
SELECT a~PERNR b~NCHMC b~VNAMC
INTO TABLE itab_data
from PA0001 as a
inner join PA0002 as b
on a~pernr = b~pernr
up to 5 rows
where a~PERNR in S_PERNR
and a~BUKRS in S_BUKRS
and a~KOSTL in S_KOSTL
and a~PERSG in S_EMPGP
and a~PERSK in S_SUBGP
and b~NCHMC in S_LAST
and b~VNAMC in S_FIRST.
Thanks,
SKJ