Application Development 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: 

Why i am not getting pb1 in output

Former Member
0 Kudos

ELECTION-SCREEN PUSHBUTTON 10(10) TITLE1 USER-COMMAND PB1.

LEAVE TO list-processing.

WRITE : SY-UCOMM.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Balaji,

You need to define Pushbutton in a seperate screen and you need to call that screen when you execute the program. Check the code sample given below for more clarity...

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,

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'.

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 OTHERS.

WRITE / 'No Button was clicked'.

ENDCASE.

As you see above, call screen 500 is used, where the push button has been drawn...

<b>Reward points for helpful answers</b>.

Best Regards,

Ram.

4 REPLIES 4

Former Member
0 Kudos

requirement unclear problem unclear.

Former Member
0 Kudos

Hi Balaji,

You need to define Pushbutton in a seperate screen and you need to call that screen when you execute the program. Check the code sample given below for more clarity...

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,

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'.

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 OTHERS.

WRITE / 'No Button was clicked'.

ENDCASE.

As you see above, call screen 500 is used, where the push button has been drawn...

<b>Reward points for helpful answers</b>.

Best Regards,

Ram.

Former Member
0 Kudos

Hello,

Please try it this way for your code,

SELECTION-SCREEN PUSHBUTTON 10(10) TITLE1 USER-COMMAND PB1.

AT SELECTION-SCREEN.

LEAVE TO list-processing.

WRITE : SY-UCOMM.

Reward if helpful

Regards

Byju

Former Member
0 Kudos

hi

good

go through this

Similar to pushbuttons on screens , pushbuttons on selection screens can also be defined with function codes. To create a pushbutton on the selection screen you use the following statement during the definition of the selection screen:

SELECTION SCREEN PUSHBUTTON [/]pos(len) push

USER-COMMAND fcode [MODIF ID key].

The [/]pos(len) parameters and the MODIF ID addition have the same function as for the formatting options for underlines

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

use the pushbutton as its given here.

thanks

mrutyun^