23 Flares Twitter 0 Facebook 23 Google+ 0 LinkedIn 0 Email -- Pin It Share 0 23 Flares ×

Requirement:

Create 3 input text files using parameters statement.

Created 4 pushbuttons and name it as Add, Sub, Mul and Div as shown below.

For example if user clicks on Add button then I want display addition of P_value1 and P_value2 in P_Result.

If user clicks on Sub button then I want display subtraction of P_value1 and P_value2 in P_Result.

If user clicks on Mul button then I want display multiplication of P_value1 and P_value2 in P_Result.

If user clicks on Div button then I want display Division of P_value1 and P_value2 in P_Result.

Push buttons in selection screenStep 1: Go to SE38 create a program (Program name starts must with Z or Y).

Step 2: Copy and paste the below code in your program.

*&———————————————————————*
*& Report  ZPUSH_BUTTONS_IN_SEL_SCREEN1
*& Created By Sapsimplified.com
*&———————————————————————*
*&
*&
*&———————————————————————*

REPORT ZPUSH_BUTTONS_IN_SEL_SCREEN1.

*//Tables declaration
TABLES: SSCRFIELDS.

*//Selection Screen design
PARAMETERS : P_value1 type i obligatory,
P_value2 type i obligatory,
P_result type i.
SELECTION-SCREEN skip 2.
SELECTION-SCREEN PUSHBUTTON /05(10) TEXT-002 USER-COMMAND PB1.
SELECTION-SCREEN PUSHBUTTON 20(10) TEXT-003 USER-COMMAND PB2.
SELECTION-SCREEN PUSHBUTTON 35(10) TEXT-004 USER-COMMAND PB3.
SELECTION-SCREEN PUSHBUTTON 50(10) TEXT-005 USER-COMMAND PB4.

at selection-screen.
Case SSCRFIELDS.
when ‘PB1’.
P_result = p_value1 + p_value2.
when ‘PB2’.
P_result = p_value1 – p_value2.
when ‘PB3’.
P_result = p_value1 * p_value2.
when ‘PB4’.
P_result = p_value1 / p_value2.
endcase.

Step 3: Save and execute (F8) your program.

You will get a screen as shown below.

Case 1: Provide P_value1 and P_value2 and click on Add button then you will get addition of P_value1 and P_value2 in P_Result as shown below.

Push buttons in selection screen1Case 2: Provide P_value1 and P_value2 and click on SUB button then you will get subtraction of P_value1 and P_value2 in P_Result as shown below.

Push buttons in selection screen3Case 3: Provide P_value1 and P_value2 and click on MUL button then you will get multiplication of P_value1 and P_value2 in P_Result as shown below.

Push buttons in selection screen4Case 4: Provide P_value1 and P_value2 and click on DIV button then you will get division of P_value1 and P_value2 in P_Result as shown below.

Push buttons in selection screen5That’s it.

Enjoy 🙂

Also Read:

Display a Column As a Pushbutton in the ALV Report Output.

How to Create Transaction Code for Table Maintenance Generator in SAP.

23 Flares Twitter 0 Facebook 23 Google+ 0 LinkedIn 0 Email -- Pin It Share 0 23 Flares ×