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

query not working

Former Member
0 Likes
621

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
Read only

Former Member
0 Likes
576

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
Read only

Former Member
0 Likes
576
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>
Read only

Former Member
0 Likes
576

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.

Read only

0 Likes
576

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

Read only

Former Member
0 Likes
577

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