SAP ABAP - Sample Program On How To Program On Buttons In A Screen.
This is a sample program on screen painter showing how to program on buttons in a screen.
REPORT ztest_screen_paint_program.
TABLES: mara.
DATA: matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
display TYPE c,
save TYPE c,
delete TYPE c,
clear TYPE c,
exit TYPE c,
ok_code TYPE sy-ucomm.
CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'STATUS_9000'.
SET TITLEBAR 'TITLE_9000'.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'CLEAR'.
CLEAR mara.
WHEN 'DISPLAY'.
SELECT SINGLE ersda ernam mtart matkl FROM mara
INTO (mara-ersda, mara-ernam, mara-mtart, mara-matkl)
WHERE matnr = mara-matnr.
ENDCASE.
ENDMODULE. " STATUS_9000 OUTPUT
On clicking a button a user command is thrown. In this case on clicking DISPLAY Button, the user command thrown is DISPLAY.
Hence it will fetch the respective details from mara table and displays it in the respective fields.
Say, the Output screen (9000) looks as below,
On entering the material, or selecting an appropriate one from the F4 help, and on clicking the DISPLAY button, the remaining fields get automatically filled up.
On clicking DISPLAY Button
MORE PROGRAMS ON REPORT PROGRAMMING:
- Setting Default Values In Selection Screen.
- Create A Screen With Two TABSTRIPS For A Report Program.
- On Using HOTSPOT Keyword In A Report Program.
- Fetch Company Code Of All The Vendors.
- Function Module To Verify Valid E-Mail Address.
- ...Back To Index On Report Programming.
Your suggestions and comments are welcome in this section.
Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.
REPORT ztest_screen_paint_program.
TABLES: mara.
DATA: matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
display TYPE c,
save TYPE c,
delete TYPE c,
clear TYPE c,
exit TYPE c,
ok_code TYPE sy-ucomm.
CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'STATUS_9000'.
SET TITLEBAR 'TITLE_9000'.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'CLEAR'.
CLEAR mara.
WHEN 'DISPLAY'.
SELECT SINGLE ersda ernam mtart matkl FROM mara
INTO (mara-ersda, mara-ernam, mara-mtart, mara-matkl)
WHERE matnr = mara-matnr.
ENDCASE.
ENDMODULE. " STATUS_9000 OUTPUT
On clicking a button a user command is thrown. In this case on clicking DISPLAY Button, the user command thrown is DISPLAY.
Hence it will fetch the respective details from mara table and displays it in the respective fields.
Say, the Output screen (9000) looks as below,
On entering the material, or selecting an appropriate one from the F4 help, and on clicking the DISPLAY button, the remaining fields get automatically filled up.
On clicking DISPLAY Button
MORE PROGRAMS ON REPORT PROGRAMMING:
- Setting Default Values In Selection Screen.
- Create A Screen With Two TABSTRIPS For A Report Program.
- On Using HOTSPOT Keyword In A Report Program.
- Fetch Company Code Of All The Vendors.
- Function Module To Verify Valid E-Mail Address.
- ...Back To Index On Report Programming.
Your suggestions and comments are welcome in this section.
Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.