ADD的用法
*&---------------------------------------------------------------------*
*& Report ZADD
*& 作成者:張玉剛
*&---------------------------------------------------------------------*
*& 作成日 :2009/07/31
*& 処理概要:ADDの使い方
*&---------------------------------------------------------------------*
REPORT ZADD.
*&---------------------------------------------------------------------*
*& ADD n TO m
*&---------------------------------------------------------------------*
DATA: NUMBER TYPE I VALUE 3,
SUM TYPE I VALUE 5.
ADD NUMBER TO SUM.
WRITE SUM.
"結果:8
*&---------------------------------------------------------------------*
*& ADD n1 THEN n2 UNTIL nz GIVING m
*&---------------------------------------------------------------------*
DATA: BEGIN OF NUMBERS,
ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
SIX TYPE P VALUE 60,
END OF NUMBERS,
SUM TYPE I VALUE 1000.
ADD NUMBERS-ONE THEN NUMBERS-TWO
UNTIL NUMBERS-FIVE GIVING SUM.
WRITE SUM.
"結果:150
*&---------------------------------------------------------------------*
*& ADD n1 THEN n2 UNTIL nz TO m
*&---------------------------------------------------------------------*
DATA: BEGIN OF NUMBERS,
ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
END OF NUMBERS,
SUM TYPE I VALUE 1000.
ADD NUMBERS-ONE THEN NUMBERS-TWO
UNTIL NUMBERS-FIVE TO SUM.
"結果:1150
*&---------------------------------------------------------------------*
*& ADD n1 THEN n2 UNTIL nz ...ACCORDING TO sel ...GIVING m
*&---------------------------------------------------------------------*
DATA: BEGIN OF NUMBERS,
ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
END OF NUMBERS,
SUM TYPE I VALUE 1000,
INDEX TYPE I.
RANGES SELECTION FOR INDEX.
SELECTION-SIGN = 'I'.
SELECTION-OPTION = 'BT'.
SELECTION-LOW = 2.
SELECTION-HIGH = 4.
APPEND SELECTION.
ADD NUMBERS-ONE THEN NUMBERS-TWO
UNTIL NUMBERS-FIVE
ACCORDING TO SELECTION
GIVING SUM.
"結果:90
*&---------------------------------------------------------------------*
*& ADD n1 FROM m1 TO mz GIVING m
*&---------------------------------------------------------------------*
DATA: BEGIN OF NUMBERS,
ONE TYPE P VALUE 10,
TWO TYPE P VALUE 20,
THREE TYPE P VALUE 30,
FOUR TYPE P VALUE 40,
FIVE TYPE P VALUE 50,
END OF NUMBERS,
START TYPE I VALUE 2,
SUM TYPE I VALUE 1000.
ADD NUMBERS-ONE FROM START TO 4 GIVING SUM.
"結果:90