Application Development and Automation 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: 
Read only

push button on selection screen

Former Member
0 Likes
4,222

Hi All,

How to place and function a push button on selection screen.

Sample code if any, pls

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,219

Hi..

<b>TABLES: SSCRFIELDS.

PARAMETERS:

P_NUM1 TYPE I,

P_NUM2 TYPE I,

P_RESULT TYPE P.

SELECTION-SCREEN:FUNCTION KEY 1,

FUNCTION KEY 2,

FUNCTION KEY 3,

FUNCTION KEY 4,

FUNCTION KEY 5.

INITIALIZATION.

SSCRFIELDS-FUNCTXT_01 = 'ADD'.

SSCRFIELDS-FUNCTXT_02 = 'SUB'.

SSCRFIELDS-FUNCTXT_03 = 'MUL'.

SSCRFIELDS-FUNCTXT_04 = 'DIV'.

SSCRFIELDS-FUNCTXT_05 = 'MOD'.

AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

P_RESULT = P_NUM1 + P_NUM2.

WHEN 'FC02'.

P_RESULT = P_NUM1 - P_NUM2.

WHEN 'FC03'.

P_RESULT = P_NUM1 * P_NUM2.

WHEN 'FC04'.

P_RESULT = P_NUM1 div P_NUM2.

WHEN 'FC05'.

P_RESULT = P_NUM1 MOD P_NUM2.

ENDCASE.

END-OF-SELECTION.</b>

8 REPLIES 8
Read only

Former Member
0 Likes
3,219

Hi,

To place a pushbutton on the selection screen, u need to define the PF-STATUS.

PF-STATUS needs to be called in the AT SELECTION-SCREEN OUTPUT.

e.g.

Define the selecvtion screen.

then write the following code :

AT SELECTION-SCREEN OUTPUT.

SET PF-STATUS 'ZTEST'.

Double click on ZTEST. It will take u to the GUI Status Creation screen.

In the application toolbar, define a pushbutton and assign a function code say 'FUNC1' to it.

activate the GUI Status.

Now, in ur program,

Write the following piece of code :

CASE SY-UCOMM.

WHEN 'FUNC1'.

Write the logc.

Hope it helps.

Regards,

Himanshu

Read only

Former Member
0 Likes
3,219

hi

pls refer the source code <b>DEMO_SEL_SCREEN_PUSHBUTTON</b>

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba81635c111d1829f0000e829fbfe/content.htm

thx

pavan

*pls mark for helpful answers

Read only

Former Member
0 Likes
3,219

HI

Just copy this code and execute

SELECTION-SCREEN BEGIN OF BLOCK B1 with frame.

PARAMETERS: myparam(10) type C,

Myparam2(10) type N.

SELECTION-SCREEN END OF BLOCK B1.

Tables sscrfields.

selection-screen FUNCTION KEY 1.

initialization.

concatenate '@42@' 'Refresh' into sscrfields-functxt_01.

Hope this helps

Regds

Seema

Read only

Former Member
0 Likes
3,219

Hi..,

U can place a Push button on selection screen by using the satatement..

<b>SELECTION-SCREEN PUSHBUTTON 2(10) butt USER-COMMAND cli3.

The push button will start from second character position on Selection screen and of length 10 characters !!</b>

check this program...

TABLES sscrfields.

DATA flag(1) TYPE c.

SELECTION-SCREEN:

BEGIN OF SCREEN 500 AS WINDOW TITLE tit,

BEGIN OF LINE,

PUSHBUTTON 2(10) but1 USER-COMMAND cli1,

PUSHBUTTON 12(10) text-020 USER-COMMAND cli2,

END OF LINE,

BEGIN OF LINE,

PUSHBUTTON 2(10) but3 USER-COMMAND cli3,

PUSHBUTTON 12(10) text-040 USER-COMMAND cli4,

END OF LINE,

END OF SCREEN 500.

AT SELECTION-SCREEN.

MESSAGE i888(sabapdocu) WITH text-001 sscrfields-ucomm.

CASE sscrfields-ucomm.

WHEN 'CLI1'.

flag = '1'.

WHEN 'CLI2'.

flag = '2'.

WHEN 'CLI3'.

flag = '3'.

WHEN 'CLI4'.

flag = '4'.

ENDCASE.

START-OF-SELECTION.

TIT = 'Four Buttons'.

BUT1 = 'Button 1'.

BUT3 = 'Button 3'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10.

CASE FLAG.

WHEN '1'.

WRITE / 'Button 1 was clicked'.

WHEN '2'.

WRITE / 'Button 2 was clicked'.

WHEN '3'.

WRITE / 'Button 3 was clicked'.

WHEN '4'.

WRITE / 'Button 4 was clicked'.

WHEN OTHERS.

WRITE / 'No Button was clicked'.

ENDCASE.

regards,

sai ramesh

Read only

PS_1978
Active Participant
0 Likes
3,219

Hi,

Have a look at the standard programs from ABAPDOCU

<b>demo_sel_screen_pushbutton</b> and

<b>demo_sel_screen_function_key</b>

Regards,

Phani

Read only

Former Member
0 Likes
3,220

Hi..

<b>TABLES: SSCRFIELDS.

PARAMETERS:

P_NUM1 TYPE I,

P_NUM2 TYPE I,

P_RESULT TYPE P.

SELECTION-SCREEN:FUNCTION KEY 1,

FUNCTION KEY 2,

FUNCTION KEY 3,

FUNCTION KEY 4,

FUNCTION KEY 5.

INITIALIZATION.

SSCRFIELDS-FUNCTXT_01 = 'ADD'.

SSCRFIELDS-FUNCTXT_02 = 'SUB'.

SSCRFIELDS-FUNCTXT_03 = 'MUL'.

SSCRFIELDS-FUNCTXT_04 = 'DIV'.

SSCRFIELDS-FUNCTXT_05 = 'MOD'.

AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

P_RESULT = P_NUM1 + P_NUM2.

WHEN 'FC02'.

P_RESULT = P_NUM1 - P_NUM2.

WHEN 'FC03'.

P_RESULT = P_NUM1 * P_NUM2.

WHEN 'FC04'.

P_RESULT = P_NUM1 div P_NUM2.

WHEN 'FC05'.

P_RESULT = P_NUM1 MOD P_NUM2.

ENDCASE.

END-OF-SELECTION.</b>

Read only

Former Member
0 Likes
3,219

Hi,

REPORT ZPROG1.

TABLES:SSCRFIELDS.

SELECTION-SCREEN PUSHBUTTON /10(4) MYBUTTON USER-COMMAND ABCD.

INITIALIZATION.

MYBUTTON = 'BACK'.

AT SELECTION-SCREEN.

IF SSCRFIELDS-UCOMM = 'ABCD'.

SET SCREEN 0.

ENDIF.

regards,

bharat.

Read only

Former Member
0 Likes
3,219

HI

For function see the AT SELECTION-SCREEN.code

SELECTION-SCREEN BEGIN OF BLOCK B1 with frame.

PARAMETERS: myparam(10) type C,

Myparam2(10) type N.

SELECTION-SCREEN END OF BLOCK B1.

Tables sscrfields.

selection-screen FUNCTION KEY 1.

initialization.

concatenate '@42@' 'Refresh' into sscrfields-functxt_01.

AT SELECTION-SCREEN.

if sscrfields-ucomm = 'FC01'.

<write your code>

endif.

Regds

Seema.