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

'type-incompatible' error message

Former Member
0 Likes
731

Please have a look at the code below.

DATA: BEGIN OF itab OCCURS 5,

i LIKE sy-index,

t,

END OF itab,

text(5) VALUE 'ABCDE'.

DO 5 TIMES VARYING itab-t FROM text0 NEXT text1.

itab-i = sy-index.

APPEND itab.

ENDDO.

LOOP AT itab.

WRITE: / itab-i, itab-t.

ENDLOOP.

When i execute the above code, i get a message "text and itab-t are type-incompatible".

Can anybody explain the reason for the same.

What change in the code is required to get an output shown below?

1 A

2 B

3 C

4 D

5 E

Please help!!

Regards,

VK

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
610
chk this

REPORT ychatest.

DATA: BEGIN OF itab OCCURS 5,
i LIKE sy-index,
t,
END OF itab,
text(5) VALUE 'ABCDE'.


DO 5 TIMES VARYING itab-t FROM text+0(1) NEXT text+1(1) range text.
  itab-i = sy-index.
  APPEND itab.
ENDDO.

LOOP AT itab.
  WRITE: / itab-i, itab-t.
ENDLOOP.
3 REPLIES 3
Read only

Former Member
0 Likes
610

HI,

DATA: BEGIN OF itab OCCURS 5,

i LIKE sy-index,

t,

END OF itab,

text(5) VALUE 'ABCDE'.

DO 5 TIMES VARYING itab-t FROM text0(1) NEXT text1(1).

itab-i = sy-index.

APPEND itab.

ENDDO.

LOOP AT itab.

WRITE: / itab-i, itab-t.

ENDLOOP.

Regards

Sudheer

Read only

Former Member
0 Likes
611
chk this

REPORT ychatest.

DATA: BEGIN OF itab OCCURS 5,
i LIKE sy-index,
t,
END OF itab,
text(5) VALUE 'ABCDE'.


DO 5 TIMES VARYING itab-t FROM text+0(1) NEXT text+1(1) range text.
  itab-i = sy-index.
  APPEND itab.
ENDDO.

LOOP AT itab.
  WRITE: / itab-i, itab-t.
ENDLOOP.
Read only

Former Member
0 Likes
610

Hi Vijay,

welcome to SDN!!!!!

Please reward points by clicking on left stars and close thread if problem solved