Call screen on clicking the button in SAP ABAP

Please follow the steps below to make it functional ?

  • First, open the screen painter
  • Now, double click on the button you want to make functional
  • Above Context Menu Form, you will find a field to enter Function code where you enter the functional code

This will convert your button to a functional trigger that sends the OK code which will run the dynpro PROCESS AFTER INPUT. Now add a PAI module to this dynpro which indicates the screen you want to call when the button is clicked.

Example

Below is an example of how to implement the PAI module to call a screen based on the function code ?

CASE sy-ucomm. " the ok code
  WHEN 'FUNC_CODE'.
    CALL SCREEN 200.
  WHEN 'EXIT'.
    LEAVE PROGRAM.
  WHEN OTHERS.
    " DO NOTHING
ENDCASE.

In this example ?

  • FUNC_CODE is the function code you set up in the screen painter for your button
  • 200 is the screen number you want to call when the button is clicked
  • sy-ucomm contains the function code triggered by user interaction
  • The CASE statement handles different function codes that may be triggered

Conclusion

By assigning a function code to your button and implementing the corresponding PAI logic with CALL SCREEN, you can easily navigate between different screens in your SAP ABAP application when users click the button.

Updated on: 2026-03-13T18:20:02+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements