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 - endselect

Former Member
0 Likes
745

Dear all,i have this statment

select * from mkol where matnr eq intab-matnr and lgort in tem.

if.....endif.

endselect.

and it is working fine,but if i use the following statement,then it str8 go to endselect without go thru the if endif block.

select * from mkol where matnr eq intab-matnr and lgort in tem and not lgort in temc and not logrt in tempd.

if....endif.

endselect.

wat has gone wrong? previously i used in other program,it works,but this time it din work...pls help..thanks

7 REPLIES 7
Read only

Former Member
0 Likes
707

i think for the 2nd select no data are found so it is not going through the select endselect loop. just check it in debug mode the value of sy-subrc and whether any data is fetching or not?

regards

shiba dutta

Read only

Former Member
0 Likes
707

it din fetch any data,but infact there's one record to be fetched..

Read only

Former Member
0 Likes
707

so it is not oing through the if end if..

just check your where condition..

what are temc tempd are they select-options?

regards

shiba dutta

Read only

Former Member
0 Likes
707

Hi,

check whether ur condition is satisfing ur record or not.

regards,

bharat.

Read only

Former Member
0 Likes
707

hi

this is a thread exactly similar to your case posted yesterday..within select...endselect, if sy-subrc ne 0, it will not chk the conditions as every time, select..endselect begins with sy-subrc 0.

if helpful, reward

Sathish. R

Read only

Former Member
0 Likes
707

dear all,i manage to figure out the problem d..some of the storage location din get hard coded..thanks anyway

Read only

Former Member
0 Likes
707

Joan,

Reason is your select statement returning the SY-SUBRC NE 0.

Try like

select * from mkol where matnr eq intab-matnr

and lgort in tem

and not ( lgort in temc

and logrt in tempd.

if....endif.

endselect.