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: 

Reg : DO..END DO in ECC 6.0

mallikarjun_vaja
Participant
0 Kudos

hi,

Iam getting syntax error for this statement

(DO MAX_VAL TIMES VARYING CHAR FROM WS-01 NEXT WS-02) in ECC 6.0.

The error is : ADDITION RANGE is missing.I dont know how to use the statement with ADDITION RANGE.

Can anyone look at this and rectify it.plz copy the below code and paste in ECC 6.0 and solve this error.

DATA : MAX_VAL(2) TYPE N VALUE '31'.

DATA: WS-01(1) TYPE C VALUE '1',

WS-02(1) TYPE C VALUE '2',

CHAR LIKE WS-01.

DATA: BEGIN OF NUM_TAB OCCURS 35,

CHAR(1) TYPE C,

VAL LIKE SY-INDEX,

END OF NUM_TAB.

  • initializes internal table with character values from data

DO MAX_VAL TIMES VARYING CHAR FROM WS-01 NEXT WS-02.

MOVE: CHAR TO NUM_TAB-CHAR,

SY-INDEX TO NUM_TAB-VAL.

APPEND NUM_TAB.

ENDDO.

regards

VAJA.

6 REPLIES 6

former_member181962
Active Contributor
0 Kudos

It is not ADDITION RANGE.

just add RANGE

See this as an example:

DATA: BEGIN OF text,

word1(4) TYPE c VALUE 'AAAA',

word2(4) TYPE c VALUE 'BBBB',

word3(4) TYPE c VALUE 'CCCC',

word4(4) TYPE c VALUE 'DDDD',

END OF text.

DATA: word(4)  TYPE c,

char1(1) TYPE c,

char2(1) TYPE c,

leng TYPE i.

DESCRIBE FIELD text LENGTH leng IN CHARACTER MODE.

leng = leng / 2.

DO leng TIMES VARYING char1 FROM text(1)

NEXT text+2(1) RANGE text

VARYING char2 FROM text+1(1)

NEXT text+3(1) RANGE text.

WRITE: char1, char2.

char1 = 'x'.

char2 = 'y'.

ENDDO.

DO 4 TIMES VARYING word FROM text-word1 NEXT text-word2.

WRITE / word.

ENDDO.

Regards,

Ravi Kanth

0 Kudos

thanks ravi.

yes I checked this.

but my question is after RANGE what should we put.

In the example you given its like this

DO leng TIMES VARYING char1 FROM text(1)

NEXT text+2(1) RANGE text

VARYING char2 FROM text+1(1)

NEXT text+3(1) RANGE text.

but in my casewhat should i keep after range

DO MAX_VAL TIMES VARYING CHAR FROM WS-01 NEXT WS-02 RANGE.........-->>HERE after RANGE what I should KEEP?

plz answer this..better try once in ECC 6.0 my code.

regards

VAJA

Edited by: Mallikarjun vaja on Jan 28, 2008 12:15 PM

Former Member
0 Kudos

hi,

try DO MAX_VAL TIMES VARYING CHAR FROM WS-01 NEXT WS-02 range WS-02.

0 Kudos

thanks rikita.

I tried your answer.

but still there is error.

plz copy and paste my code in ECC 6.0 SO THAT you can help me clearly.

regards

vaja

JozsefSzikszai
Active Contributor
0 Kudos

hi Vaja,

First problem is here that the DO would have value WS-03 in the third round, but it is not defined in your program. Than it would be WS-04, which is also not defined, etc.

Could you please let me know, what do you want to achieve with this small piece of code?

thanks

ec

0 Kudos

thanks ERIC fro your answer.

here is the full code.

DATA: WS-01(1) TYPE C VALUE '1',

WS-02(1) TYPE C VALUE '2',

WS-03(1) TYPE C VALUE '3',

WS-04(1) TYPE C VALUE '4',

WS-05(1) TYPE C VALUE '5',

WS-06(1) TYPE C VALUE '6',

WS-07(1) TYPE C VALUE '7',

WS-08(1) TYPE C VALUE '8',

WS-09(1) TYPE C VALUE '9',

  • WS-10(1) TYPE C VALUE 'A', "Omit letter 'A'

WS-10(1) TYPE C VALUE 'B',

WS-11(1) TYPE C VALUE 'C',

WS-12(1) TYPE C VALUE 'D',

  • WS-14(1) TYPE C VALUE 'E', "Omit letter 'E'

WS-13(1) TYPE C VALUE 'F',

WS-14(1) TYPE C VALUE 'G',

WS-15(1) TYPE C VALUE 'H',

  • WS-18(1) TYPE C VALUE 'I', "Omit letter 'I'

WS-16(1) TYPE C VALUE 'J',

WS-17(1) TYPE C VALUE 'K',

WS-18(1) TYPE C VALUE 'L',

WS-19(1) TYPE C VALUE 'M',

WS-20(1) TYPE C VALUE 'N',

  • O TYPE N VALUE '24', "Omit letter 'O'

WS-21(1) TYPE C VALUE 'P',

WS-22(1) TYPE C VALUE 'Q',

WS-23(1) TYPE C VALUE 'R',

WS-24(1) TYPE C VALUE 'S',

WS-25(1) TYPE C VALUE 'T',

  • WS-29(1) TYPE C VALUE 'U', "Omit letter 'U'

WS-26(1) TYPE C VALUE 'V',

WS-27(1) TYPE C VALUE 'W',

WS-28(1) TYPE C VALUE 'X',

WS-29(1) TYPE C VALUE 'Y',

WS-30(1) TYPE C VALUE 'Z',

WS-31(1) TYPE C VALUE '0',

NUM_LENGTH TYPE N VALUE '8'. " Length of stored no.

DATA : MAX_VAL(2) TYPE N VALUE '31'.

DATA: BEGIN OF NUM_TAB OCCURS 35,

CHAR(1) TYPE C,

VAL LIKE SY-INDEX,

END OF NUM_TAB.

  • initializes internal table with character values from data

DO MAX_VAL TIMES VARYING CHAR FROM WS-01 NEXT WS-02 .

MOVE: CHAR TO NUM_TAB-CHAR,

SY-INDEX TO NUM_TAB-VAL.

APPEND NUM_TAB.

ENDDO.

this is my code.

I could noy understand what it does.but my question is what should I keep at the end of statement

DO MAX_VAL TIMES VARYING CHAR FROM WS-01 NEXT WS-02 RANGE------>>>>here after range what should I keep??

PLZ HELP me eric in solving this.

regards

VAJA