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

Select Statement

Former Member
0 Likes
492

if product_search-resp_product_company IS NOT INITIAL.

SELECT zzrefeng

zzcrmgroup

FROM zcs_soltype

INTO TABLE i_zcs_soltype

WHERE zzcrmgroup in r_zzcrmgroup.

if not i_zcs_soltype[] is initial. ---> Here I have around 16 records.

now for each value of zzrefeng i need to select the below fields. Finally i need all the records to be updated in i_equi table. Can anyone help me out in writing the code for this. For each ZZREFENG value i am able to get the records in i_equi but finally those are ovewriting.

loop at i_zcs_soltype into w_zcs_soltype.

SELECT a~equnr

a~zzengn

a~zzrefeng

a~eqtyp

a~objnr

b~stat

into TABLE i_equi

FROM equi AS a INNER JOIN jest AS b

ON aobjnr = bobjnr

WHERE a~zzengn IN r_zzengn AND

a~equnr IN r_equnr AND

a~zzrefeng = w_zcs_soltype-zzrefeng AND

a~eqtyp IN r_eqtyp AND

eqtyp IN ('A','D','E','G','H','I','J','K','L','N','O','R','T') AND

b~stat <> 'I0076' AND

b~inact = space .

endloop.

endif.

endif.

3 REPLIES 3
Read only

Former Member
0 Likes
446

HI Ram,

Instead of selecting in a loop. Try FOR ALL ENTRIES as this would also improve the performance of your code.

IF NOT i_zcs_soltype[] IS INITIAL.

SELECT a~equnr

a~zzengn

a~zzrefeng

a~eqtyp

a~objnr

b~stat

into TABLE i_equi

FROM equi AS a INNER JOIN jest AS b

ON aobjnr = bobjnr

<b>FOR ALL ENTRIES</b> IN i_zcs_soltype

WHERE a~zzengn IN r_zzengn AND

a~equnr IN r_equnr AND

a~eqtyp IN r_eqtyp AND

a~eqtyp IN 'A','D','E','G','H','I','J','K','L','N','O','R','T') AND

a~zzrefeng = <b>i_zcs_soltype-zzrefeng</b> AND

b~stat <> 'I0076' AND

b~inact = space .

Endif.

Regards

Read only

Former Member
0 Likes
446

Hi Ram,

Use <b>APPENDING TABLE</b> itab option of INTO clause.

loop at i_zcs_soltype into w_zcs_soltype.

SELECT a~equnr

a~zzengn

a~zzrefeng

a~eqtyp

a~objnr

b~stat

<b>into Appending TABLE i_equi</b>

FROM equi AS a INNER JOIN jest AS b

ON aobjnr = bobjnr

WHERE a~zzengn IN r_zzengn AND

a~equnr IN r_equnr AND

a~zzrefeng = w_zcs_soltype-zzrefeng AND

a~eqtyp IN r_eqtyp AND

eqtyp IN ('A','D','E','G','H','I','J','K','L','N','O','R','T') AND

b~stat <> 'I0076' AND

b~inact = space .

endloop.

Reward points if this helps.

Manish

Message was edited by: Manish Kumar

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
446

Hi,

SELECT equnr

zzengn

zzrefeng

eqtyp

objnr

into TABLE i_equi

FROM equi

for all entries in i_zcs_soltype

WHERE zzengn IN r_zzengn AND

equnr IN r_equnr AND

zzrefeng = i_zcs_soltype-zzrefeng AND

eqtyp IN r_eqtyp AND

eqtyp IN ('A','D','E','G','H','I','J','K','L','N','O','R','T').

SELECT objnr stat

into TABLE i_jest

FROM jest for all entries in i_equi

WHERE objnr = i_equi-objnr

and stat <> 'I0076' AND

b~inact = space .

loop at i_equi into w_equi.

move-corresponding w_equi to w_final.

loop at i_jest into w_jest where objnr = w_equi-objnr.

move-corresponding w_jest to w_final.

append w_final to i_final.

endloop.

endloop.

Hope it helps.If so,reward points.