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: 

Refresh ALV Grid after execution of secondary screen

former_member530652
Participant
0 Kudos
2,355

Hi,

I have report which is giving me ALV grid output and on application toolbar of this ALV output I have push button which is leading me to another screen for any messages.

Now, when I am coming back from second screen to ALV, I want ALV data to be refreshed or fetched again. Please let me know how I can do this?

I am not using any custom screen for this but below is code snippet. Below code is leading to secondary screen and i want to refresh the ALV when I get back to the first screen of ALV. I put the code in PERFORM GET_DATA after LEAVE SCREEN to refresh ALV but it is not working. Any leads will be appreciated.

LEAVE TO LIST-PROCESSING.

SET PF-STATUS 'STLI' OF PROGRAM 'SAPMSSY0' IMMEDIATELY.

Write statement for the message on next screen.

LEAVE SCREEN.

PERFORM GET_DATA.

Thanks.

7 REPLIES 7

Sandra_Rossi
Active Contributor
0 Kudos
1,328

Which ALV technology are you using?

As you are using PERFORM, I guess that you are using the old interface, either REUSE_ALV_LIST_DISPLAY or REUSE_ALV_GRID_DISPLAY function module.

If that's right, then you handled your custom button via a subroutine with this interface:

FORM user_command
  USING
  R_UCOMM  LIKE SY-UCOMM
  RS_SELFIELD TYPE SLIS_SELFIELD.
...
ENDFORM.

After you have displayed/terminated the detail screen, you need to set RS_SELFIELD-REFRESH = 'X' if you want the ALV to be automatically refreshed.

0 Kudos
1,328

Thanks Sandra for the response,

Yes, I am using FM REUSE_ALV_GRID_DISPLAY for ALV display. Below is the actual code snippet used in my program.

CASE r_ucomm.

WHEN 'SAVE'.

.

.

WHEN '&PUSH'. "For Push bottun

Some code

LEAVE TO LIST-PROCESSING. "For output on next screen

SET PF-STATUS 'STLI' OF PROGRAM 'SAPMSSY0' IMMEDIATELY.

Write: 'For any messages on secondary screen.'

LEAVE SCREEN.

PERFORM GET_DATA. "Here data fetching and ALV display logic is written

Now, I want to access the subroutine GET_DATA after LEAVE SCREEN statement but control do not go to this subroutine and program ends showing ALV GRID display screen when I press BACK button on the secondary screen.

I would like to know what I need to do so that I can access GET_DATA subroutine to re-display the processed data after exiting the secondary screen. As I am using standard screen, I guess I can not use PAI of the secondary screen for writing USER COMMAND.

Any further inputs will be highly appreciated.

0 Kudos
1,328

First of all, I advise you to do things simple: create a screen for displaying your messages, and simply do a CALL SCREEN after WHEN '&PUSH' (note: if you really want to display an ABAP list, then in the PBO of that new screen, do a LEAVE TO LIST-PROCESSING + SUPPRESS DIALOG to not display the screen and switch to the ABAP list).

And do RS_SELFIELD-REFRESH = 'X' after the CALL SCREEN.

Now, for your information:

  • LEAVE TO LIST-PROCESSING: instructs that, at the end of the PAI of the current screen (screen of the ALV), the next screen will be the one of the ABAP List processor (will display all the WRITE). After the ABAP List is terminated, it will return to the current screen (screen of the ALV, restarting from its PBO).
  • LEAVE SCREEN: explains that the PAI of the current screen (screen of the ALV) is terminated immediately.

So, don't be surprised if the code behind LEAVE SCREEN is not executed.

0 Kudos
1,328

Thanks Sandra,

I have created new screen now.

But I am facing issue when I am pressing BACK button of the new screen, it is going into infinite loop.

Below code is written in the PBO of called new screen. Kindly advise.

MODULE STATUS_1100 OUTPUT.

SET PF-STATUS 'STAT_1100'.

PERFORM PUSH_DATA. "written for Writing message on the new screen

LEAVE TO LIST-PROCESSING.

SUPPRESS DIALOG.

ENDMODULE. " STATUS_1100 OUTPUT

0 Kudos
1,328

My bad. Use LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.

(it's equivalent to a SET SCREEN 0, which leaves the current "screen sequence", and so returns right after the CALL SCREEN which started the screen sequence).

0 Kudos
1,328

Sorry Sandra,

I am getting short dump after pressing BACK on new screen. ALV screen number is 0500.

Saying:

Error analysis

The system attempted to use dynpro 0500 in program "ZPROGRAM".

This dynpro does not exist.

Also, when I am pressing push button on ALV screen then one blank screen is appearing and after pressing BACK on the blank screen, screen which I have created is appearing.

When I am pressing BACK on my newly created screen I am getting short dump.

0 Kudos
1,328

Please use RETURN TO SCREEN 0.