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: 

query not working

Former Member
0 Kudos

Hi all,

I am working in 4.6c, i have written a select query as below but it is not populating the internal table.please help . urgent.

SELECT lifnr

name1

brsch

INTO CORRESPONDING FIELDS OF TABLE vend_det

FROM lfa1

FOR ALL ENTRIES IN po_hdr

WHERE lifnr = po_hdr-lifnr

AND brsch = 1.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Satya,

get all the lifnrs into IT_lifnr.

delete adjacent duplicates from it_lifnr.

if not it_lifnr[] is initial.

select lifnr

name1

into table vend_Det

from lfa1

for all entries in it_lifnr

where lifnr = it_lifnr-lifnr

and brsch = '0001'.

endif.

this should work.

-Anu

4 REPLIES 4

Former Member
0 Kudos
try this..., change the ones in bold

<b>if not po_hdr[] is initial.</b>

SELECT lifnr
name1
brsch
INTO CORRESPONDING FIELDS OF TABLE vend_det
FROM lfa1
FOR ALL ENTRIES IN po_hdr
WHERE lifnr = po_hdr-lifnr
AND brsch = <b>'0001'</b>. 
<b>
endif.</b>

Former Member
0 Kudos

I tried even this, but it is not populating the internal table. the required vendor number(LIFNR) is present in the PO_HDR internal table but i dont know why it is not populating the <b>vend_det</b> internal table.

0 Kudos

for that combination of LIFNR and BRSCH chk if it exits in LFA1,

also while checking if the internal table used for for all entries is initial or not , check the whole body , i.e give square brackets

Former Member
0 Kudos

Hi Satya,

get all the lifnrs into IT_lifnr.

delete adjacent duplicates from it_lifnr.

if not it_lifnr[] is initial.

select lifnr

name1

into table vend_Det

from lfa1

for all entries in it_lifnr

where lifnr = it_lifnr-lifnr

and brsch = '0001'.

endif.

this should work.

-Anu