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

ABAP Object program flow

Former Member
0 Likes
1,097

Hi all,

I'm starting to play with ABAP Object, and am very comfortable with OO features (coming from Java).

Currently, I am hesitating on the way to code my program flow. Let me explain:

Is it common practice to manage the screens flow within methods (with SET SCREEN etc.)?

I would think that this is kind of bad, since it requires local classes, and is simply kind of weird (to someone coming from Java anyway). Is continuing to handle this via MODULES and such still a good way to go?

Thanks for any enlightenment you can bring me.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,011

Hello,

It's all depends up on your requirement. You can do wonders in ABAP objects as same as in JAVA.

For example BADI is one of the best OO feature available in SAP ABAP.

Creating screens, buttons, interfaces and many things in OO with respect your requirement plays a vital role.

Regs,

Venkat

7 REPLIES 7
Read only

Former Member
0 Likes
1,011

Oh, and the same question goes to reporting: is it good practice to code reporting instructions in methods?

And, finally, what would be a better choice:

- Getting info from a database, and creating an object with this info (kind of like how things are done in Java)

- Or creating an object with primary key info, and letting it access the database table(s) itself (I would go for this choice now, but please tell me if it's bad and if it is, why).

Thanks again!

Read only

Former Member
0 Likes
1,012

Hello,

It's all depends up on your requirement. You can do wonders in ABAP objects as same as in JAVA.

For example BADI is one of the best OO feature available in SAP ABAP.

Creating screens, buttons, interfaces and many things in OO with respect your requirement plays a vital role.

Regs,

Venkat

Read only

Former Member
0 Likes
1,011

Hi,

It depends on the Programmers comfort to code, anyway atlast the object has to be delivered. There are also certain situation were we have to use only ABAP Objects, when you create a report program on a screen you have no other choice other than using ABAP Object Method and Classes.

Thanks,

Prashanth

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,011

Hello Thomas

Anything that has to do with screens (SET, CALL, etc.) has to occur outside your class because these statements are not allowed within classes.

I recently developed a "report" fully in ABAP-OO. I defined an OO-transaction which instantiated my class and started method MAIN (reference to Java...). Within the main method I was calling a function module like Z_..._CALL_SELSCREEN to display a selection screen for the user. After having received the select-options I do the business logic within my classes (indeed it's the model class => MVC architecture). When I have finished processing the data for ALV list display (occurs within a view class) I call another function module like Z_..._CALL_DYNPRO.

Any user-commands on the dynpros is sent back to my class (in this case the controller class). That is my way to implement MVC architecture using ABAP-OO.

Regards

Uwe

Read only

Former Member
0 Likes
1,011

I never said Java was better, I'm just coming from it and therefore taking it as an example.

I don't know yet what BADI is, could you give me some directions?

Thanks for your answers!

Read only

0 Likes
1,011

Hello Thomas

A BAdI is the most modern version of exits within the SAP coding. By implementing a BAdI you can adjust the SAP standard process to your customer-specific needs.

Usually a BAdI is assigned to an interface. You have to implement this interface in your customer class. Finally, activate the BAdI and your implementing class will be called as soon as the BAdI is passed in the standard coding.

Regards

Uwe

Read only

Former Member
0 Likes
1,011

Hello,

First, I din't mentioned that you said JAVA is better. I just said the things what u can do in JAVA u can achieve and there is a way in ABAP also. I tihnk u misunderstood my statements. :)..no hard feelings...

Ok.

BADI's are kind of Exits. To make it in a simple statement SAP has provided us with a way to enhance the business process.

For example, assume that a business process goes thru step 1, step 2 and so on. Inbetween step1 and step2 you want to do something. For this SAP has provided some standard interface, which will get the information about the business process in step1 in to it. You can make use of that and customize according to your requirement.

Send me you mail ID I will forward good document on BADI's.

Regs,

Venkat Ramanan N