10-13-2005 6:21 PM
Hi,
I have to display an information message if company code 3000 is chosen.
So, I have used MESSAGE-ID I000 with.......
Now, in the window, if i click on continue(tick icon) then i should get my output
which I am able to do that part.
the problem is that : if I click on cancel (cross icon) , then i should go to the selection
screen ,rather than going to the report.
Can anyone please let me know how to do this?
Thanks
10-13-2005 6:38 PM
You can also use the POPUP_TO_CONFIRM_WITH_MESSAGE function module.
http://help.sap.com/saphelp_bw31/helpdata/en/85/dae5024bac11d1890e0000e8322f96/content.htm
This way you can check which button the user chooses and control the flow.
Brad
10-13-2005 6:27 PM
10-13-2005 6:28 PM
10-13-2005 6:37 PM
Hi Rich,
The code is likee this:
parameters: pcode like t001-bukrs.
if p_code = '3000'.
MESSAGE ID 'DB' TYPE 'I' NUMBER '000'
WITH 'CC = 3000 is for ABC Process'
ENDIF.
Now, i get a window saying " CC = 3000 is for ABC Process"
In this window,if i click on continue then it goes to the output, which i want.
The problem is that in this window if i click on cancel or crosss icon then it goes to the output which i dont want.
when clicked on cancel icon in the information window ,it should go to the selection screen.
Please let me know if you want more information.
Thanks
10-13-2005 6:38 PM
You can also use the POPUP_TO_CONFIRM_WITH_MESSAGE function module.
http://help.sap.com/saphelp_bw31/helpdata/en/85/dae5024bac11d1890e0000e8322f96/content.htm
This way you can check which button the user chooses and control the flow.
Brad
10-13-2005 6:41 PM
Hi JD,
You cannot achieive what you are trying to achieve with
MESSAGE I001...
The program will only flow past this statement , no matter whatever you click on popup window.
You should use function POPUP_TO_CONFIRM instead and analyze the parameter "ANSWER" in your program to check the user action. See the FM documentation for help.
Cheers
10-13-2005 6:44 PM
I'm wondering what version of SAP you are on that you are getting a dialog box with a "green check" and a "red cancel" button by the following code.
parameters: pcode like t001-bukrs.
if p_code = '3000'.
MESSAGE ID 'DB' TYPE 'I' NUMBER '000'
WITH 'CC = 3000 is for ABC Process'
ENDIF.
I get the standard information message box with a green check, no red cancel button.
Regards,
Rich Heilman
10-13-2005 6:49 PM
Here is a quick and dirty program
REPORT ztest1 .
TABLES: sscrfields.
DATA v_answer.
PARAMETERS: pcode LIKE t001-bukrs.
AT SELECTION-SCREEN.
IF pcode = '3000'.
CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
EXPORTING
* DEFAULTOPTION = 'Y'
diagnosetext1 = 'CC = 3000 is for ABC Process'
* DIAGNOSETEXT2 =
* DIAGNOSETEXT3 = ' '
textline1 = 'Do you wish to Continue? '
* TEXTLINE2 = ' '
titel = 'Message'
* START_COLUMN = 25
* START_ROW = 6
* CANCEL_DISPLAY = 'X'
IMPORTING
answer = v_answer .
IF v_answer = 'J'.
*-- Yes
sscrfields-ucomm = 'ONLI'.
ELSE.
CLEAR sscrfields-ucomm.
ENDIF.
ENDIF.
START-OF-SELECTION.
WRITE:/ 'I started executing the program!!'.
Srinivas
10-13-2005 6:50 PM
You can do something like this....
report zrich_0002 .
parameters: pcode like t001-bukrs.
data: answer(1) type c.
start-of-selection.
if pcode = '3000'.
call function 'POPUP_WITH_2_BUTTONS_TO_CHOOSE'
exporting
* DEFAULTOPTION = '1'
diagnosetext1 = 'Information'
* DIAGNOSETEXT2 = ' '
* DIAGNOSETEXT3 = ' '
textline1 = 'CC = 3000 is for ABC Process'
* TEXTLINE2 = ' '
* TEXTLINE3 = ' '
text_option1 = 'Ok'
text_option2 = 'Cancel'
titel = 'Information Message'
importing
answer = answer.
if answer = '2'.
stop.
endif.
endif.
write:/ pcode.
Regards,
Rich Heilman
10-13-2005 6:50 PM
Rich,
I guess he is referring to the Cross at the top right corner i.e. to close a window.
Cheers.
10-13-2005 6:53 PM
I like this function module better than my previous post.
report zrich_0002 .
parameters: pcode like t001-bukrs.
data: answer(1) type c.
at selection-screen.
if pcode = '3000'.
call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'
exporting
diagnosetext1 = 'CC = 3000 is for ABC Process'
textline1 = 'Do you wish to Continue? '
titel = 'Message'
importing
answer = answer.
if answer <> 'J'.
* stop.
endif.
endif.
start-of-selection.
write:/ pcode.
Oh, Srinivas already mentioned it.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
10-13-2005 6:53 PM
Also, we cannot do it in the start-of-selection event because, he wants to go to the selection screen if the user cancels it. That is why I did it in the selection-screen event.
Srinivas
10-20-2005 8:27 PM
HI Srinivas:
When I had used your code and in selection screen for the field in Ranges
when i changed the value 2000 to 3000 i did get the
confirmed message but i have to click "yes" or "no" twice.
did you face anything like this?
This happens only in Multiple selection window.
This does not happen in the selection screen.
10-20-2005 8:39 PM
Sorry, I didn't get that. I thought your selection screen variable is a parameter. Is it a select-option? Can you give the code you have including the definition of the selection-screen?
Having a range will complicate the matter. What do you want to do if the user enters 1000, 2000, 3000 as single values. Do you issue message or not? What if the user enters a range 0001 to 9999? Do you issue the message or not?
Srinivas
10-21-2005 4:28 PM
Hi Srinivas:
Sorry for not giving the details before.
My code is like this:
SELECT-OPTIONS: P_BUKRS LIKE T001-BUKRS
AT SELECTION-SCREEN ON P_BUKRS.
CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
EXPORTING
DEFAULTOPTION = 'Y'
DIAGNOSETEXT1 = 'company Code 3000 is for'
TEXTLINE1 = 'Do you wish to Continue ?'
TITEL = 'Company Code'
IMPORTING
ANSWER = ANSWER.
IF ANSWER = 'N'.
leave program.
ENDIF.
Now, in the selection screen for company code, in the "Multiple Selection for Company Code" window:
the first one i give as : 2000 To 3000
Second LIne : 3001 To 4000
Currently , when i click on No, it comes out of the selection screen.
I did try using STOP also but it dumps.
My requirement is like : When clicked on No, it should not do any change and go back to the
selection screen where i can edit again.
Thanks
10-21-2005 4:36 PM
report zrich_0002.
data: answer(1) type c.
parameters: p_bukrs type t001-bukrs.
<b>
at selection-screen.</b>
call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'
exporting
defaultoption = 'Y'
diagnosetext1 = 'company Code 3000 is for'
textline1 = 'Do you wish to Continue ?'
titel = 'Company Code'
importing
answer = answer.
if answer = 'N'.
<b>exit.</b>
endif.
REgards,
Rich Heilman
10-21-2005 4:44 PM
Hi Rich,
in my code: company code is not a paramter. its select-option. when i used exit in the code
and clicked on No, then it executed the program which i dont want.
When clicked on No, it should remain in the selection screen.
Thanks
10-21-2005 5:03 PM
My question is, if you have 3000 anywhere in your select-option, whether it is the low value, or high value or in between, you want this pop-up? Here are different scenarios
1) if you enter 1000 to 5000(3000 is in the range) or
2) if you enter 1000 to 3000(3000 is high value) or
3) if you enter 3000 to 5000(3000 is low value) or
4) if you enter <>3000(3000 is excluded from the list)
Which conditions do you want to raise the pop-up?
Srinivas
10-21-2005 5:08 PM
Hi Srinivas:
Its like if I get 3000 anywhere then i want this pop up.
Thanks
10-21-2005 5:14 PM
Here is the modified code.
REPORT ztest1 .
TABLES: sscrfields.
DATA: v_answer,
v_bukrs LIKE t001-bukrs.
DATA: BEGIN OF itab_bukrs OCCURS 0,
bukrs LIKE t001-bukrs.
DATA: END OF itab_bukrs.
SELECT-OPTIONS: s_bukrs FOR v_bukrs.
AT SELECTION-SCREEN.
IF sscrfields-ucomm = 'ONLI'.
*-- execute this code only if the user presses F8
SELECT bukrs INTO TABLE itab_bukrs
FROM t001
WHERE bukrs IN s_bukrs.
SORT itab_bukrs BY bukrs.
READ TABLE itab_bukrs WITH KEY bukrs = '3000' BINARY SEARCH.
IF sy-subrc = 0.
*-- 3000 is used
CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
EXPORTING
* DEFAULTOPTION = 'Y'
diagnosetext1 = 'CC = 3000 is for ABC Process'
* DIAGNOSETEXT2 =
* DIAGNOSETEXT3 = ' '
textline1 = 'Do you wish to Continue? '
* TEXTLINE2 = ' '
titel = 'Message'
* START_COLUMN = 25
* START_ROW = 6
* CANCEL_DISPLAY = 'X'
IMPORTING
answer = v_answer .
IF v_answer = 'J'.
*-- Yes
sscrfields-ucomm = 'ONLI'.
ELSE.
CLEAR sscrfields-ucomm.
ENDIF.
ENDIF.
ENDIF.
START-OF-SELECTION.
WRITE:/ 'I started executing the program!!'.
10-21-2005 5:21 PM
report zrich_0002.
tables: t001.
data: answer(1) type c.
select-options: s_bukrs for t001-bukrs.
start-of-selection.
* Do your checks against the select option here.
* If there is the condition, then pop the message.
call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'
exporting
defaultoption = 'Y'
diagnosetext1 = 'company Code 3000 is for'
textline1 = 'Do you wish to Continue ?'
titel = 'Company Code'
importing
answer = answer.
if answer = 'N'.
exit.
endif.
* Still here, then execute the rest of the program.
write:/ 'the program is executed'.
Regards,
Rich HEilman
10-21-2005 7:26 PM
Hi Srinivas:
I did use your code and it worked for F8. Thanks
But my problem is with the background.
The details are:
in the selection screen:
entered the company code 3000 and
Program->Execute in Background
now i get a pop up message which is okay.
if i click on no then it remains in the selection screen -- which is good
if i click on yes then it executes the program instead of giving me the background print paramters
window.
10-21-2005 7:41 PM
Did you use my code as it is? I am asking because, that code will not work for 'Execute in Background'. If you need the pop-up for that as well, then you need to change it this way.
REPORT ztest1 .
TABLES: sscrfields.
DATA: v_answer,
v_bukrs LIKE t001-bukrs.
DATA: BEGIN OF itab_bukrs OCCURS 0,
bukrs LIKE t001-bukrs.
DATA: END OF itab_bukrs.
SELECT-OPTIONS: s_bukrs FOR v_bukrs.
AT SELECTION-SCREEN.
IF sscrfields-ucomm = 'ONLI' OR
sscrfields-ucomm = 'SJOB'.
*-- execute this code only if the user presses F8
SELECT bukrs INTO TABLE itab_bukrs
FROM t001
WHERE bukrs IN s_bukrs.
SORT itab_bukrs BY bukrs.
READ TABLE itab_bukrs WITH KEY bukrs = '0103' BINARY SEARCH.
IF sy-subrc = 0.
*-- 3000 is used
CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
EXPORTING
* DEFAULTOPTION = 'Y'
diagnosetext1 = 'CC = 3000 is for ABC Process'
* DIAGNOSETEXT2 =
* DIAGNOSETEXT3 = ' '
textline1 = 'Do you wish to Continue? '
* TEXTLINE2 = ' '
titel = 'Message'
* START_COLUMN = 25
* START_ROW = 6
* CANCEL_DISPLAY = 'X'
IMPORTING
answer = v_answer .
IF v_answer = 'J'.
*-- Yes, leave the ucomm as it is
ELSE.
CLEAR sscrfields-ucomm.
ENDIF.
ENDIF.
ENDIF.
START-OF-SELECTION.
WRITE:/ 'I started executing the program!!'.
10-13-2005 7:02 PM
Hi JD,
rich srinivas sanjay all are correct
try this way....
DATA: POPUP_TXT(200).
DATA: ANSWER(1).
Start-of-selection.
if pcode eq '0003'.
POPUP_TXT =' Do you really want continue.'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Save'
TEXT_QUESTION = POPUP_TXT
TEXT_BUTTON_1 = 'Yes'
ICON_BUTTON_1 = 'ICON_OKAY'
TEXT_BUTTON_2 = 'No'
ICON_BUTTON_2 = 'ICON_CANCEL'
DEFAULT_BUTTON = '2'
* DISPLAY_CANCEL_BUTTON = ' '
START_ROW = 15
IMPORTING
ANSWER = ANSWER.
IF ANSWER EQ '2'.
exit.
endif.
ENDIF.
reward points for helpfull answers and close the thread if your question is solved.
regards,
venu.
10-13-2005 7:35 PM
Hi Guys,
Thanks for the answers. The problem is solved.
Really appreciate to all who participated in this thread.
I did award the points.
Thank You very much. !!!