‎2007 Aug 16 5:15 AM
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
‎2007 Aug 16 5:24 AM
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.
‎2007 Aug 16 5:19 AM
‎2007 Aug 16 5:24 AM
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.
‎2007 Aug 16 5:33 AM
Hi
Now its picking the data yar, what is the problem before.
what u chnages now.
Regards
Rajaram
‎2007 Aug 16 5:40 AM
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
‎2007 Aug 16 7:06 AM
‎2007 Aug 16 5:26 AM
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®