‎2007 Jul 30 8:50 AM
dear guys,
i just want to know how to use split command for value in field.
actually i have one field name zevent which is have 100 char.
i want to divide the text to two part since i want to display it at my form.
which is my form has a limited space to display the long text.
thanks..
‎2007 Jul 30 8:52 AM
Hi,
Suppose you want to split that into two 50 chars.
its as follows.
DATA: char(100) type c,
char1(50) type c,
char2(50) type c.
char1 = char+0(50).
char2 = char+51(50).
else assuming you have a delimiter as ':'
SPLIT char AT ':' INTO char1 char2.
Regards
Sesh
‎2007 Jul 30 8:52 AM
Hi,
Suppose you want to split that into two 50 chars.
its as follows.
DATA: char(100) type c,
char1(50) type c,
char2(50) type c.
char1 = char+0(50).
char2 = char+51(50).
else assuming you have a delimiter as ':'
SPLIT char AT ':' INTO char1 char2.
Regards
Sesh
‎2007 Jul 30 8:53 AM
DATA: str1 TYPE string,
str2 TYPE string,
str3 TYPE string,
itab TYPE TABLE OF string,
text TYPE string.
text = `What a drag it is getting old`.
SPLIT text AT space INTO: str1 str2 str3,
TABLE itab.
‎2007 Jul 30 8:59 AM
Hi Nadya,
The syntax for SPLIT is the following :
SPLIT field1 AT separator INTO field2 field3 field4 ...
The SPLIT command searches field 1 for separator and put the result into the different output fields (field2 field3 field4 ...).
In your case I don't think you nedd to use this command. Just use WRITE with length and offset as below :
Write input_field(100) to output_field1.
Write input_field+100 to output_field2.
Reward if this helps.
Regards,
Nicolas.
‎2007 Jul 30 9:05 AM
thanks for the answer
but i have to loop at internal table first for that field
how to use the syntax in the loop?
‎2007 Jul 30 9:09 AM
loop at itab.
write 😕 itab-field(n).
write 😕 itab-field+n.
endloop.
"/" will create a new line for writing on your report.
N is the max length you want to write from itab-field.
Regards,
Nicoals.
‎2007 Jul 30 9:12 AM
See the below code to use a split with in a loop
types : begin of TY_UPLOADF,
STRING type STRING,
end of TY_UPLOADF.
types : begin of TY_UPLOAD,
I_FIELD1 type CHAR23,
I_FIELD2 type CHAR8,
I_FIELD3 type CHAR8,
I_FIELD4 type CHAR8,
I_FIELD5 type CHAR8,
I_FIELD6 type CHAR8,
I_FIELD7 type CHAR8,
end of TY_UPLOAD.
data : IT_UPLOADF type table of TY_UPLOADF,
IS_UPLOADF type TY_UPLOADF.
data : IT_UPLOAD type table of TY_UPLOAD,
IS_UPLOAD type TY_UPLOAD.
loop at IT_UPLOADF into IS_UPLOADF.
split IS_UPLOADF-STRING at '+' into IS_UPLOAD-I_FIELD1
IS_UPLOAD-I_FIELD2
IS_UPLOAD-I_FIELD3
IS_UPLOAD-I_FIELD4
IS_UPLOAD-I_FIELD5
IS_UPLOAD-I_FIELD6
IS_UPLOAD-I_FIELD7.
append IS_UPLOAD to IT_UPLOAD.
clear : IS_UPLOADF, IS_UPLOAD.
endloop.
Regards
Gopi
‎2007 Jul 30 9:24 AM
TYPES:
BEGIN OF t_itab_split ,
value(255) ,
END OF t_itab_split .
DATA:
itab_split TYPE STANDARD TABLE OF t_itab_split .
...
...
SPLIT str AT ';' INTO TABLE itab_split .
In the rows of the table contain splitted data, in the field 'value'.