Application Development 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: 

Comparing strings

Former Member
0 Kudos
100

Hi Gurus,

Please solve this problem.

Hi One internal table with field message,This table having 20 or 30 lines of text.

I have to compare this text with one data base table having field message having text.

if the text that is matches first, i want to display that in output.

how i comepare these texts.

THanks/radha.

1 ACCEPTED SOLUTION

former_member598013
Active Contributor
0 Kudos
78

Hi Radha,

For this type of scenario lets say suppose we have populated two internal table

itab1 ---> messages contains 20 to 30 lines.

Itab2 -


> fetch from the database.

Now what you have to do is


Loop at itab2.
 Read table itab1 with key message = < message>
 If sy-subrc = 0.
  write:/ itab2-message.
 endif.
Endloop.

9 REPLIES 9

Former Member
0 Kudos
78

Hi,

loop at itab1 into wa.

read table db_table with key text = wa-msg.

if sy-subrc = 0.

write: wa-msg.

endif.

endloop.

Regards,

Subramanian

former_member598013
Active Contributor
0 Kudos
78

Hi Radha,

For this type of scenario lets say suppose we have populated two internal table

itab1 ---> messages contains 20 to 30 lines.

Itab2 -


> fetch from the database.

Now what you have to do is


Loop at itab2.
 Read table itab1 with key message = < message>
 If sy-subrc = 0.
  write:/ itab2-message.
 endif.
Endloop.

former_member598013
Active Contributor
0 Kudos
79

Hi Radha,

For this type of scenario lets say suppose we have populated two internal table

itab1 ---> messages contains 20 to 30 lines.

Itab2 -


> fetch from the database.

Now what you have to do is


Loop at itab2.
 Read table itab1 with key message = < message>
 If sy-subrc = 0.
  write:/ itab2-message.
 endif.
Endloop.

0 Kudos
78

Hi Chidanad,

My problem is the text in internal table having 255 characters like that.

but the text in database table having part of internal table text may be 120 characters.

and the text in data base table is started in internal table in middile.

please give me solution urgently.

Thanks/Radha.

0 Kudos
78

Hi,

Then try comparing like this:

IF int_table_str CS db_table_str.

write:.....

endif.

Regards,

Subramanian

0 Kudos
78

hi,

use the string comparing function 'CS'

if itab-field CS dbtab-field.

write itab-field.

endif.

regards

prasanth

0 Kudos
78

Hi Subramaninan,

with write statement we are writing text to list but it is having space infront of the text,

How we delete the space infront of text before write statement.

eg: -


rama.

here assume '----


' this is pace.

0 Kudos
78

hi,

try the statemnt CONDENSE text [NO-GAPS].

or

write addition left-justified

regards

0 Kudos
78

hi,

Use CONDENSE fld1 no-gaps.

Regards,

Subramanian