‎2007 Nov 13 1:05 PM
I tried to reverse the string using 'string_reverse' fm.But it won't work.Pls give me n eg to use this
‎2007 Nov 13 1:15 PM
data : v_string1(20) type C.
data : v_string2(20) type C.
initialization.
v_string1 = 'RAMA'.
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = v_string1
lang = sy-langu
IMPORTING
rstring = v_string2
EXCEPTIONS
too_small = 1
OTHERS = 2.
write 😕 v_string1,v_string2.
‎2007 Nov 13 1:13 PM
Hi Khanna,
try this
REPORT ychatest2.
DATA : v_str(100) VALUE 'SDN',
v_rev(100).
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = v_str
lang = sy-langu
IMPORTING
rstring = v_rev
EXCEPTIONS
too_small = 1
OTHERS = 2.
WRITE : v_rev.
‎2007 Nov 13 1:15 PM
‎2007 Nov 13 1:34 PM
Hi Khanna,
What does the dump say??
Declare the string of type CHAR, it will work
‎2007 Nov 13 1:14 PM
HI
<b>STRING_REVERSE</b> Returns a string in reverse order
<b>Functionality</b>
The function module returns the character string entered in reverse sequence. Leading blanks are taken into account, trailing blanks are not.
All exceptions are generated with RAISE and must be handled in the calling program.
<b>Examples</b>
' abc ' becomes 'cba ' . (If the actual parameter assigned to the formal parameter RSTRING is longer than 4 characters as shown in this example, the remaining places are padded with blanks.)
Sample call:
DATA: REVERSESTRING(10).
CALL FUNCTION 'STRING_REVERSE'
EXPORTING STRING = ' abcdef '
IMPORTING RSTRING = REVERSESTRING
EXCEPTIONS TOO_SMALL = 1.
IF SY-SUBRC = 0.
The reverse string is in RSTRING
ELSE.
RSTRING zu kurz
ENDIF.
<b>Reward if usefull</b>
‎2007 Nov 13 1:15 PM
hi Khanna,
by import parameter LANG you have to give the language to the system. This should be system wise, so you have to take care about conversions.
ec
‎2007 Nov 13 1:15 PM
data : v_string1(20) type C.
data : v_string2(20) type C.
initialization.
v_string1 = 'RAMA'.
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = v_string1
lang = sy-langu
IMPORTING
rstring = v_string2
EXCEPTIONS
too_small = 1
OTHERS = 2.
write 😕 v_string1,v_string2.