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 from table

Former Member
0 Likes
758

Hi Friends ,

I have the following SELECT to get data from a ztable . I checked the table for the same criteria and there is data . Any idea why it is returning with SY-SUBRC = 4 ?

S_DISP and S_DISP1 are the 2 diff selection criteria on the same selection screen .

I also checked there is data in T_NORMT with plan plate .

Thanks for all your help !

Teresa.

Loop at t_normt.

SELECT WERKS

MATNR

BUILDING_I

NORMT

DISPO

z1

z2

FROM ztable

INTO TABLE itab

WHERE ZWERKS = P_PWWRK

AND NORMT = T_NORMT-NORMT

AND BUILDING_I = P_BLDGI

AND DISPO IN S_DISP

AND DISPO IN S_DISP1.

endloop.

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
736

hi,

AND DISPO IN S_DISP

AND DISPO IN S_DISP1.

change it to:

AND DISPO IN S_DISP

OR DISPO IN S_DISP1.

hope this helps

ec

7 REPLIES 7
Read only

Former Member
0 Likes
736

use select single * or select upto 1 row inside the loop end loop

Read only

Former Member
0 Likes
736

in your where statement you are checking 1 field with 2 different select options (DISPO). Just put both selections in the same select option. (or perhaps you meant to check 2 different fields

Read only

JozsefSzikszai
Active Contributor
0 Likes
737

hi,

AND DISPO IN S_DISP

AND DISPO IN S_DISP1.

change it to:

AND DISPO IN S_DISP

OR DISPO IN S_DISP1.

hope this helps

ec

Read only

0 Likes
736

Hi Eric ,

Though I am checking for the same field DISPO . I need to check against 2 different selections S_DISP1 and S_DISP on the selection screen . How do I combine them ?

Thanks

Read only

Former Member
0 Likes
736

Try to test the select statement before looping. Also, check by testing where condition in your select statement individually.

Thanks,

siddu

Read only

Former Member
0 Likes
736

Hi,

The problem is with the select statement.

Because you are comparing the field dispo with s_disp and s_disp1, the condition gets false eventhough the data exists in the table. Because you are using AND the dispo value at the same time cannot hold two values from two fields i.e. at a any particular instance the dispo field should contain both the values from s_disp and s_disp1 if you use AND.

If you use OR then you will get both the records.

Remember that for AND both the s_disp and s_disp1 must have same values to satisfy condition.

For OR either s_disp or s_disp1 can have values.

Inorder to get single record using or, use select single stmt.

<REMOVED BY MODERATOR>

Thanks and Regards.

Edited by: Ammavajjala Narayana on Mar 28, 2008 6:03 PM

Edited by: Ammavajjala Narayana on Mar 28, 2008 6:05 PM

Edited by: Alvaro Tejada Galindo on Mar 28, 2008 6:16 PM

Read only

Former Member
0 Likes
736

hi,

use multiple select option, it may solve u'r problem.

there is extension box , use that to give u'r two selection ctiteria's

don't use wo select options

regards,

chandu