2008 Mar 19 1:28 PM
hi
This is ravinder
kindly help me with solution for the following
■ Design selection-screen that accepts a number and default to 5
■ Write a program to write your name in reverse order
■ The writing should be restricted to only those many characters as number given in the selection screen
For example assume the user gives 5 in the selection screen. Then the output should be-
R
E
D
N
I
2008 Mar 19 1:35 PM
Hi
PARAMETERS: P_NUM TYPE I DEFAULT 5,
P_NAME(30) TYPE C.
DATA: V_LEN TYPE I,
V_TIMES TYPE I,
V_POS TYPE I.
START-OF-SELECTION.
V_LEN = STRLEN( P_NAME ).
IF V_LEN <= P_NUM.
V_TIMES = V_LEN.
ELSE.
V_TIMES = P_NUM.
ENDIF.
V_POS = V_LEN - 1.
DO V_TIMES TIMES.
WRITE: / P_NAME+V_POS(1).
V_POS = V_POS - 1.
ENDDO.Max
Edited by: max bianchi on Mar 19, 2008 2:39 PM
2008 Mar 19 1:34 PM
2008 Mar 19 1:35 PM
Hi
PARAMETERS: P_NUM TYPE I DEFAULT 5,
P_NAME(30) TYPE C.
DATA: V_LEN TYPE I,
V_TIMES TYPE I,
V_POS TYPE I.
START-OF-SELECTION.
V_LEN = STRLEN( P_NAME ).
IF V_LEN <= P_NUM.
V_TIMES = V_LEN.
ELSE.
V_TIMES = P_NUM.
ENDIF.
V_POS = V_LEN - 1.
DO V_TIMES TIMES.
WRITE: / P_NAME+V_POS(1).
V_POS = V_POS - 1.
ENDDO.Max
Edited by: max bianchi on Mar 19, 2008 2:39 PM
2008 Mar 19 1:38 PM
Hi,
You can make use of FM STRING_REVERSE.
Thanks,
Sriram Ponna.
2008 Mar 19 1:39 PM
hi use this,
data: test type string,
strlen type i,
i type i.
data: name(10) value 'reverse'.
i = strlen( name ).
do i times.
i = i - 1.
write:/ name+i(1).
if i le 6.
else.
exit.
endif.
enddo.
regards,
venkat.
2008 Mar 19 1:41 PM
use ... STRING_REVERSE fm to achieve that ...
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string = descr
lang = 'E'
IMPORTING
rstring = descr.