03-19-2014 8:22 AM
Hi Guys,
Well I am having a problem, I am trying this simple program what it does is it will have two pushbutton on the screen upon clicking one it will just popup a message. What I am trying to achieve is that I need to show a message box before any of the pushbuttons are displayed and a message box after the pushbuttons are displayed. Below is the code but does not seem to work once I run it.
Your help is much appreciated.
*&---------------------------------------------------------------------*
*& Report ZAABTEST6
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZAABTEST6.
TABLES sscrfields.
*--------------------------------------------------------------*
*Selection-Screen
*--------------------------------------------------------------*
SELECTION-SCREEN:
PUSHBUTTON /2(40) button1 USER-COMMAND but1,
PUSHBUTTON /2(40) button2 USER-COMMAND but2.
*--------------------------------------------------------------*
*Initialization
*--------------------------------------------------------------*
INITIALIZATION.
button1 = 'Button 1'.
button2 = 'Button 2'.
MESSAGE 'initialization' TYPE 'I'.
*--------------------------------------------------------------*
*At Selection-Screen
*--------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sscrfields.
WHEN 'BUT1'.
MESSAGE 'Button 1 was clicked' TYPE 'I'.
WHEN 'BUT2'.
MESSAGE 'Button 2 was clicked' TYPE 'I'.
ENDCASE.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
START-OF-SELECTION.
MESSAGE 'start' TYPE 'I'.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
END-OF-SELECTION.
MESSAGE 'end' TYPE 'I'.
03-19-2014 8:49 AM
Hi Aabid,
The messages that are in the EVENTs: STAR-OF-SELECTION and END-OF-SELECTION, will be shown if you push the execute buttom.
For showing a popup message before the selection-screen, you should use the event LOAD-OF-PROGRAM. I have modified your code, have a look to it:
TABLES sscrfields.
*--------------------------------------------------------------*
*LOAD OF PROGRAM
*--------------------------------------------------------------*
LOAD-OF-PROGRAM.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
* TITEL = ' '
TEXTLINE1 = 'initialization'.
* TEXTLINE2 = ' '
* START_COLUMN = 25
* START_ROW = 6.
*--------------------------------------------------------------*
*Selection-Screen
*--------------------------------------------------------------*
SELECTION-SCREEN:
PUSHBUTTON /2(40) button1 USER-COMMAND but1,
PUSHBUTTON /2(40) button2 USER-COMMAND but2.
*--------------------------------------------------------------*
*Initialization
*--------------------------------------------------------------*
INITIALIZATION.
button1 = 'Button 1'.
button2 = 'Button 2'.
*--------------------------------------------------------------*
*At Selection-Screen
*--------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sscrfields.
WHEN 'BUT1'.
MESSAGE 'Button 1 was clicked' TYPE 'I'.
WHEN 'BUT2'.
MESSAGE 'Button 2 was clicked' TYPE 'I'.
ENDCASE.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
START-OF-SELECTION.
MESSAGE 'start' TYPE 'I'.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
END-OF-SELECTION.
MESSAGE 'end' TYPE 'I'.
Best Regards
03-19-2014 8:33 AM
what do you mean by this(highlighted)?
What I am trying to achieve is that I need to show a message box before any of the pushbuttons are displayed and a message box after the pushbuttons are displayed. Below is the code but does not seem to work once I run it.
03-19-2014 8:53 AM
Well in the above I have added 2 pushbuttons on the default screen that comes when I run the code. When I run it they get displayed and then once clicked the respective event is triggered and the message comes. But what I want is I want to show a message once the program loads completely this is basically to understand the sequence of the events in a screen programs as I am still having some doubts in it. As far as I know once the program is loaded completely to display anything after I must add the code in the START-OF-SELECTION yea ? hope you understood.
Thanks
03-19-2014 8:34 AM
Hi Aabid,
Something like this?
REPORT ZAABTEST6.
TABLES sscrfields.
DATA: flag.
SELECTION-SCREEN:
PUSHBUTTON /2(40) button1 USER-COMMAND but1,
PUSHBUTTON /2(40) button2 USER-COMMAND but2.
INITIALIZATION.
button1 = 'Button 1'.
button2 = 'Button 2'.
MESSAGE 'initialization' TYPE 'I'.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'BUT1'. flag = '1'.
WHEN 'BUT2'. flag = '2'.
ENDCASE.
sscrfields-ucomm = 'ONLI'.
START-OF-SELECTION.
MESSAGE 'start' TYPE 'I'.
CASE flag.
WHEN '1'. MESSAGE 'Button 1 was clicked' TYPE 'I'.
WHEN '2'. MESSAGE 'Button 2 was clicked' TYPE 'I'.
WHEN OTHERS.
ENDCASE.
MESSAGE 'end' TYPE 'I'.
Regards,
Luis
03-19-2014 9:01 AM
Hi Luis,
Appreciate the code a lot. Well from this I understood something else which is great but again what I am trying to do is understand the sequence of events that comes in a screen program. So all I want to do is prompt a message dialog once the whole screen is loaded I just want to know if I am to add it in the START-OF-SELECTION. event which I am done as you can see in the above code but it does appear once the screen is loaded.
Basically I need.
1. Run the program.
2. Then the pushbuttons will get created on the screen.
3. Once done prompt a message box telling for an eg: 'Program loaded' or something like that
thanks.
03-19-2014 9:17 AM
you can use AT SELECTION-SCREEN OUTPUT event for displaying message. try using a flag as it executes for all events also
data: lv_flag type flag. // this should be some global variable
AT SELECTION-SCREEN OUTPUT.
if lv_flag is initial.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Loaded Successfully'
txt1 = 'Loaded'
txt2 = 'Loaded1'.
lv_flag = 'x'.
endif.
03-19-2014 8:40 AM
Message in initialization is displayed in status bar. Its like a status message.
03-19-2014 8:45 AM
Hi,
You can use below code in event INITIALIZATION, then your issue will be resolved.
INITIALIZATION.
button1 = 'Button 1'.
button2 = 'Button 2'.
CALL FUNCTION 'POPUP_DISPLAY_MESSAGE'
EXPORTING
* TITEL =
msgid = 'Message ID'
msgty = 'I'
msgno = 'message Number'
* MSGV1 =
* MSGV2 =
* MSGV3 =
* MSGV4 =
* MESSAGE 'initialization' TYPE 'I'. (comment this line)
and pass the message to MSGV1,V2 and V3 what you want to display.
03-19-2014 8:46 AM
Hi,
I hope your code is working fine as displaying the message after clicking on the buttons. But I did not understand still what are you expecting?
Vijay
03-19-2014 8:49 AM
Hi Aabid,
The messages that are in the EVENTs: STAR-OF-SELECTION and END-OF-SELECTION, will be shown if you push the execute buttom.
For showing a popup message before the selection-screen, you should use the event LOAD-OF-PROGRAM. I have modified your code, have a look to it:
TABLES sscrfields.
*--------------------------------------------------------------*
*LOAD OF PROGRAM
*--------------------------------------------------------------*
LOAD-OF-PROGRAM.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
* TITEL = ' '
TEXTLINE1 = 'initialization'.
* TEXTLINE2 = ' '
* START_COLUMN = 25
* START_ROW = 6.
*--------------------------------------------------------------*
*Selection-Screen
*--------------------------------------------------------------*
SELECTION-SCREEN:
PUSHBUTTON /2(40) button1 USER-COMMAND but1,
PUSHBUTTON /2(40) button2 USER-COMMAND but2.
*--------------------------------------------------------------*
*Initialization
*--------------------------------------------------------------*
INITIALIZATION.
button1 = 'Button 1'.
button2 = 'Button 2'.
*--------------------------------------------------------------*
*At Selection-Screen
*--------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sscrfields.
WHEN 'BUT1'.
MESSAGE 'Button 1 was clicked' TYPE 'I'.
WHEN 'BUT2'.
MESSAGE 'Button 2 was clicked' TYPE 'I'.
ENDCASE.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
START-OF-SELECTION.
MESSAGE 'start' TYPE 'I'.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
END-OF-SELECTION.
MESSAGE 'end' TYPE 'I'.
Best Regards
03-19-2014 9:05 AM
Hi Adrian,
Exactly what I wanted. I just want to know if I can trigger a message box once all the pushuttons are displayed as well.
thanks.
03-19-2014 9:11 AM
Nice to help you,
If you mean to show the message popup when the buttons are shown, for that, you have to put the
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT' in the initialization event.
Best Regards.
03-19-2014 9:14 AM
03-19-2014 8:58 AM
Like this:
TABLES sscrfields.
*--------------------------------------------------------------*
*Selection-Screen
*--------------------------------------------------------------*
SELECTION-SCREEN:
BEGIN OF SCREEN 500 AS WINDOW TITLE title,
PUSHBUTTON /2(40) button1 USER-COMMAND but1,
PUSHBUTTON /2(40) button2 USER-COMMAND but2,
END OF SCREEN 500.
*--------------------------------------------------------------*
*Initialization
*--------------------------------------------------------------*
INITIALIZATION.
button1 = 'Button 1'.
button2 = 'Button 2'.
*--------------------------------------------------------------*
*At Selection-Screen
*--------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sscrfields.
WHEN 'BUT1'.
MESSAGE 'Button 1 was clicked' TYPE 'I'.
WHEN 'BUT2'.
MESSAGE 'Button 2 was clicked' TYPE 'I'.
ENDCASE.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
START-OF-SELECTION.
title = 'MY title'.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = 'MSG'
textline1 = 'message box BEFORE'
textline2 = 'pushbuttons are displayed'
start_column = 25
start_row = 6.
CALL SELECTION-SCREEN '0500'.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
END-OF-SELECTION.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = 'MSG'
textline1 = 'message box AFTER'
textline2 = 'pushbuttons are displayed'
start_column = 25
start_row = 6.
03-19-2014 9:11 AM
Hi Glen,
Yup something like this is what I wanted thanks a lot. When exiting after running the above code the following message is displayed as done in your code
" message box AFTER pushbuttons are displayed"
I want this message to come once the code is completely loaded.
so basically its like
1. run the code.
2. display message 'program loaded'.
3. once I click ok display the pushbuttons.
4. then display a message 'pushbuttons loaded' .
something like that ...
regards
03-19-2014 9:19 AM
I have made some modification in your code.Please check if it suits your requirement.
TABLES sscrfields.
*--------------------------------------------------------------*
*Selection-Screen
*--------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF SCREEN 9000 as window.
SELECTION-SCREEN:
PUSHBUTTON /2(40) button1 USER-COMMAND but1,
PUSHBUTTON /2(40) button2 USER-COMMAND but2.
selection-screen end of screen 9000 .
*--------------------------------------------------------------*
*Initialization
*--------------------------------------------------------------*
INITIALIZATION.
button1 = 'Button 1'.
button2 = 'Button 2'.
MESSAGE 'initialization' TYPE 'I'.
call SELECTION-SCREEN 9000 starting at 10 05.
*--------------------------------------------------------------*
*At Selection-Screen
*--------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sscrfields.
WHEN 'BUT1'.
MESSAGE 'Button 1 was clicked' TYPE 'I'.
WHEN 'BUT2'.
MESSAGE 'Button 2 was clicked' TYPE 'I'.
ENDCASE.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
START-OF-SELECTION.
MESSAGE 'start' TYPE 'I'.
*--------------------------------------------------------------*
*At START-OF-SELECTION
*--------------------------------------------------------------*
END-OF-SELECTION.
MESSAGE 'end' TYPE 'I'.
03-19-2014 9:28 AM
Hi Monami,
Not exactly what I want but really appreciate the effort .
thanks.