Application Development 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: 

Unicode - Valid area exceeded while executing DO...VARYING or WHILE...VARY.

Former Member
0 Kudos

Hello experts,

While making one of my reports unicode compatible, i was asked to include range in addition to while or do stmts if it uses vary. But if i define like that, it leads to a run-time error DO_WHILE_VARY_NOT_IN_RANGE.

I tried with the below code.

DATA: BEGIN OF WORD,

ONE VALUE 'E',

TWO VALUE 'x',

THREE VALUE 'a',

FOUR VALUE 'm',

FIVE VALUE 'p',

SIX VALUE 'l',

SEVEN VALUE 'e',

EIGHT VALUE '!',

END OF WORD,

LETTER1, LETTER2.

DO VARYING LETTER1 FROM WORD-ONE NEXT WORD-THREE range word.

WRITE: LETTER1.

ENDDO.

Regards,

Vijayalakshmi

1 REPLY 1

Former Member
0 Kudos

Try as below:


DATA: BEGIN OF word,
        one VALUE 'E',
        two VALUE 'x',
        three VALUE 'a',
        four VALUE 'm',
        five VALUE 'p',
        six VALUE 'l',
        seven VALUE 'e',
        eight VALUE '!',
      END OF word,
     letter1, letter2.

DO VARYING letter1 FROM word-one NEXT word-three RANGE word.
  WRITE: letter1.
  IF letter1 = 'e'.
    EXIT.
  ENDIF.
ENDDO.