05-03-2011 10:35 AM
Dear forumers,
I will need to generate a pop-up message for a report with the following requirements:-
- If a combination of certain selection-screen elements are NOT filled up at the selection screen, generate pop-up message with two buttons, CONTINUE and CANCEL.
- This pop-up message should only be generated upon executing the report / via F8 key.
- The pop-up message must be displayed with the selection-screen still in the background.
- If the user clicks on CANCEL, the report will not be executed and the selection screen should be shown with all of its values intact as before.
- If the user clicks on CONTINUE, the report will be executed, eventually displaying an ALV output.
To achieve this, I used the function module, POPUP_TO_CONFIRM in the event, AT SELECTION-SCREEN but with the condition, SSCRFIELDS-UCOMM = 'ONLI'.
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'ONLI'.
IF R_MATNR IS INITIAL AND
( R_AUFNR IS INITIAL AND R_AUART IS INITIAL AND
P_SELID IS INITIAL AND R_OBJNR IS INITIAL AND
R_OUTDEL IS INITIAL AND R_QMNUM IS INITIAL AND
P_NTWK_L IS INITIAL AND P_ACTV_L IS INITIAL AND
P_NTWK_H IS INITIAL AND P_ACTV_H IS INITIAL AND
P_REVNR IS INITIAL AND R_POSTP IS INITIAL AND
R_COSTC IS INITIAL ).
CLEAR LV_ANSWER.
* display pop-up message
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = TEXT-095
TEXT_QUESTION = TEXT-096 " Performance-related text message
TEXT_BUTTON_1 = TEXT-097 " CONTINUE
TEXT_BUTTON_2 = TEXT-098 " CANCEL
DEFAULT_BUTTON = '2'
DISPLAY_CANCEL_BUTTON = ' '
IV_QUICKINFO_BUTTON_1 = TEXT-099
IV_QUICKINFO_BUTTON_2 = TEXT-098
IMPORTING
ANSWER = LV_ANSWER
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
* check return code
IF SY-SUBRC = 0.
IF LV_ANSWER <> '1'.
LEAVE SCREEN.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
Problem:
- A user runs the report for the first time, displaying the selection screen.
- He hits the 'Enter' key at any of the selection screen elements - nothing happens, no pop-up message appears.
- Once he hits the 'F8' key / executes the report and if a combination of certain selection-screen elements are NOT filled up at the selection screen, the pop-up message appears (with the selection screen in the background).
- If he chooses the CANCEL option, the report will not be executed and the selection screen is shown again with its values intact as before.
- But from this point onwards, whenever he hits the 'Enter' key at any of the selection screen elements again, the same pop-up message appears - it should only appear upon the 'F8' key / report execution only. How can I better control this?
05-03-2011 11:14 AM
Hi.,
Instead of SSCRFIELDS-UCOMM = 'ONLI' try using if sy-ucomm = 'ONLI' ...
hope it may help u.,
Thanks & Regards
Kiran
05-04-2011 4:11 AM
Dear Kiran,
Problem:
1. A user runs the report for the first time, displaying the selection screen.
2. He hits the 'Enter' key at any of the selection screen elements - nothing happens, no pop-up message appears.
3. Once he hits the 'F8' key / executes the report and if a combination of certain selection-screen elements are NOT filled up at the selection screen, the pop-up message appears (with the selection screen in the background).
4. If he chooses the CANCEL option, the report will not be executed and the selection screen is shown again with its values intact as before.
5. But from this point onwards, whenever he hits the 'Enter' key at any of the selection screen elements again, the same pop-up message appears - it should only appear upon the 'F8' key / report execution only. How can I better control this?
The problem with SY-UCOMM = 'ONLI' - this is true even in scenario 5 above. So, I still won't be able to better control the pop-up message too.
05-04-2011 4:31 AM
Hi.,
I think that still SSCRFIELDS-UCOMM holds that value., so clear SSCRFIELDS-UCOMM after popup message.
or
data ok_code type sy-ucomm.
ok_code = sy-ucomm.
if ok_code = 'ONLI'.
processing logic..
endif.
clear ok_code.
hope this will helps u.,
Also put a breakpoint , debug and check what value it holds.,
reply if u need some more clarifications.,
Thanks & Regards
Kiran
05-04-2011 9:22 AM