Skip to Content
Former Member
May 17, 2007 at 02:43 PM

Problem Using 'LIKE' in Select statement.


Hi Guys,

Presently Iam using the select query on VBAK and VBAP in this way.

SELECT a~vbeln "Sales order number

a~erdat "Creation date

a~ernam "Name of person who created

a~lifsk "Delivery block

a~vkorg "Sales Org

a~spart "Division

b~posnr "Item number

b~matnr "Material number

b~werks "Plant

b~arktx "Short Text for SO Item

b~netwr "Document currency

b~zz_catalog_id "Catalog ID for Variant configurator

FROM vbak AS a


ON a~vbeln = b~vbeln

INTO TABLE i_vbak_vbap

  • WHERE a~vbeln IN s_vbeln

  • AND a~vkorg IN s_vkorg

  • AND a~lifsk NE c_c

WHERE a~erdat IN s_erdat

and a~spart in s_spart

AND b~matnr like s_matnr-low.

Here Iam using the “ Like” to fetch the materials if user in the selection screen enters L* or X then I would be getting materials starting with L or the materials with X as part of the material.I have taken care of the conversions of * to %.

Now the User wants multiple selection of materials where he gives L* and V* and Z*,so that he wants me to fetch all the materials that start with L,V and Z.

I have tried the same statement in various forms but could not succeed ,

Some of the forms I tried …AND ( b~matnr like v_matnr1

and b~matnr like v_matnr2 )

But not able to fetch the records of all the materials which start with L , V and Z. I guess may be Join is making the problem.

I request you guys to give a solution to this in the same SQL statement .

Note: I have done all the conversions of * to %..