Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

ABAP OO - Functional Method usage

$
0
0

ABAP OO Functional Method


We can use functional method like variables, and functional method can save us from declaring new data. Here I try to write very simple code for usage.


Definition of functional method is like any other method, but you can't use exporting or changing parameters and returning parameter must be fully specified.

Functional_method1.JPG

 

From now on I will continue with local class.

 

1) we can use with WRITE, IF, DO and LOOP statement.

Definition part :

Functional_method2.JPG

Implemantation part :

Functional_method3.JPG

Report code :

Functional_method4.JPG

2) we can use with new statement like REDUCE, FOR, | { } |

Functional_method5.JPG

3) singleton class and get_instance

Functional_method6.JPG

Functional_method7.JPG

Functional_method8.JPG

4) I wish, I like

We can declare table with TYPE TABLE OF REF TO <class> But we can't use functional method for LOOP AT...WHERE condition or READ TABLE...WITH KEY. I wish at new release of ABAP we can write code *** table field;

Functional_method11.JPG

Functional_method10.JPG

If m_count declared as public, we can write read or loop

Functional_method12.JPG

Functional_method13.JPG

 

Regards


Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>