‎2006 Dec 04 7:58 AM
Hallow I declare table itab and wa I wont to doing a split action but I have a warning
That itab must be a charcter type data object
What I doing wrong.
TYPES:BEGIN OF 1_itab,
osek_morsh(15) TYPE n,
company_name(30) TYPE c,
company_code(5) TYPE n,
END OF 1_itab.
thankes for your answer
DATA: itab TYPE TABLE OF 1_itab,
wa_itab LIKE LINE OF itab.
LOOP AT itab INTO wa_itab.
SPLIT itab AT ',' INTO:
wa_itab-osek_morsh
wa_itab-company_name
wa_itab-company_code.
APPEND itab.
ENDLOOP.
‎2006 Dec 04 8:02 AM
hi
Split works for character type this way .. so do this way ..
TYPES:BEGIN OF 1_itab,
osek_morsh(15) TYPE <b>c</b>,
company_name(30) TYPE <b>c</b>,
company_code(5) TYPE <b>c</b>,
END OF 1_itab.SPLIT f AT g INTO TABLE itab.
Extras:
As with variant 1
Effect
Similar to variant 1
The sections of f are placed in the internal table itab. The sytsem creates a table row for each section of f.
Note: If f ends with the separator string g, the system does not create an empty table row at the end. This is in contrast to what happens when g occurs at the beginning of f.
Example
TYPES: BEGIN OF ITAB_TYPE,
WORD(20),
END OF ITAB_TYPE.
DATA: ITAB TYPE STANDARD TABLE OF ITAB_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 5.
SPLIT 'STOP Two STOP Three STOP ' AT 'STOP' INTO TABLE ITAB.
ITAB now has three rows. The first is empty, the second contains ' Two', and the third ' Three'.
Regards,
Santosh
‎2006 Dec 04 8:02 AM
hi
Split works for character type this way .. so do this way ..
TYPES:BEGIN OF 1_itab,
osek_morsh(15) TYPE <b>c</b>,
company_name(30) TYPE <b>c</b>,
company_code(5) TYPE <b>c</b>,
END OF 1_itab.SPLIT f AT g INTO TABLE itab.
Extras:
As with variant 1
Effect
Similar to variant 1
The sections of f are placed in the internal table itab. The sytsem creates a table row for each section of f.
Note: If f ends with the separator string g, the system does not create an empty table row at the end. This is in contrast to what happens when g occurs at the beginning of f.
Example
TYPES: BEGIN OF ITAB_TYPE,
WORD(20),
END OF ITAB_TYPE.
DATA: ITAB TYPE STANDARD TABLE OF ITAB_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 5.
SPLIT 'STOP Two STOP Three STOP ' AT 'STOP' INTO TABLE ITAB.
ITAB now has three rows. The first is empty, the second contains ' Two', and the third ' Three'.
Regards,
Santosh
‎2006 Dec 04 8:05 AM
there is no need of split, you can directly access the field of wa_itab.
LOOP AT itab INTO wa_itab.
SPLIT itab AT ',' INTO:-- not required
a = wa_itab-osek_morsh
b = wa_itab-company_name
c = wa_itab-company_code.
APPEND itab.
ENDLOOP.