Application Development 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: 

select statement

Former Member
0 Kudos

Hi Friends,

suppose i have 6 fields f1,f2,f3,f4 & f5, f6.

Now i wrote the select statement.

I wanted to write the logic for field f6. If f6 is blank then it will exclude the records from the report.

My selection is based on 2 fields criteria so that it will select other values i.e

select f1 f2 f3 f4 from table where f5 = '1' and not f6 is initial.

Is the above select statement is correct??

Plz send me the coding.

6 REPLIES 6

naimesh_patel
Active Contributor
0 Kudos

Hello,

data : begin of itab occurs 0,

f1,

f2,

f3,

f4,

end of itab.

select f1 f2 f3 f4

into table itab

from d_table

where f5 = 1

and nto f6 is initial.

loop at itab.

  • write here

endloop.

regards,

Naimesh

Former Member
0 Kudos

yes .

Another way is:

f6 ne ' '.

Rgds,

HR

Former Member
0 Kudos

select f1 f2 f3 f4 from table where f5 = '1' and not f6 is initial.

The only suggestion here would be to use into option.

SELECT F1 F2 F3 F4 INTO TABLE ITAB

FROM XYZ

WHERE F5 = '1' AND NOT F6 IS INITIAL.

Regards

Anurag

former_member188685
Active Contributor
0 Kudos

Hi,

you can do this..

select f1 f2 f3 f4 from table into itab where f5 = '1' .
if sy-subrc = 0.
delete itab where f6 = ' '.
endif.

regards

vijay

Former Member
0 Kudos
select f1 f2 f3 f4 from ztable into table itab 
 where f5 = '1' and f6 ne space.

Former Member
0 Kudos
select f1 f2 f3 f4
      into table itab
      from d_table
      where f5 = 1
      and   f6 NE space.

If F6 is a character type u can define as above.

Or if F6 of other than character type and it is of NUMC length 6.

select f1 f2 f3 f4
      into table itab
      from d_table
      where f5 = 1
      and   f6 NE '000000'.

OR for type I

select f1 f2 f3 f4
      into table itab
      from d_table
      where f5 = 1
      and   f6 NE '      '. (6 spaces)

Try any one of these, this will work.

Reward points if this anwers your query.