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

Ranges

Former Member
0 Likes
703

Hi experts

Can any one tell me the purpose of Contain parameter in ranges.

Ex: r_ran-option = <b><i>'CP'.</i></b>.

Regards

John

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
663

Hi,

It will be dealt as the wild card character here. for example if you give any search like 123, CP will assume the search as 123 i.e. 123 can be any where in the search.

Regards,

Ram

Pls reward points if helpful

5 REPLIES 5
Read only

Former Member
0 Likes
663

CP IS CONTAINS PATTERN .

MEANS 123* THAT IS LIKE 123*

REGARDS

SHIBA DUTTA

Read only

Former Member
0 Likes
664

Hi,

It will be dealt as the wild card character here. for example if you give any search like 123, CP will assume the search as 123 i.e. 123 can be any where in the search.

Regards,

Ram

Pls reward points if helpful

Read only

Former Member
0 Likes
663

Hi ,

Please check this .

CP (Contains Pattern):

The complete string c1 matches the pattern c2 (c1 "matches" c2).

The pattern c2 can contain ordinary characters and wildcards.

'*' stands for any character string and '+' denotes any character.

If the result of the comparison is positive, the system field SY-FDPOS contains the offset of the first character of c2 in c1. The wildcard character '*' at the beginning of the pattern c2 is ignored when determining the value of SY-FDPOS.

If the result of the comparison is negative, the system field SY-FDPOS contains the length of c1.

Examples:

'ABCDE' CP 'CD' is true; SY-FDPOS = 2.

'ABCDE' CP '*CD' is false; SY-FDPOS = 5.

'ABCDE' CP '+CD' is true; SY-FDPOS = 0.

'ABCDE' CP '+CD*' is false; SY-FDPOS = 5.

'ABCDE' CP 'BD*' is true; SY-FDPOS = 1.

The character '#' has a special meaning. It serves as an escape symbol and indicates that the very next character should be compared "exactly".

This allows you to search for:

- characters in upper or lower case

e.g.: c1 CP '#A#b'

- the wildcard characters '*', '+' themselves

e.g.: c1 CP '#' or c1 CP '#+*'

- the escape symbol itself

e.g.: c1 CP '##'

- blanks at the end of c1

e.g.: c1 CP '*# '

Please reward if useful.

Read only

Former Member
0 Likes
663

Hi ,

The purpose of using CP in ranges to get all records which contain the pattern specified.

Here is a program to illustrate the same

Ranges : r_one for mara-matnr.

Data : wa_ran like line of r_one.

wa_ran-sign = 'I'.
wa_ran-option = 'CP'.
wa_ran-low  = 'C*'.
append wa_ran to r_one.

Data : it_one type table of mara.

select *
into table it_one
from mara
where matnr in r_one.

so what this program does is gets all the material numbers which start with 'C'.

Regards

Arun

  • Assign points if reply is useful

Read only

Former Member
0 Likes
663

HI,

CP is Contain pattren, means, let's say you want to have the range check for all company codes not starting with AB, you will set your code as follow

bukrs-sign = 'E'. "Exclude

bukrs-option = 'CP'. "Pattern

bukrs-low = 'AB*'. "Low Value

bukrs-high = ''. "High Value

Regards

Sudheer