‎2009 May 10 12:31 PM
Hello Experts,
how can I make string comparison very easily e.f. if there is a char40 field .
Thx in advance
ertas
‎2009 May 10 1:03 PM
Hi
You can us something like:
DATA: f1(25) TYPE c VALUE 'shital ABAP',
f2(25) TYPE c VALUE 'shital ABAP'.
IF f1 EQ f2.
WRITE: / 'True'.
ELSE.
WRITE: / 'False'.
ENDIF.
.Refer [this|http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3516358411d1829f0000e829fbfe/content.htm] for understand how comparisons happen.
Also note that comparisons are case sensitive.
Regards
Shital
Edited by: shital phadake on May 10, 2009 5:36 PM
‎2009 May 10 12:44 PM
Hi, Ertas
Can you Please Explain your Requirement with Example so that we will be able to help accordingly. I think Requirements are not clear.
Regards,
Faisal
‎2009 May 10 12:55 PM
just comparing 2 decription fields.
field1-description = 'the live is great'
field2-description = ''the live is boring.
How can you compare both string very reliable
‎2009 May 10 1:03 PM
Hi, Ertas
You Need following? sorry still not very clear
DATA: str1(40) VALUE 'SDN',
str2(40) VALUE 'SDn'.
IF str1 = str2.
WRITE: 'Strings are Equal'.
ELSE.
WRITE: 'Strings are not Equal'.
ENDIF.Regards,
Faisal
‎2009 May 10 1:03 PM
Hi
You can us something like:
DATA: f1(25) TYPE c VALUE 'shital ABAP',
f2(25) TYPE c VALUE 'shital ABAP'.
IF f1 EQ f2.
WRITE: / 'True'.
ELSE.
WRITE: / 'False'.
ENDIF.
.Refer [this|http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3516358411d1829f0000e829fbfe/content.htm] for understand how comparisons happen.
Also note that comparisons are case sensitive.
Regards
Shital
Edited by: shital phadake on May 10, 2009 5:36 PM