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

[RESOLVED] Button on Selection-screen not working

yes_sapteam
Participant
0 Likes
2,482

Hi.

I want to add my own buttons to a Selection-screen.

If I add them through the <b>SELECTION-SCREEN: FUNCTION KEY 1</b> they are not calling the <b>START-OF-SELECTION</b> event.

When I add them through the <b>SET PF-STATUS 'SEL_SCR'</b> statement, 2 buttons are working correctly (i.e. calling the <b>START-OF-SELECTION</b> event) and 1 isn't.

Any thought as to the odd behaviour?

thanx.

ayal.

Message was edited by:

Yes SAP Team

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
0 Likes
1,457

Hi..

To avoid this problem.

Place this statement as the Last statement in AT SELECTION-Screen event.

<b>Tables SSCRFIELDS.

AT SELECTION-SCREEN.

<<STATEMENTS>>

SSCRFIELDS-UCOMM = 'ONLI'. "Execute button that triggers start-of-selection.</b>

START-OF-SELECTION.

<<STATEMENTS>>

<b>reward if Helpful.</b>

6 REPLIES 6
Read only

Former Member
0 Likes
1,457

It uses the AT SELECTION-SCREEN event.

Read only

Former Member
0 Likes
1,457

hi,

please refer to this if you want to add pushbutton to selection screen.

REPORT demo_sel_screen_pushbutton.

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.

CASE sscrfields.

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.

Demo Program: demo_sel_screen_pushbutton

Jayant Sahu

Read only

varma_narayana
Active Contributor
0 Likes
1,458

Hi..

To avoid this problem.

Place this statement as the Last statement in AT SELECTION-Screen event.

<b>Tables SSCRFIELDS.

AT SELECTION-SCREEN.

<<STATEMENTS>>

SSCRFIELDS-UCOMM = 'ONLI'. "Execute button that triggers start-of-selection.</b>

START-OF-SELECTION.

<<STATEMENTS>>

<b>reward if Helpful.</b>

Read only

0 Likes
1,457

Issue resolved !!!

Varma lead me to the right direction: the buttons on the Selection-screen must have "ONLI" at thier Function-code. The 2 buttons that worked had "ONLI" & "ONLI1" while the button that didn't work had "HISTORY" as a Function-code.

When I changed it to "ONLI2" it worked.

My guess is that SAP asks something like if <b>SSCRFIELDS-UCOMM cs "ONLI"</b> to know if they need to call the <b>START-OF-SELECTION</b> event.

Anyway, I think it's very ackward behaviour and I'm going to post a call to the OSS about it.

Thanx.

ayal.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,457

pls send ur code for the button which is not working

Read only

Former Member
0 Likes
1,457

Hi,

Use AT USER-COMMAND.

Reward if useful!