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 problem

Former Member
0 Likes
853

Hi experts

I used the following query, its not picking the value for the field ZUONR.

I dont understand, why it is not picking for the particular field only.

SELECT bukrs

belnr

gjahr

buzei

shkzg

wrbtr

hkont

kunnr

lifnr

sgtxt

KOART

ZUONR * this field not picking the data

matnr

PSWSL

FROM bseg

INTO TABLE it_bseg

FOR ALL ENTRIES IN it_bkpf

WHERE belnr EQ it_bkpf-belnr

AND gjahr EQ it_bkpf-gjahr

AND bukrs IN s_bukrs.

Can anyone explain me why it is, and how to correct this query.

Thanks in advance

Regards

Rajaram

1 ACCEPTED SOLUTION
Read only

former_member189059
Active Contributor
0 Likes
834

try this...

SELECT bukrs

belnr

gjahr

buzei

shkzg

wrbtr

hkont

kunnr

lifnr

sgtxt

KOART

ZUONR * this field not picking the data

matnr

PSWSL

FROM bseg

INTO <b>corresponding fields of </b>TABLE it_bseg

FOR ALL ENTRIES IN it_bkpf

WHERE belnr EQ it_bkpf-belnr

AND gjahr EQ it_bkpf-gjahr

AND bukrs IN s_bukrs.

6 REPLIES 6
Read only

Former Member
0 Likes
834

deleted

Message was edited by:

Kiran Machavarapu

Read only

former_member189059
Active Contributor
0 Likes
835

try this...

SELECT bukrs

belnr

gjahr

buzei

shkzg

wrbtr

hkont

kunnr

lifnr

sgtxt

KOART

ZUONR * this field not picking the data

matnr

PSWSL

FROM bseg

INTO <b>corresponding fields of </b>TABLE it_bseg

FOR ALL ENTRIES IN it_bkpf

WHERE belnr EQ it_bkpf-belnr

AND gjahr EQ it_bkpf-gjahr

AND bukrs IN s_bukrs.

Read only

0 Likes
834

Hi

Now its picking the data yar, what is the problem before.

what u chnages now.

Regards

Rajaram

Read only

0 Likes
834

when you put data into a table, it puts all the data in the same order that it gets it from the table

in many cases (such as yours) the data fetched is not in the same order as your internal table's structure

in order to keep the order, we can use 'into corresponding fields of' addition

this checks the field names and puts the data in them accordingly

Read only

0 Likes
834

ok thank you very much yar.

Regards

Rajaram

Read only

former_member194669
Active Contributor
0 Likes
834

Hi,

1. First check it_bseg internal table contains the same field name

2. Check in it_bseg the fields are in same order as you mentioned.

3. if above are okay change the query as


SELECT bukrs
belnr
gjahr
buzei
shkzg
wrbtr
hkont
kunnr
lifnr
sgtxt
KOART
ZUONR * this field not picking the data
matnr
PSWSL
FROM bseg
INTO corresponding fields of TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE belnr EQ it_bkpf-belnr
AND gjahr EQ it_bkpf-gjahr
AND bukrs IN s_bukrs.

a®