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

read statement

Former Member
0 Likes
4,916

hiii

with read statement, can you read with a key where the value contain wildcards.

such as

read table i_tab with key field1 = v_field

the v_field will may contain "BU*"

that is the will read the value in itab where the field1 will contina BU01 or BU02

can anyone please confirm. since with read we cannot use CS

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,056

yes you can use CS, CP, ...

16 REPLIES 16
Read only

Former Member
0 Likes
3,056

hi,

I appologize that this statement doesn't work .... I remember using it but probably i am wrong ...as Eric said loop with cp only works ...

Regards,

Santosh

Edited by: Santosh Kumar Patha on Jul 23, 2008 5:35 PM

Read only

Former Member
0 Likes
3,056

Hi,,

with read statement, you can read with a key where the value contain wildcards.

such as

read table i_tab with key field1 like v_field

the v_field will may contain "BU*"

that is the it will read the value in itab where the field1 will contina BU01 or BU02.

Regards,

Sunil Kumar Mutyala.

Read only

Former Member
0 Likes
3,056

Try CP (Covers pattern)

Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1. You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.

Read only

Former Member
0 Likes
3,057

yes you can use CS, CP, ...

Read only

0 Likes
3,056

Florian Kemmer,

however answer is simply no as said by others.

but i would like to intimate to Florian for avoinding mis leads on SDN.

Amit.

Read only

0 Likes
3,056

Amit: you are a bit unfair, it is not just Florian, but everyone else, except Vijay... biggest fault has Santosh Kumar Patha with nearly 10K points...

(I wonder if moderators can remove the wrong ansers in this case - if they don't do it on their own)

Read only

0 Likes
3,056

I am aware that CS and CP don't work

but Sunil Kumar Mu.. says that

read table i_itab where field1 = "BU*"

I cahnged the value in debut but it won't work is there a possibility of doing that without passing through the loop since my key conditio contain 8 condition.

Read only

0 Likes
3,056

Eric,

yes i do agree with you.biggest mistake made by Santosh really surprising who is on wave in term of points.

here is another example of misleads both are made today only.even i saw often such kind of unwanted replied moderator should omit their replies so that SDN can remain stand as heaven for needed person like us forever:

cheers

Read only

0 Likes
3,056

>

> I am aware that CS and CP don't work

>

> but Sunil Kumar Mu.. says that

>

> read table i_itab where field1 = "BU*"

>

> I cahnged the value in debut but it won't work is there a possibility of doing that without passing through the loop since my key conditio contain 8 condition.

I think Sunil gave you wrong information this time...

There is only the LOOP, no other way...

Read only

0 Likes
3,056

newbie82 c

I cahnged the value in debut but it won't work is there a possibility of doing that without passing through the loop since my key conditio contain 8 condition

.

i think than you need to use if endif with wildcard charecter but howevenr loop there also needed only thing you can bypass is condition with loop.

anyways earth is round.

Amit.

Read only

Former Member
0 Likes
3,056

since with read we cannot use CS

loop at i_tab where field1 cs v_field.
<---- do waht ever you want here.....
exit.
endloop.

Read only

JozsefSzikszai
Active Contributor
0 Likes
3,056

hi,

it does not matter how many people says it works, there is no way, you can 't do that with READ TABLE, only = is allowed.

however as alternative, you can use LOOP AT ... INTO ... WHERE field CP 'BU*'.

hope this helps

ec

Read only

Former Member
0 Likes
3,056

This message was moderated.

Read only

0 Likes
3,056

according to your long piece of code do you mean do a select statement

coz i am a bit confuse with this logn code

Read only

0 Likes
3,056

>

> according to your long piece of code do you mean do a select statement

>

> coz i am a bit confuse with this logn code

that source code is completely irrelevant to your problem. Don't even bother with that!

Read only

Former Member
0 Likes
3,056

Hi,

READ statement is used to a single record not multiple records.

So we cant use the Wild card characters (_,%) with READ.

Thanks & Regards,

Chandralekha.