释疑の语法LOCAL
作用就是把當前對象保存在一個臨時存儲空間,它只能用到子程序或者FUNTION MODULE里,在程序結束的時候數據對象重新分配在臨時空間的值。
如果用LOCAL對同一個對象執行了好幾遍,那么只有第一次執行起作用。
語法:LOCAL dobj.
The statement LOCAL (not allowed in classes) saves the current content of a data object dobj in an internal buffer. It can be used only in subroutines or function modules. At the end of the procedure, the data object dobj is reassigned to the value in the buffer. If LOCAL is executed in a procedure for a data object more than once, only the first execution is taken into account.
All data objects possible in write positions can be specified for dobj. If dobj is an internal table, the procedure should not be called within a LOOP loop that processes the table.
Modifiable formal parameters of the procedure, field symbols, or dereferenced data references are also possible after LOCAL. If formal parameters are specified, the assigned actual parameter is set to the value in the buffer at the end of the procedure. For field symbols, the field reference and the content of the referenced fields are saved.?
例子:
DATA?TEXT?TYPE?STRING?VALUE?'Global?text'.
CL_DEMO_OUTPUT=>WRITE_TEXT(?TEXT?).
PERFORM?SUBR1.
CL_DEMO_OUTPUT=>DISPLAY_TEXT(?TEXT?).
FORM?SUBR1.
??LOCAL?TEXT.
??TEXT?=?'Text?in?subr1'.
??CL_DEMO_OUTPUT=>WRITE_TEXT(?TEXT?).
??PERFORM?SUBR2?USING?TEXT.
??CL_DEMO_OUTPUT=>WRITE_TEXT(?TEXT?).
ENDFORM.
FORM?SUBR2?USING?PARA?TYPE?STRING.
??LOCAL?PARA.
??PARA?=?'Text?in?subr2'.
??CL_DEMO_OUTPUT=>WRITE_TEXT(?TEXT?).
ENDFORM.
輸出:
總結
以上是生活随笔為你收集整理的释疑の语法LOCAL的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 释疑の资源短缺DATASET_CANT_
- 下一篇: PPT 2016的加解密功能