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

regarding Varying statement

Former Member
0 Likes
281

HI experts,

i am trying to execute a simple program using varying statement....but it is showing an error 'RAHUL AND ITAB-Z ARE TYPE-INCOMPATIBLE'.....why it is so...plz solve this problem..i am sending you the code..

DATA: BEGIN OF ITAB1 OCCURS 10 ,

Z ,

END OF ITAB1,

RAHUL(10) VALUE 'MANAGEMENT'.

DATA : ITAB2 LIKE ITAB1 OCCURS 10 WITH HEADER LINE.

DO 10 TIMES VARYING ITAB1-Z FROM RAHUL0 NEXT RAHUL1 .

APPEND ITAB1.

ENNDO.

INSERT LINES OF ITAB1 FROM 2 TO 6 INTO ITAB2 INDEX 1.

LOOP AT ITAB2.

WRITE 😕 ITAB2-Z.

ENDLOOP

1 REPLY 1
Read only

Former Member
0 Likes
254

Hi Prakash,

It might be the case that the "Rahul+0" uption is not supported in the varying clause.

One possible alternative to this would be.

DATA: BEGIN OF itab1 OCCURS 10 ,

z ,

END OF itab1,

rahul(10) VALUE 'MANAGEMENT'.

DATA : BEGIN OF word,

one VALUE 'M',

two VALUE 'A',

three VALUE 'N',

four VALUE 'A',

five VALUE 'G',

six VALUE 'E',

seven VALUE 'M',

eight VALUE 'E',

nine VALUE 'N',

ten VALUE 'T',

END OF word.

DATA : itab2 LIKE itab1 OCCURS 10 WITH HEADER LINE.

DO 10 TIMES VARYING itab1-z FROM word-one NEXT word-two .

APPEND itab1.

ENDDO.

INSERT LINES OF itab1 FROM 2 TO 6 INTO itab2 INDEX 1.

LOOP AT itab2.

WRITE 😕 itab2-z.

ENDLOOP.

Hope this helps.

Regards,

Devendra