05-22-2006 8:36 AM
Hi,
I am populating one field of an internal table for all entries existing in that internal table.That field is getting populated but rest of the fields changed to its default values.
Please check the code
SELECT amatnr awerk almenge01 almenge02 almenge03 almenge04 almenge05 almenge06 a~lmenge07
almenge08 aprueflos aart acharg bvcode bvdatum
INTO CORRESPONDING FIELDS OF TABLE i_out
FROM qals AS a INNER JOIN qave AS b
ON aprueflos = bprueflos
WHERE a~matnr IN s_matnr
AND a~werk IN s_werk
AND a~art IN s_art
AND a~stat33 = 'X'
AND b~vcodegrp IN s_vcdgrp
AND b~vcode IN s_vcode
AND b~vdatum IN s_vdatum.
I am getting error here i_out is getting populated in teh first select statement
SELECT mncod
INTO CORRESPONDING FIELDS OF TABLE i_out
FROM qmsm
FOR ALL ENTRIES IN i_out
WHERE qmnum = i_out-qmnum.
05-22-2006 8:56 AM
Try changing your query in the following way....
SELECT a~matnr a~werk a~lmenge01 a~lmenge02 a~lmenge03 a~lmenge04
a~lmenge05 a~lmenge06 a~lmenge07
a~lmenge08 a~prueflos a~art a~charg b~vcode b~vdatum
<b>c~mncod</b>
FROM qals AS a INNER JOIN qave AS b
ON a~prueflos = b~prueflos
<b>join qmsm as c
ON a~prueflos = c~qmnum</b>
INTO CORRESPONDING FIELDS OF TABLE i_out
WHERE a~matnr IN s_matnr
AND a~werk IN s_werk
AND a~art IN s_art
* AND a~stat33 = 'X'
AND b~vcodegrp IN s_vcdgrp
AND b~vcode IN s_vcode
AND b~vdatum IN s_vdatum.
with the above you can do the two steps only once .
you need not to go for for all entries .
Regards
vijay
05-22-2006 8:42 AM
Hai Mukesh
qmnum field not declared/Select in i_out at the above select query
check it and try again
Thanks & regards
Sreeni
05-22-2006 8:43 AM
Hi Mukesh,
u should specify a different internal table in the addition
"INTO CORRESPONDING FIELDS OF TABLE <b>i_out</b>"
05-22-2006 8:44 AM
SELECT mncod
INTO CORRESPONDING FIELDS OF TABLE <b>i_out</b>---->wrong
FROM qmsm
FOR ALL ENTRIES IN i_out
WHERE qmnum = i_out-qmnum.
how u can select into same table for all entries of same table....
05-22-2006 8:55 AM
05-22-2006 8:57 AM
declare internal table i_out1 same as i_out.
SELECT amatnr awerk almenge01 almenge02 almenge03 almenge04 almenge05 almenge06 a~lmenge07
almenge08 aprueflos aart acharg bvcode bvdatum
INTO CORRESPONDING FIELDS OF TABLE i_out
FROM qals AS a INNER JOIN qave AS b
ON aprueflos = bprueflos
WHERE a~matnr IN s_matnr
AND a~werk IN s_werk
AND a~art IN s_art
AND a~stat33 = 'X'
AND b~vcodegrp IN s_vcdgrp
AND b~vcode IN s_vcode
AND b~vdatum IN s_vdatum.
<b>i_out1[] = i_out[].
SELECT mncod
INTO CORRESPONDING FIELDS OF TABLE i_out1
FROM qmsm
FOR ALL ENTRIES IN i_out
WHERE qmnum = i_out-qmnum.</b>
05-22-2006 8:44 AM
Hi Mukesh,
In your first internal table <b>i_out</b> there is no field seleced <b>qmnum[/b, but you used for all entries while selecting data from <b>qmsm</b> table with WHERE clause WHERE qmnum = i_out-qmnum.
select qmnum field and put it into i_out internal table.
I hope it helps you, if the same please reward points
Regards
Prabhu
05-22-2006 8:56 AM
Try changing your query in the following way....
SELECT a~matnr a~werk a~lmenge01 a~lmenge02 a~lmenge03 a~lmenge04
a~lmenge05 a~lmenge06 a~lmenge07
a~lmenge08 a~prueflos a~art a~charg b~vcode b~vdatum
<b>c~mncod</b>
FROM qals AS a INNER JOIN qave AS b
ON a~prueflos = b~prueflos
<b>join qmsm as c
ON a~prueflos = c~qmnum</b>
INTO CORRESPONDING FIELDS OF TABLE i_out
WHERE a~matnr IN s_matnr
AND a~werk IN s_werk
AND a~art IN s_art
* AND a~stat33 = 'X'
AND b~vcodegrp IN s_vcdgrp
AND b~vcode IN s_vcode
AND b~vdatum IN s_vdatum.
with the above you can do the two steps only once .
you need not to go for for all entries .
Regards
vijay