‎2007 Jul 09 11:15 AM
hi gurus. Can someone tell if there is any FM or anybody nows a way to split a table with 1024 chars in each line into a table with 132 in each line without losing data??
Thk, regards
‎2007 Jul 09 1:08 PM
<b>please see this link for details explaination of splitting the data more that 132 characters into separate line </b> ...
<a href="http://">http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm</a>
reward points if it is usefull ....
Girish
‎2007 Jul 09 11:19 AM
‎2007 Jul 09 11:41 AM
C147_STRING_SPLIT_AT_POSITION
STRING_SPLIT
STRING_SPLIT_AT_POSITION
Check these FM's.
Regards,
Pavan P.
‎2007 Jul 09 11:56 AM
Hi
STRING_CENTER (Obsolete) Centered a string
STRING_CONCATENATE Concatenates (links) two strings without multibyte handling
STRING_LENGTH (Onsolete) Calculate the length of a string
STRING_MOVE_RIGHT (Obsolete) Shift a string to the right
STRING_REVERSE Returns a string in reverse order
STRING_SPLIT (Obsolete) Split a string in accordance with a delimiter.
STRING_SPLIT_AT_POSITION Split a string with a proper position into two parts
check this sample code
DATA: text(10) TYPE c VALUE '0123456789',
text1(6) TYPE c,
text2(6) TYPE c.
PARAMETERS position TYPE i.
CALL FUNCTION 'STRING_SPLIT_AT_POSITION'
EXPORTING
string = text
pos = position
IMPORTING
string1 = text1
string2 = text2
EXCEPTIONS
string1_too_small = 1
string2_too_small = 2
pos_not_valid = 3
OTHERS = 4.
Reward all helpfull answers
Regards
Pavan
‎2007 Jul 09 1:08 PM
<b>please see this link for details explaination of splitting the data more that 132 characters into separate line </b> ...
<a href="http://">http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm</a>
reward points if it is usefull ....
Girish
‎2007 Jul 09 2:26 PM
Thk for the repluys guys..
Girish Kumar Loganathan can you give me agina the url. Its giving me an bad url error
Thk, Regards
‎2007 Jul 09 2:53 PM
hi again. Girish Kumar Loganathan i allready seen the link dont borrow with the url.
Thk for the FM guys but my problem its that i have a table where each line has 1024 chars and i want to split each line of that table into 132 line chars to another table without losing information..
Thk, Regards
‎2007 Jul 09 3:07 PM
hello
begin of ty_tab1
line(1024) type c,
end of ty_tab1
begin of ty_tab2
line1(132) type c,
line2(132)type c,
..
line8(132) type c,
end of ty_tab2.
data: it_tab1 type table of ty_tab1, wa_tab1 type ty_tab1
it_tab2 type table of ty_tab2, wa_tab2 typ ty_tab2.
loop at it_tab1 into wa_tab1.
concatenate wa_tab1(132) into wa_tab2-line1.
concatenate wa_tab1+132(132) into wa_tab2-line2.
concatente wa_tab+264(132) into wa_tab2-line3 .
concatente wa_tab+396(132) into wa_tab2-line4 .
...
..
cancatenate wa_tab1+924(100) into wa_tab2-line8.
append wa_tab2 to it_tab2.
clear: wa_tab2,
wa_tab1.
endloop.
reward points if helpful.
‎2007 Jul 09 3:20 PM
Try FM TEXT_SPLIT.
Put the first record of the 1024 length table into a var.
Split it at 132
CLEAR ZEILE.
CALL FUNCTION 'TEXT_SPLIT'
EXPORTING
LENGTH = 132
TEXT = RESTTEXT
IMPORTING
LINE = ZEILE
REST = RESTTEXT
EXCEPTIONS
OTHERS = 1.append ZEILE to 132 length table
if REST string length is less than 132 and not end of table, append a new record of 1024 to the end
If REST string length is less than 132 and end of table, append REST to 132 length table
loop til no more text and rest is empty.
Regards