‎2008 Jul 07 5:42 PM
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.
‎2008 Jul 07 5:53 PM
hi
try to use FIND with addition "IGNORING CASE" to find every match "RESPECTING CASE" addition to find match with case sensitive.
bi
.
‎2008 Jul 07 5:55 PM
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.
‎2008 Jul 07 5:57 PM
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.
‎2008 Jul 07 6:04 PM
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.
‎2008 Jul 07 6:05 PM
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.
‎2008 Jul 07 6:07 PM
‎2008 Jul 07 6:13 PM
‎2008 Jul 07 6:13 PM
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.
‎2008 Jul 07 6:19 PM
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.
‎2008 Jul 07 6:22 PM
‎2008 Jul 07 6:24 PM
Its giving error as "statement "FIND" is not defined,please check ur spelling".
‎2008 Jul 07 6:28 PM
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
‎2008 Jul 07 6:28 PM
did you do f1 on FIND and check what exactly its showing?
find should be there in 4.6 as well.
‎2008 Jul 07 6:31 PM
No documentation is avaliable in 4.6 version, I checked with f1 option also.
‎2008 Jul 07 6:31 PM
Hi,
As addition, the 'FIND' statement was introduced in release 6.10!
Regards,
Daniel
‎2008 Jul 07 7:31 PM
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.
‎2008 Jul 07 8:16 PM
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