Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the exporting type parameter of the ABAP method

2025-04-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you something about the exporting type parameters of the ABAP method. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

Subject: code review legacy problem: is it necessary to explicitly initialize the exporting parameter within implementation itself

Does the exporting parameter like the one below need to explicitly CLEAR at the beginning of the method implementation?

The answer is it depends.

Pass by value checkbox is not selected by default, that is, pass by reference. In this case, the reference of the argument is passed directly to the method implementation, and the parameter is modified directly by modifying the parameter in method.

In the case of pass by value, when runtime enters the method execution, abap runtime automatically creates a local object for the input and output parameters, and then value copy the input parameter to local object. The calculation in method is stored in the local object of the output parameter. After method execution, the value of local object is copy to the output parameter.

In the case of pass by reference, the exporting parameter will not be initialized automatically when it enters the function, but is still the value of the argument when it is passed, so developer is responsible for initializing it, otherwise the behavior of unexpepected may occur.

When to use pass by reference, when to use pass by value?

Pass by reference performs better, but requires developer to initialize exporting parameter itself in the implementation

If you expect the output parameters to be returned to caller only after the method has been successfully executed, use pass by value

If the parameter is a very complex structure, such as nested table, or according to the recommended value in abap help-it is best to use pass by reference after exceeding 100bytes.

See abap help for a more detailed distinction between the two.

Extended check automatically lists all code violations. For example, CL_CRM_SOC_FND_ACCESS_IMPL has 17:

These issue are categorize as programming guideline violation and will not be counted as ATC error.

These are the exporting type parameters of the ABAP method shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report