Application Development 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: 

Select command prob.

Former Member
0 Kudos
135

Hi,

I have a requirement that in qals table i get lot no.s & in qamr table i can get multiple entries for a single lot. I need to get single record from qamr table for all entries in qals table's lot at a single shot.

pl anybody help me how to do.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
99

Hi,

if you want in singel shot use inner joins.

select l~PRUEFLOS

l~WERK

l~b

l~c

k~VORGLFNR

k~ab

k~bc

k~ca

into corresponding fields of table it_join

from QALS as l inner join QAMR as k on lPRUEFLOS eq kPRUEFLOS

where l~ebeln in s_ebeln AND

k~ab IN s_ab.

where a, b, c, ab, bc, ca are other fields/.

Thsi may full fill ur requirement.

Thanks & regards

5 REPLIES 5

Former Member
0 Kudos
99

Can you explain a bit more clear?

Former Member
0 Kudos
99

Hi

Do u mean that for single Lot you shd get single entry instead of multiple entries.

Please Clarify this

Regards

Rasheed

Former Member
0 Kudos
100

Hi,

if you want in singel shot use inner joins.

select l~PRUEFLOS

l~WERK

l~b

l~c

k~VORGLFNR

k~ab

k~bc

k~ca

into corresponding fields of table it_join

from QALS as l inner join QAMR as k on lPRUEFLOS eq kPRUEFLOS

where l~ebeln in s_ebeln AND

k~ab IN s_ab.

where a, b, c, ab, bc, ca are other fields/.

Thsi may full fill ur requirement.

Thanks & regards

Former Member
0 Kudos
99

select PRUEFLOS .... from QALS into it_qals ..............

if not it_qals[] is initial.

select PRUEFLOS .... from QAMR into it_qamr

for all entries in it_qals

where PRUEFLOS eq it_qals-PRUEFLOS ..............

endif.

sort it_qamr by PRUEFLOS.

delete adjacent duplicates from it_qamr comparing PRUEFLOS.

0 Kudos
99

Ans to my q's is.................

this is the code i used for it.

select PRUEFLOS

WERK

field1

field2.........

from qals into table itab where <cond>.

if sy-subrc eq 0.

select prueflos

from qamr into table itab2

for all entries in itab

where prueflos eq itab-prueflos

group by prueflos.

endif.

I heard that sap 6 ecc doesn't recommend innerjoins so i used the above 1.