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
631

please tell me how we can do this in the select query.

select matnr mtart from mara into itab_mara

where matnr = p_matnr

and mtart must be having some value. ie if it is not having any data in that field it should not fetch that record.

so please tell me how to code my above select statement.

I think we should not use like this.....

select matnr mtart from mara into itab_mara

where matnr = p_matnr

and mtart ne space. " it is not recommended i think

5 REPLIES 5
Read only

Former Member
0 Likes
595

select matnr mtart from mara into itb_mara where matnr = p_matnr.

if itb-mtart is not initial.

delete itb_mara.

endif.

endselect.

u can use the above or the one u mentioned. It will suffice I think...

Read only

Former Member
0 Likes
595

So long as the NE doesn't interfere with the index (and yours doesn't) you should be OK.

Rob

Read only

Former Member
0 Likes
595

Hi Shiva,

try this.

select matnr mtart from mara into itb_mara where matnr = p_matnr and

mtart ne ' '.

Reward if useful.

Regards,

Chitra

Read only

Former Member
0 Likes
595

select matnr mtart from mara into itab_mara

where matnr = p_matnr .

if itab_mara[] is not initial.

Loop at itab_mara.

if itab_mara-mtart is initial.

delete itab_mara.

endif.

endloop.

endif.

Read only

Former Member
0 Likes
595

Hi Shiva,

Your Select statement should only bring back one record.

WHERE MATNR = P_MATNR.

I will assume that your p_matnr is a range table and that it should read

where matnr in p_matnr.

Generally, you want to avoid negatives in your WHERE clause, so in your case you can write it: AND MTART > SPACE.

Hope this helps.

Filler