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

Using search option for case sensitive fields

Former Member
0 Likes
1,622

Hi Guys,

I am having one situation where i have to pick all the line items which are containing "Equity" text. And I am giving this "Equity" text in one of the selection-screen of Bseg-sgtxt field. I am including this text filed as Equity in that selection-screen filed. So it has to pick all the line items from Bseg table which contains this "Equity" text.

Bseg is a cluster table , so i am not using this selecion in where condition of that select query except key fields.

After select query on Bseg, i am looping that Bseg internal table and reading selection table of s_sgtxt and using SEARCH option of that "Equity" text , if entered text in selection field contains Equity then it comes out of the loop otherwise if entered text is not contains Equity text then it will delete that row from Bseg internal table. So at last we are getting only those data which contains "Equity" text.

But whats the problem am gettig is its picking all the line items which are containing this Equity text irrespective of caps or small letters, its pulling equity, EQUITY etc...text line items. I want only those Line items which is exactly having "Equity" text. So how can I use this one in SEARCH option or any bosy plz help me in this.

Will get reward points for gud answer....:)

BALU.

17 REPLIES 17
Read only

Former Member
0 Likes
1,574

hi

try to use FIND with addition "IGNORING CASE" to find every match "RESPECTING CASE" addition to find match with case sensitive.

bi

.

Read only

Former Member
0 Likes
1,574

U can see my code also....

select bukrs

belnr

gjahr

shkzg

sgtxt

vbund

kostl

hkont

dmbtr

menge

abper into table g_t_bseg

from bseg

for all entries in g_t_bkpf

where belnr = g_t_bkpf-belnr

and bukrs = g_t_bkpf-bukrs

and gjahr = g_t_bkpf-gjahr.

here l_v2 is having "Equity" Text and s_text is selection-screen field for Bseg-sgtxt Text.

loop at g_t_bseg.

if not s_text is initial.

search g_t_bseg-sgtxt for l_v2.

if sy-subrc ne 0.

delete g_t_bseg.

continue.

endif.

endif.

So plz how can I write the code to select only line items which contains exactly "Equity" text.

Read only

0 Likes
1,574

select bukrs

belnr

gjahr

shkzg

sgtxt

vbund

kostl

hkont

dmbtr

menge

abper into table g_t_bseg

from bseg

for all entries in g_t_bkpf

where belnr = g_t_bkpf-belnr

and bukrs = g_t_bkpf-bukrs

and gjahr = g_t_bkpf-gjahr.

here l_v2 is having "Equity" Text and s_text is selection-screen field for Bseg-sgtxt Text.

loop at g_t_bseg.

if not s_text is initial.

*search g_t_bseg-sgtxt for l_v2.

find g_t_bseg-sgtxt for lv_v2 respecting case. " new statement instead of search

if sy-subrc ne 0.

delete g_t_bseg.

continue.

endif.

endif.

Read only

0 Likes
1,574

Hi 1st of all thnx for ur reply.

I tried ur code also, but its giving error as statement "FIND" is not defined,please check ur spelling.

So shalli have 2 define it or plz give me any suggestion.

Balu.

Read only

0 Likes
1,574

hope this will work.................

loop at g_t_bseg.

if not s_text is initial.

*search g_t_bseg-sgtxt for l_v2.

find lv_v2 in g_t_bseg-sgtxt respecting case. " new statement instead of search

if sy-subrc ne 0.

delete g_t_bseg.

continue.

endif.

endif.

Read only

0 Likes
1,574

No its still giving same error.... Plz help me

Read only

0 Likes
1,574

Plz Help

Read only

0 Likes
1,574

select bukrs

belnr

gjahr

shkzg

sgtxt

vbund

kostl

hkont

dmbtr

menge

abper into table g_t_bseg

from bseg

for all entries in g_t_bkpf

where belnr = g_t_bkpf-belnr

and bukrs = g_t_bkpf-bukrs

and gjahr = g_t_bkpf-gjahr.

data : lv_v2(6) type c value 'Equity'.

loop at g_t_bseg .

if not s_text is initial.

*search g_t_bseg-sgtxt for l_v2.

find lv_v2 in g_t_bseg-sgtxt respecting case. " new statement instead of search

if sy-subrc ne 0.

delete g_t_bseg.

continue.

endif.

endif.

endloop.

for me the program is syntactically correct.

Read only

0 Likes
1,574

Its giving same error, i m using 4.6 version , is thr any version problem. and also is thr any other way 2 write the code.

Read only

0 Likes
1,574

wht is the error u are exactly facing?

let me know.

bi

Read only

0 Likes
1,574

Its giving error as "statement "FIND" is not defined,please check ur spelling".

Read only

0 Likes
1,574

Hi,

in your loop use IF-statement with 'CP' option. to compare case sensitive you've had to add "#" in front of every character of the sequence to compare.

e.g.

lv_one = 'Hello, World'
lv_two = '#H#e#l#l#o'.

if lv_one cp lv_two.
"do whatevet you like
endif.

Should work with all releases.

Regards,

Daniel

Read only

0 Likes
1,574

did you do f1 on FIND and check what exactly its showing?

find should be there in 4.6 as well.

Read only

0 Likes
1,574

No documentation is avaliable in 4.6 version, I checked with f1 option also.

Read only

0 Likes
1,574

Hi,

As addition, the 'FIND' statement was introduced in release 6.10!

Regards,

Daniel

Read only

0 Likes
1,574

after the select from BSEG juss say

delete tb_bseg where sgxtxt ne 'Equity'.

all the records which dont match the exact string 'Equity' will be deleted.

Read only

Former Member
0 Likes
1,574

Simply do it all at once:

SELECT bukrs
belnr
gjahr
shkzg
sgtxt
vbund
kostl
hkont
dmbtr
menge
abper INTO TABLE g_t_bseg
FROM bseg
FOR ALL ENTRIES IN g_t_bkpf
WHERE belnr = g_t_bkpf-belnr
AND bukrs = g_t_bkpf-bukrs
AND gjahr = g_t_bkpf-gjahr
AND ( sgtxt LIKE '%Equity%'
 OR   sgtxt LIKE '%equity%'
 OR   sgtxt LIKE '%EQUITY%' ).

I have made it not case sensitive, but you can leave it the way it was.

Rob