cancel
Showing results for 
Search instead for 
Did you mean: 

change line(string) order function

Former Member
0 Kudos

Hi all!!

Iam looking for SAP STANDARD Function that gets a string and changes its words order.

thanks!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Yulia,

Try the function module STRING_REVERSE,

Description

Returns a string in reverse order

Functionality

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.

Examples

' 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.

Parameters

RSTRING

at the end, however, are not taken into account.

STRING

LANG

Exceptions

TOO_SMALL

the calling program.

Former Member
0 Kudos

Could you elaborate the requirement with an example.

Regards

Vinayak