Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

calling a function inside a method.

Former Member
3,698

Okay, so I'm a newbie in OO ABAP(having a bit hard time wrapping my head around it), I have to call a function inside a method, so I'm having a bit of confusion with the exporting and importing parameters, my function has many importing and exporting parameters, do I have to declare them all in the method's importing/exporting parameters also? please explain with an example if possible. Thank you.

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
2,550

I applaud your desire to learn to program OO. Too many new programmers are firmly stuck in the last century.

If you are encapsulating the function module in a method, then you'll need to replicate all the parameters. if you're happy with some defauls then you could, for example, set some constants in the class and use them for the defaulted values. If perhaps some of the values are being held as attributes of the class, then you'd use those.

Really it depends on what your method is for and the reason for using that function module.

If you have time, you could try to learn OO programming as I did. I taught myself Java through the Head First Java book (O'Reilly Press). Then applied what I learned to ABAP. Next step would be to do the TDD course on openSAP.

2 REPLIES 2
Read only

ThFiedler
Product and Topic Expert
Product and Topic Expert
2,550

Welcome to the ABAP world 🙂

The signature of your method and the function module is independent from each other.

Regards,

Thomas.

Read only

matt
Active Contributor
2,551

I applaud your desire to learn to program OO. Too many new programmers are firmly stuck in the last century.

If you are encapsulating the function module in a method, then you'll need to replicate all the parameters. if you're happy with some defauls then you could, for example, set some constants in the class and use them for the defaulted values. If perhaps some of the values are being held as attributes of the class, then you'd use those.

Really it depends on what your method is for and the reason for using that function module.

If you have time, you could try to learn OO programming as I did. I taught myself Java through the Head First Java book (O'Reilly Press). Then applied what I learned to ABAP. Next step would be to do the TDD course on openSAP.