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 with pattern

dmi
Participant
0 Likes
1,218

Hello

I have this problem:

MAKT-MAKTX contains the value 'abc+def"

How can I find this pattern?

I tryed with:

data lr_maktx type range of maktx.

select * from makt into table lt_makt

where maktx in lr_maktx.

but it doesn't work

Thanks for any help

Daniel

12 REPLIES 12
Read only

deepak_dhamat
Active Contributor
0 Likes
1,167

HI

data lr_maktx type range of maktx.
select * from makt into table lt_makt
where maktx in lr_maktx.

USE :

  • Ranges in order to Pass parameter to query

RANGES : Lr_matkl FOR makt-maktx .

  • Create Material Parameter

MOVE 'I' TO Lr_maktx-sign.

MOVE 'CP' TO Lr_maktx-option.

MOVE 'abc+def' TO Lr_maktx-low.

APPEND Lr_maktx.

ENDIF.

SELECT * FROM MAKT INTO CORRESPONDING FIELDS OF TABLE IT_MAKT

WHERE MAKTX IN LR_mAKTX .

regards

Deepak.

Read only

0 Likes
1,167

HI Deepak

At first:

RANGES is the old version, don't use iit!

Second:

Have you tried your proposal in a SAP ECC6? - It works in your system?

In my system it doesn't work!

Daniel

Read only

0 Likes
1,167

Hi Daniel,

Please, show an example of the data in your MAKTX field (like "abckdef", etc.).

And confirm that your pattern is "abcdef" where "" means any character in that place.

Best regards,

Leandro Mengue

Read only

0 Likes
1,167

Hi Leandro

Please read my question carefully - if you have a solution, I am very glad

IF NOT - LET IT - I give you only points for a solution how works, please try at first in your system

Daniel

Read only

0 Likes
1,167

Don't be so impatient with the people trying to help you, rather tell what has not worked, do not offer points publicly, and answer the following questions:

- is "+" meant to be a wildcard placeholder for one character or the actual plus sign?

- can your search string appear at any place in the material description with other characters before or after?

Thomas

Read only

0 Likes
1,167

Hi all together

Sorry if I'm not nice - but my question was clear!!!

And here is the solution:

select * from tab where feld like '%+%'.

All points for my self

Daniel

Read only

0 Likes
1,167

You don't have to be nice, just polite towards people that you are asking for help, and your question was not clear. It was unclear whether "+" was supposed be a wildcard or normal character, and it was unclear that "abc" and "def" was your personal terminology for "any characters".

Enjoy your points.

Thomas

Read only

0 Likes
1,167

Sorry Daniel, you DO NOT solve your own question!!!

Remember that you use "range of" in your question?!

So, this is the correct answer: ( using the escape operator: # )

DATA: it_makt like makt occurs 0.
 
DATA: w_maktl like range of makt-maktx with header line.
 
w_maktl-sign = 'I'.
w_maktl-option = 'CP'.
w_maktl-low = '*#+*'.
APPEND w_maktl.
 
SELECT * from makt into table it_makt
 where maktx in w_maktx.

Best regards,

Leandro Mengue

Read only

0 Likes
1,167

Hi Leandro

Sorry again - please accept my appology

Your solution works, thanks

Daniel

Read only

0 Likes
1,167

Hi Daniel,

That´s ok. Glad to help.

Best regards,

Leandro Mengue

Read only

Former Member
0 Likes
1,167

Hi,

Please, try this:

DATA: it_makt like makt occurs 0.

DATA: w_maktl like range of makt-maktx with header line.

w_maktl-sign = 'I'.
w_maktl-option = 'CP'.
w_maktl-low = 'abc+def'.
APPEND w_maktl.

SELECT * from makt into table it_makt
 where maktx in w_maktx.

Best regards,

Leandro Mengue

Read only

dmi
Participant
0 Likes
1,167

Solved by my self