We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE: RE:[sap-abap] ABAP Code to Highlight Differences Between Two Words

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from horacio zapettini on Aug 24 at 9:09 AM
Bernard,

IMO, you're wasting a lot of time waiting for help. Write that piece of code and share it with us if you want.

If you need to compare two strings, a single loop with string slicing and an internal table with two or three fields should help.

Pseudocode: Given string1 and string2 get a list of differences

Get the shorter string length (the other one has differences from the maxlength till the end of the string).

Maxlength = strlen(string1)
If maxlength > strlen(string2)
Maxlength = strlen(string2)
Endif
Currpos = 0
While currpos <= maxlength
Add 1 to currpos.
If string1+currpos(1) = string2+currpos(1) // String slicing
" you have a match? nothing to do.
Else.
"you have a difference at position currpos ->
Wa_Itab-currpos = currpos
Wa_Itab-instring1 = string1+currpos(1)
Wa_Itab-instring2 = string2+currpos(1)
Append wa_itab into itab.
Endif.
Endwhile
With a similar analysis you can get rid of different string lengths.

That's an idea? Once you're done, looping at itab should give you an idea of the differences and the position. Play a bit more an you'll get the idea for that FM.

HTH
Horacio.
BTW,

---------------Original Message---------------
From: Bernard_Garnier
Sent: Monday, August 22, 2016 2:54 AM
Subject: ABAP Code to Highlight Differences Between Two Words

Thank you Soeren,

But this function module does a basic comparison of two strings, and returns only FALSE or TRUE.

I need a much more sophisticated comparison for 2 words, like this one:
http://www.raymondhill.net/finediff/viewdiff-ex.php

Or like this one: http://myerslab.mpi-cbg.de/wp-content/uploads/2014/06/np_diff.pdf .

These two examples are far too complex for me to be translated in ABAP!

So, if someone has such a comparison of two words in ABAP, thank you to share!

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
© 2016 Ziff Davis, LLC. and message author.
Ziff Davis, LLC. 28 E 28th Street New York, NY 10016
horacio zapettini  

15 achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Have a technical question? Need to find IT solutions? Ask your peers in the Toolbox for IT community.

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language