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

Refresh screen within a class

Former Member
0 Likes
1,390

Hi all,

I have a zclass and a program with a screen.

In this program i have an instance of my zclass. My question is, is it possible to refresh a screen in a method of my class?

Or there is a way to refresh a screen of a program within another program?

Regards,

Pedro Bessa

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
1,182

Hi Pedro,

whaever you call the refreshing of the screen, it is not related to your classes instance. The PBO of a screen is automatically processed after the PAI. PAI is triggered by anay kind of user-command. As long as you do not leave the screen or call another screen, the PBO is executed after PAI and the screen is displayed again.

If you want a method of your class to refresh the screen, the method should be called in PBO returning, exporting or changin the screen fields.

If all screen fields are in the same structure, you can do like this

* PBO
z_screen_structure =  zxy->get_screenfields( ).

* PAI
zxy->set_screenfields( z_screen_structure  ).

In the get method, define a RETURNING parameter, in the set method an IMPORTING parameter with the TYPE of your screen structure.

Regards,

Clemens

6 REPLIES 6
Read only

Former Member
0 Likes
1,182

each time the PBO is called (i.e) the screen is displayed, the program will automatically fill the values to the screen, if they are mapped to the variables from which you want them to be refreshed.

if not, pass them in the PBO modules

Read only

0 Likes
1,182

My variables are being refreshed in the pbo but how can i force the pbo to be executed from another program?

Read only

Clemenss
Active Contributor
0 Likes
1,183

Hi Pedro,

whaever you call the refreshing of the screen, it is not related to your classes instance. The PBO of a screen is automatically processed after the PAI. PAI is triggered by anay kind of user-command. As long as you do not leave the screen or call another screen, the PBO is executed after PAI and the screen is displayed again.

If you want a method of your class to refresh the screen, the method should be called in PBO returning, exporting or changin the screen fields.

If all screen fields are in the same structure, you can do like this

* PBO
z_screen_structure =  zxy->get_screenfields( ).

* PAI
zxy->set_screenfields( z_screen_structure  ).

In the get method, define a RETURNING parameter, in the set method an IMPORTING parameter with the TYPE of your screen structure.

Regards,

Clemens

Read only

Former Member
0 Likes
1,182

Hi Clemens,

I'll try to explain what i want to do...

I'm trying to build a toolbar for a table control. But the instance of the toolbar (CL_GUI_TOOLBAR) is in my zclass.

The problem is when the user click in a button of my toolbar the PBO is not executed. It passes automaticaly to the event receiver of the toolbar... But i need the PBO to be executed before this...

Regards,

Pedro Bessa

Read only

0 Likes
1,182

You need to use


    call method cl_gui_cfw=>set_new_ok_code
             exporting
                 new_code = 'REFR'. " Dummy OKcode 

After this call system auto calls PBO,.

a®

Read only

Clemenss
Active Contributor
0 Likes
1,182

Hi Pedro,

[The handler method that you defined for the event is called automatically by the system.However, you can use the method set_new_ok_code to set a new value for the OK_CODE field. This then triggers the PAI and PBO modules, and you can evaluate the contents of the OK_CODE field as normal in a PAI module.|http://www.sapalv.net/2009/07/sap-alv-tutorial-2-%E2%80%93-event/]

Regards,

Clemens