USING, CHANGING, TABLES는 Subroutine에서 Parameter를 전달하기 위해 사용된다.
PERFORM fanme USING p1 p2 p3.
FORM fname USING p1 p2 p3.
~
ENDFORM.
* Actual Parameter
PERFORM fanme USING p1 p2 p3.
* Formal Parameter
FORM fname USING p1 p2 p3.
~
ENDFORM.
* Formal Parameter
FORM fname USING p1 TYPE t.
~
ENDFORM.
PERFORM fanme USING p1 p2 p3.
FORM fname USING p1 p2 p3.
~
ENDFORM.
PERFORM fanme USING p1 CHANGING p2.
FORM fname USING p1.
ENDFORM.
FORM fname CHANGING p1.
ENDFORM.
FORM fname USING p1 CHANGING p2.
ENDFORM.
FORM fname USING VALUE (p1) VALUE (p2).
ENDFORM.
FORM fname USING VALUE (p1) CHANGING p2.
ENDFORM.
ENDFORM
, CHECK
, EXIT
와 같이 Subroutine이 종료될 때 Formal Parameter의 값이 Actual Parameter의 값으로 복사되어 최종적으로는 Actual Parameter의 값이 변경된다는 것이다.DATA : l_v1 TYPE c VALUE 'O',
l_v2 TYPE c VALUE 'O'.
PERFORM using USING l_v1.
WRITE : / '4. USING : ', l_v1,/.
PERFORM using_value USING l_v2.
WRITE : / '4. USING VALUE : ', l_v2,/.
FORM using USING pl_v1.
WRITE : / '1. USING : ', l_v1.
pl_v1 = '-'.
WRITE : / '2. USING : ', pl_v1.
WRITE : / '3. USING : ', l_v1.
ENDFORM.
FORM using_value USING VALUE(pl_v2).
WRITE : / '1. USING VALUE : ', l_v2.
pl_v2 = '-'.
WRITE : / '2. USING VALUE : ', pl_v2.
WRITE : / '3. USING VALUE : ', l_v2.
ENDFORM.
DATA : l_v1 TYPE c VALUE 'O',
l_v2 TYPE c VALUE 'O'.
PERFORM changing CHANGING l_v1.
WRITE : / '4. USING : ', l_v1,/.
PERFORM changing_value CHANGING l_v2.
WRITE : / '4. USING VALUE : ', l_v2,/.
FORM changing CHANGING pl_v1.
WRITE : / '1. USING : ', l_v1.
pl_v1 = '-'.
WRITE : / '2. USING : ', pl_v1.
WRITE : / '3. USING : ', l_v1.
ENDFORM.
FORM changing_value CHANGING VALUE(pl_v2).
WRITE : / '1. USING VALUE : ', l_v2.
pl_v2 = '-'.
WRITE : / '2. USING VALUE : ', pl_v2.
WRITE : / '3. USING VALUE : ', l_v2.
ENDFORM.
LOOP
, READ
같은 구문을 사용한다면TYPES : BEGIN OF tyname,
field1 type ftype,
END OF tyname.
FORM fname USING ptname TYPE STANDARD TABLE OF tyname.
ENDFORM.
* 지역 Table Type 선언
TYPES : BEGIN OF tyname,
field1 type ftype,
END OF tyname.
TYPES : tbname TYPE tyname OCCURS 0.
FORM fname USING ptname TYPE tbname.
ENDFORM.
* 글로벌 Table Type 선언