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: 

search single character

Former Member
0 Kudos
135

Hello All,

I have a select option using which I want to find material number 'ABCDE'. My problem is I do not know the third character for example. So how do I find 'AB%DE' I cant use '' as I will give me all the materials similar to AB. But I want to restrict only the third character.

Thanks in advance.

Regards,

Anju

10 REPLIES 10

Former Member
0 Kudos
81

What problem you are facing by AB*DE?

Regards

Shiba Prasad Dutta

0 Kudos
81

ABDE will give me data similar to AB and not restrict to searching the third character.

Thanks,

Anju

former_member223537
Active Contributor
0 Kudos
81
REPORT  zgetmatnr.



PARAMETER : p_matnr TYPE mara-matnr.


TYPES : BEGIN OF t_mara,
          matnr TYPE mara-matnr,
        END OF t_mara.

DATA : gt_mara TYPE STANDARD TABLE OF t_mara,
       wa_mara TYPE t_mara.



SELECT matnr
   FROM mara
   INTO TABLE gt_mara
   WHERE matnr LIKE p_matnr.



LOOP AT gt_mara INTO wa_mara.
  WRITE 😕 wa_mara-matnr.
ENDLOOP.

On selection screen give AB%DE

SuhaSaha
Advisor
Advisor
0 Kudos
81

Hello Anju,

You can create a range table & use it for selection:


DATA:
R_T001 TYPE FAGL_RANGE_T_BUKRS,
R_L_T001 TYPE FAGL_RANGE_BUKRS,
IT_T001 TYPE STANDARD TABLE OF T001.


R_L_T001-SIGN = 'I'.
R_L_T001-OPTION = 'CP'.
R_L_T001-LOW = '10*1'.

APPEND R_L_T001 TO R_T001.

SELECT * INTO TABLE IT_T001
FROM T001
WHERE BUKRS IN R_T001.

IF SY-SUBRC = 0.
ENDIF.

This is for BUKRS with '10*1'. Similarly you can use the range for matnr.

BR,

Suhas

Former Member
0 Kudos
81

Hi,

But that what my problem is. your query will give me '1001' as well as '10001'. But I want '*' to restrict it to only the four character result.

Thanks/Regards,

Anju

Former Member
0 Kudos
81

Please check if the code below works

SELECT * INTO TABLE.... 
FROM T001
WHERE BUKRS LIKE '1_0_'.

0 Kudos
81

Hello Anju,

Tell me do you know all the other characters except the 4th character. I mean in my query BUKRS has 4 characters & i know 3 characters except one.

Is it the same with you?

BR,

Suhas

Former Member
0 Kudos
81

Hi Anju,

Use the following query:

SELECT matnr FROM mara INTO TABLE it_mara WHERE matnr LIKE 'AB%DE'.

Regards,

Nitin.

Former Member
0 Kudos
81

In select options you can use AB+DE.

Regards

Shiba Prasad Dutta

Former Member
0 Kudos
81

answered