cancel
Showing results for 
Search instead for 
Did you mean: 

Push button problems

Former Member
0 Kudos

Hi Friends,

We need a pushbutton which when pressed should display a simple message. So we tried using write statement, message statement, SUBMIT ZTEST3 (where ZTEST3 is another program having a simple write statement) AND RETURN and also

IF sscrfields-UCOMM = 'FCODE'.

set screen 9000.

endif.

module STATUS_9000 output.

....some more code to display the message

end module.

But NONE of these work. THis means when the push button is pressed, the screen does not change.

Any help or input is greatly appreciated.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, I'm not very clear on your scenario. But I try to create a application like following: a report screen has a pushbutton, and when click the pushbutton will launch a new screen, in the PBI of new screen, will throw a message.

Code like following:


SELECTION-SCREEN PUSHBUTTON 1(20) BUTTON USER-COMMAND AAA.

AT SELECTION-SCREEN .
IF SY-UCOMM = 'AAA'.
  SET SCREEN 100.
ENDIF.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS '0100'.
*  SET TITLEBAR 'xxx'.
  MESSAGE S001(ZK).
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
IF SY-UCOMM = 'BACK'.
  LEAVE PROGRAM.
ENDIF.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Hope it will be helpful.

thanks a lot

Answers (3)

Answers (3)

Former Member
0 Kudos

U can add Pushbuttons in the application toolbar by writing

SET PF-STATUS 'ZSTATUS'.

in PBO and while double clicking on the ZSTATUS u can create pushbuttons with icons too.

On pressing the Push buton u can call a transaction or perform some operations by coding in PAI.

CASE sy-ucomm.
WHEN 'XX'.
xx is the function code for the pushbutton.
perform ...
ENDCASE.

Hope this helps.

Also check this thread

http://www.sapdevelopment.co.uk/reporting/selscr/but_buttons.htm

http://www.sapdevelopment.co.uk/reporting/selscr/but_appbut.htm

vyende
Active Participant
0 Kudos

Seems like a 2 in 1 question.

1. Creating a pushbutton and assigning a function code: I have copied a SAP help text below.

2. Displaying a message: There are several SAP standard function modules that displays/popup text. SE37 and type popup* and pulldown. One example is "POPUP_TO_INFORM".

Here is SAP verbage on pushbuttons:

*********************************************************

Variant 10

SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.

Addition: MODIF ID modid.

Effect

Generates a pushbutton on the selection screen. When you define the button, you also define a user command ucom (no inverted commas), up to 20 characters long, which is triggered when the user pushes the button. The rest of the syntax is the same as for SELECTION-SCREEN COMMENT

You can define the name name either statically or at runtime (see also the BEGIN OF BLOCK, COMMENT and SELECTION-SCREEN BEGIN OF SCREEN variants).

When you define a pushbutton, you must always specify a format fmt.

By specifying a Modif ID, you can assign the pushbutton to a modification group.

Notes

The best way of reacting to the pushbutton is in the AT SELECTION-SCREEN event, or, for pushbuttons in the selection include, in the PAI routine (with FNAME = '*' and MARK = SPACE) in the database program SAPDBldb. The field SSCRFIELDS-UCOMM contains the user command ucom. (You need to declare the SSCRFIELDS table using the TABLES statement).

You can create your own pushbuttons in the application toolbar using the FUNCTION KEY n addition.

Within the selectoin include : Additions FOR NODE node ,FOR TABLE dbtab und ID id.

Example

TABLES SSCRFIELDS.

...

SELECTION-SCREEN PUSHBUTTON /10(20) CHARLY USER-COMMAND ABCD.

...

INITIALIZATION.

MOVE 'My text' TO CHARLY.

...

AT SELECTION-SCREEN.

IF SSCRFIELDS-UCOMM = 'ABCD'.

...

ENDIF.

A pushbutton appears on the selection screen with the text 'My text'. In the AT SELECTION-SCREEN event, the field SSCRFIELDS-UCOMM has the contents ABCD after the button has been pushed.

*********************************************************

Hope this helps

suresh_datti
Active Contributor
0 Kudos

Hi Deep,

try the following piece...

**********

selection-screen:

pushbutton 1(40) p_pcus user-command cus.

*********

at selection-screen.

case sy-ucomm.

when 'CUS'.

message i016(rp) with 'Go back to the selection screen'.

when others.

endcase.

*************

Good Luck,

Suresh Datti