To do this we will be using ‘STRING_REVERSE’ function module.
1. Open your ABAP Editor (Se38)
2. Copy this code below.
Parameters: string type c LENGTH 100.
Data: rstring type c LENGTH 100.
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
STRING = string
LANG = 'E'
IMPORTING
RSTRING = rstring
EXCEPTIONS
TOO_SMALL = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Write:/ 'Original String: ', string.
Write:/ 'Reverse String: ', rstring.3. Click F8, input the string you want to reverse and click F8 (Execute)

Post a Comment