How can I write out a function's result to a screen?

Viewed 80

I got a function which is just a simple SELECT from a table. I have a screen with a button. I want to call the function and write out the result table on the screen when the button is activated. I do not get any error, just nothing happens, what's wrong?

CASE ok_code.
    WHEN 'SELECTALL'.
      CALL FUNCTION 'ZRL_ZH12FU_MONUMENTALL'
        TABLES
          MONUMENTLIST       =   monumentresult.
      LOOP AT monumentresult INTO monumentresultline.
        WRITE: / monumentresultline-monumentid,
                 monumentresultline-monumenttitle,
                 monumentresultline-theatre,
                 monumentresultline-year,
                 monumentresultline-part,
                 monumentresultline-picture.
      ENDLOOP.
    WHEN 'SELECT'.
      ...
3 Answers

WRITE only outputs data to an "list buffer", which will be automatically displayed when a system screen named "list screen" is displayed.

To switch from a classic screen to the list screen, use this statement in the PAI of the classic screen :

LEAVE TO LIST-PROCESSING.

At the end of the PAI, the list screen is then displayed and shows all data from the list buffer.

When you press the Exit button of the list screen, it does an implicit LEAVE LIST-PROCESSING (without TO), and the last classic screen is displayed.

The write statement only works for the output screen, not the selection screen.

You probably need to define some text elements on your selection screen and use the

LOOP AT SCREEN

construct to update the values of said text elements.

Write statements normally write on the list screen. Part of executable program. I see that you are trying to write on normal module pool screen.

To achieve this out write statements in an executable program and use submit program to call, so that, your write statements works.

Related