Application Development 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: 

Calling a screen from within a class

Former Member
0 Kudos

I see that you cannot perform a 'CALL SCREEN XXXX' statement from within a method of a class since you cannot create a screen within a class. Is there any non-procedural way around this? I don't want to exit my oo-code by calling a function module that then calls a screen internally; and put all my code that should be in my class into this function module. I don't see any classes so far that I could call/instantiate to solve the problem. Any help would be appreciated.

1 ACCEPTED SOLUTION

matt
Active Contributor
0 Kudos

You <b>have</b> to go through function modules. However, you use the FMs only for screen handling. Everything else should be done in your class. There's no need to put your class code into the FM.

You can always pass the FM a reference to "me" when you call it, so that you can "return" to the class.

matt

5 REPLIES 5

matt
Active Contributor
0 Kudos

You <b>have</b> to go through function modules. However, you use the FMs only for screen handling. Everything else should be done in your class. There's no need to put your class code into the FM.

You can always pass the FM a reference to "me" when you call it, so that you can "return" to the class.

matt

Former Member
0 Kudos

Thank you; I'll investigate. To clarify, though, what I meant by "putting my OO code into the function module" is that on the screen I want to clal will be a custom container control, splitter control within that and then tree control and toolbar control within the splitter. That is the code that I assume I'd have to now put inside the FM, right? Or are you saying I could pass those references into the FM?

0 Kudos

Hello Will, hello Rich,

couple of days ago I had the same problem. I have solved it,

and it is already in production system.

In your method use the coding:

  
  WRITE space.

  CREATE OBJECT go_grid
    EXPORTING
      i_parent = cl_gui_container=>screen0.

Hope it helps,

Peter

matt
Active Contributor
0 Kudos

First I must say that I've not done this myself, but I have seen it done! But I can't see any particular reason why you couldn't just pass the references. It's only the connection to the screen that's non-oo.

matt

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can't use screens in a global class, but you can call a screen with a local class. Not sure that helps you in your case, though

Regards,

Rich Heilman