on 02-05-2008 7:24 PM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.