cancel
Showing results for 
Search instead for 
Did you mean: 

DO---- enddo.

Former Member
0 Kudos

can any body write the same with out using ADD

insted we need to write do --- end do.

DATA: BEGIN OF numbers,

one TYPE p LENGTH 8 DECIMALS 0 VALUE 10,

two TYPE p LENGTH 8 DECIMALS 0 VALUE 20,

three TYPE p LENGTH 8 DECIMALS 0 VALUE 30,

four TYPE p LENGTH 8 DECIMALS 0 VALUE 40,

five TYPE p LENGTH 8 DECIMALS 0 VALUE 50,

END OF numbers,

sum TYPE i.

SELECT-OPTIONS position FOR sum.

ADD numbers-one THEN numbers-two

UNTIL numbers-five

ACCORDING TO position

GIVING sum.

write:/ sum.

Accepted Solutions (0)

Answers (1)

Answers (1)

russell_day2
Participant
0 Kudos

This question has nothing to do with Web Dynpro, but I suggest that you use field symbols, which are what we used as pointers before reference variables came along. And they are very cool. Put these lines after your 'sum type i' declaration.

field-symbols: <fs1> type any, <fs2> type any.

assign numbers to <fs1>.

do 5 times.

. assign COMPONENT sy-index of structure <fs1> to <fs2>.

. add <fs2> to sum.

enddo.

write sum.