abap perform using changing
时间: 2023-05-01 22:02:21 浏览: 94
该语句是在ABAP编程语言中使用的一个关键字组合。其中“perform”表示执行某个子程序或功能模块,“using”表示传递参数给该子程序,“changing”表示传递一些需要被修改的参数(类似于传递引用变量)。因此,这个关键字组合可以用于对子程序进行参数传递和参数修改。
相关问题
abap using changing
"ABAP using changing" is a parameter passing mechanism used in ABAP programming language. It allows a subroutine or function module to modify the value of the calling program's variable by passing the address of the variable. This way, any changes made to the variable within the subroutine or function module are reflected in the calling program.
For example, if you have a variable "x" in your main program and you want to pass it to a subroutine to modify its value, you can use the "using changing" parameter passing mechanism by declaring the subroutine like this:
```
FORM my_subroutine USING CHANGING p_x TYPE i.
p_x = p_x + 1.
ENDFORM.
```
Here, "p_x" is a parameter passed to the subroutine using "using changing" mechanism. Any changes made to "p_x" within the subroutine will be reflected in the calling program's variable "x".
abap perform参数用法
ABAP中的PERFORM语句是一种调用子程序的方法。通过 PERFORM 语句,您可以在当前程序中调用另一个子程序中的代码,然后再返回到当前程序。在使用PERFORM语句时,需要指定被调用的子程序名。
PERFORM语句有两种语法形式:
1. PERFORM subroutine_name.
[USING {parameters}].
这种语法形式用于调用不带参数的子程序,其中 subroutine_name 是被调用的子程序名。
2. PERFORM subroutine_name
[USING {parameters}]
[CHANGING {parameters}].
这种语法形式用于调用带参数的子程序,其中 USING 子句用于传递输入参数,而 CHANGING 子句用于传递输出参数。
例如,以下代码演示了如何调用带参数的子程序:
```
REPORT ztest.
DATA: lv_input TYPE i,
lv_output TYPE i.
lv_input = 10.
PERFORM add_numbers USING lv_input CHANGING lv_output.
WRITE: / 'Input:', lv_input, / 'Output:', lv_output.
*&------------------------------------------------------------------*
*& Form add_numbers
*&------------------------------------------------------------------*
FORM add_numbers USING p_input TYPE i CHANGING p_output TYPE i.
p_output = p_input + 5.
ENDFORM.
```
在上面的代码中,我们定义了一个带输入和输出参数的子程序 add_numbers,并在主程序中使用 PERFORM 语句调用该子程序。在使用 PERFORM 语句时,我们使用 USING 子句传递输入参数 lv_input,使用 CHANGING 子句传递输出参数 lv_output。在子程序中,我们将输入参数加上5,并将结果存储在输出参数中。最后,在主程序中输出输入和输出参数的值。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)