‎2008 Oct 07 11:59 AM
I have a string of length 6000 as an input. I need to divide the string into multiples of 72 and create a internal table. Is anybody could give some idea how to do it.
‎2008 Oct 07 12:00 PM
‎2008 Oct 07 12:04 PM
A possible solution and one you could have figured out yourself:
g_divided = 6000 div 72. "or is it MOD? I always mix DIV and MOD....
do g_divided times.
wa_string_72 = g_string_6000(72).
append wa_string_72 to it_string_72.
shift g_string_6000 left 72 places.
enddo.edit:
Ha! was too late, but that function will do the trick as well!
Edited by: Maen Anachronos on Oct 7, 2008 1:11 PM
‎2008 Oct 07 12:05 PM
Hi,
Try this method..
DATA: BEGIN OF T_TEMP OCCURS 16,
TEXT(3000),
END OF T_TEMP.
first read string into temp table
DO 25 TIMES.
READ TABLE T_TEMP INDEX SY-INDEX.
CASE SY-INDEX.
WHEN 1.
MOVE T_TEMP+0(72) TO GT_UNIX-test1.
WHEN 2.
MOVE T_TEMP+72(144) TO GT_UNIX-test2.
...............
..............
................
.................
endcase.
enddo.
Regds,
Paras
‎2008 Oct 07 12:24 PM
Use FM 'IQAPI_WORD_WRAP'.
CALL FUNCTION 'IQAPI_WORD_WRAP'
EXPORTING
textline = w_string
outputlen = 72
TABLES
out_lines = outtab
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
Regards,
Aparna