Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

charcter warning

Former Member
0 Likes
419

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
397

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

2 REPLIES 2
Read only

Former Member
0 Likes
398

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

Read only

Former Member
0 Likes
397

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.