‎2008 May 09 10:43 PM
Hi,
Could any one let me know how to split a table with strucutre and create a new record for each split. structure is as follow:
Filed1
Filed2
Filed3 more than one value seperated wtih commas
I need to split Filed3 values and create a new record for each split. Split is on comma operator.
Thanks
Rajeev.
‎2008 May 10 10:52 AM
Hi Rajeev,
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 ',' INTO: str1 str2 str3,
TABLE itab.
Edited by: jagadeesh tirumalasetti on May 10, 2008 12:09 PM
‎2008 May 09 10:47 PM
Are the new records going to be in the same table? here is an example with a second table.
data: itab2 type table of string,
itabaux like itab2.
loop at itab.
split itab-field3 at ',' into table itabaux.
append lines of itabaux to itab2.
endloop.
itab2 should have all the records
‎2008 May 09 11:14 PM
‎2008 May 10 4:49 AM
‎2008 May 10 8:27 AM
I have the webserice commming in in the following strucutre:
- <COUNTRIES>
<F_COUNTRY_CODE>ABW</F_COUNTRY_CODE>
<F_COUNTRY_NAME>ARUBA</F_COUNTRY_NAME>
- <F_LANGUAGE>
<F_LANGUAGE_CODE>DUT, ENG, FRE, SPA</F_LANGUAGE_CODE>
<F_LANGUAGE_NAME>DUTCH; FLEMISH, ENGLISH, FRENCH, SPANISH; CASTILIAN</F_LANGUAGE_NAME>
</F_LANGUAGE>
- <F_REGION>
<F_REGION_CODE>LA</F_REGION_CODE>
</F_REGION>
</COUNTRIES>
I need to split the data coming in at "," and create new records for each split value (country code+name). Could any one guide me on this.
Thanks
Rajeev
‎2008 May 10 8:47 AM
hi check this..
this can be done through the command split in additon with table
syntax : SPLIT f AT g INTO TABLE itab.
Stores the components of f in the internal table itab . For each part of f , a "special" table line is created.
f is considered without trailing blanks.
Example
DATA: BEGIN OF ITAB OCCURS 10,
WORD(20),
END OF ITAB.
SPLIT 'STOP Two STOP Three STOP ' AT 'STOP' INTO TABLE ITAB.
Now, ITAB has three lines. The first line is blank, the second contains 'Two' and the third contains 'Three' .
regards,
venkat .
‎2008 May 10 10:52 AM
Hi Rajeev,
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 ',' INTO: str1 str2 str3,
TABLE itab.
Edited by: jagadeesh tirumalasetti on May 10, 2008 12:09 PM