Skip to Content
0
Former Member
May 06, 2005 at 06:11 AM

Appending Blanks to the right of a string.

18 Views

Dear Friends

I want to append blanks to the right of a character string. However, I am not able to achieve it.

Are there any readymade Function modules provided by SAP to do the same or can you provide me some sample code to achieve the same.

I have written a dummy code to test it. But it does not work. Can I get some help on this ?

DATA: len TYPE i,

shift_len TYPE i,

new_len TYPE i,

test_str(10) type c value 'SUNDAR'.

START-OF-SELECTION.

len = strlen( test_str ).

IF len < 10.

shift_len = 10 - len.

SHIFT test_str BY shift_len places RIGHT.

SHIFT test_str by shift_len places CIRCULAR.

ENDIF.

new_len = strlen( test_str ).

WRITE: len,' ',new_len.

Wondering why the above program does not work.

Thanks in advance for your inputs.

Regards

Sundara