‎2006 May 26 4:25 PM
Hi,
I want to give a warning message but when i execute the program she acts like a error message.here's the code that i used:
CLEAR erro.
LOOP AT cidade.
TRANSLATE cidade-low TO UPPER CASE.
TRANSLATE cidade-high TO UPPER CASE.
IF cidade-sign <> 'I' OR cidade-option <> 'EQ'.
erro = 'X'.
DELETE cidade.
modify cidade.
ELSE.
MODIFY cidade.
ENDIF.
ENDLOOP.
LOOP AT nome.
TRANSLATE nome-low TO UPPER CASE.
TRANSLATE nome-high TO UPPER CASE.
MODIFY nome.
ENDLOOP.
if erro = 'X'.
MESSAGE w000(zpd_teste_r).
endif.
START-OF-SELECTION.
‎2006 May 26 4:27 PM
Hi Ricardo,
Try using this.
MESSAGE w000(zpd_teste_r) display like 'W'.
or
<b>MESSAGE s000(zpd_teste_r) display like 'E'.
This will give you the message as error but won't break the program.</b>
<b>Reward points if it helps.</b>
Regards,
Amit Mishra
Message was edited by: Amit Mishra
‎2006 May 26 4:27 PM
Hi Ricardo,
Try using this.
MESSAGE w000(zpd_teste_r) display like 'W'.
or
<b>MESSAGE s000(zpd_teste_r) display like 'E'.
This will give you the message as error but won't break the program.</b>
<b>Reward points if it helps.</b>
Regards,
Amit Mishra
Message was edited by: Amit Mishra
‎2006 May 26 4:30 PM
‎2006 May 26 4:33 PM
‎2006 May 26 4:36 PM
I assume that you are firing this message in the AT SELECTION-SCREEN event?
Regards,
Rich Heilman
i have a selection-screen but i don´t have the event AT selection-screen.
i have tried message w000(zpd_teste_ric) display lie 'W' and no results
‎2006 May 26 4:38 PM
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: numero FOR kna1-kunnr,
nome FOR kna1-name1,
cidade FOR kna1-ort01.
SELECTION-SCREEN END OF BLOCK b1.
CLEAR erro.
LOOP AT cidade.
TRANSLATE cidade-low TO UPPER CASE.
TRANSLATE cidade-high TO UPPER CASE.
IF cidade-sign <> 'I' OR cidade-option <> 'EQ'.
erro = 'X'.
DELETE cidade.
modify cidade.
ELSE.
MODIFY cidade.
ENDIF.
ENDLOOP.
LOOP AT nome.
TRANSLATE nome-low TO UPPER CASE.
TRANSLATE nome-high TO UPPER CASE.
MODIFY nome.
ENDLOOP.
if erro = 'X'.
MESSAGE w000(zpd_teste_r).
endif.
START-OF-SELECTION.
SELECT kunnr name1 stras ort01
FROM kna1
APPENDING CORRESPONDING FIELDS OF TABLE t_report.
LOOP AT t_report.
IF t_report-kunnr NOT IN numero OR t_report-name1 NOT IN nome OR
t_report-ort01 NOT IN cidade.
DELETE t_report.
ENDIF.
ENDLOOP.
SORT t_report ASCENDING BY kunnr.
PERFORM gui_download.
PERFORM gui_upload.
PERFORM alv_list.
PERFORM handle_user_command USING r_ucomm rs_selfield.
‎2006 May 26 4:41 PM
Find the modified code. Add <b>AT-SELECTION-SCREEN.</b> to your code as below.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: numero FOR kna1-kunnr,
nome FOR kna1-name1,
cidade FOR kna1-ort01.
SELECTION-SCREEN END OF BLOCK b1.
<b>AT-SELECTION-SCREEN.</b>
CLEAR erro.
LOOP AT cidade.
TRANSLATE cidade-low TO UPPER CASE.
TRANSLATE cidade-high TO UPPER CASE.
IF cidade-sign <> 'I' OR cidade-option <> 'EQ'.
erro = 'X'.
DELETE cidade.
modify cidade.
ELSE.
MODIFY cidade.
ENDIF.
ENDLOOP.
LOOP AT nome.
TRANSLATE nome-low TO UPPER CASE.
TRANSLATE nome-high TO UPPER CASE.
MODIFY nome.
ENDLOOP.
if erro = 'X'.
MESSAGE w000(zpd_teste_r).
endif.
START-OF-SELECTION.
SELECT kunnr name1 stras ort01
FROM kna1
APPENDING CORRESPONDING FIELDS OF TABLE t_report.
LOOP AT t_report.
IF t_report-kunnr NOT IN numero OR t_report-name1 NOT IN nome OR
t_report-ort01 NOT IN cidade.
DELETE t_report.
ENDIF.
ENDLOOP.
SORT t_report ASCENDING BY kunnr.
PERFORM gui_download.
PERFORM gui_upload.
PERFORM alv_list.
PERFORM handle_user_command USING r_ucomm rs_selfield.
Message was edited by: Amit Mishra
‎2006 May 26 4:45 PM
Ok, I stripped out some stuff to your program which is not necessary for me to test. But what I've found is that your code is not inside of an event. Which is causing the problem. You need to put that logic with the message inside of the AT SELECTION-SCREEN event. See the following program as it is now throwing the warning and working good.
report zrich_0001.
tables: kna1.
data: erro(1) type c.
selection-screen begin of block b1 with frame.
select-options: numero for kna1-kunnr,
nome for kna1-name1,
cidade for kna1-ort01.
selection-screen end of block b1.
<b>at selection-screen.</b>
clear erro.
erro = 'X'.
if erro = 'X'.
message w000(01) with 'Hey, there'.
endif.
start-of-selection.
write:/ 'This LIst'.
Regards,
Rich Heilman
‎2006 May 26 4:57 PM
‎2006 May 26 5:00 PM
‎2006 May 26 4:28 PM
Check whether the error message is indeed coming from MESSAGE w000(zpd_teste_r).Put a break-point and check it.
‎2006 May 26 4:31 PM
Yes i allready did that and when it comes to that code line is when he guives the error message with the text i defined bur instead of a warning gives an error and break the program, and i don't want to break the program.
‎2006 May 26 4:35 PM
‎2006 May 26 5:09 PM
Hi Ricardo,
You need to put selection screen validation in at selection screen event.
E.g.
at selection-screen.
clear erro.
loop at cidade.
translate cidade-low to upper case.
translate cidade-high to upper case.
if cidade-sign <> 'I' or cidade-option <> 'EQ'.
erro = 'X'.
delete cidade.
modify cidade.
else.
modify cidade.
endif.
endloop.
loop at nome.
translate nome-low to upper case.
translate nome-high to upper case.
modify nome.
endloop.
if erro = 'X'.
MESSAGE w000(zpd_teste_r).
endif.
Cheers,
Vikram
Please reward for helpful replies!!