Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Messages

Former Member
0 Likes
1,299

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,211

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

13 REPLIES 13
Read only

Former Member
0 Likes
1,212

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

Read only

0 Likes
1,211

I assume that you are firing this message in the AT SELECTION-SCREEN event?

Regards,

Rich Heilman

Read only

0 Likes
1,211

i have tried.no results.

Read only

0 Likes
1,211

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

Read only

0 Likes
1,211

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.

Read only

0 Likes
1,211

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

Read only

0 Likes
1,211

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

Read only

0 Likes
1,211

thanks amit.

ricardo

Read only

0 Likes
1,211

<i>I assume that you are firing this message in the AT SELECTION-SCREEN event?</i>

I guess I shouldn't have asked his question, rather tell you to use the AT SELECTION-SCREEN event.

Have a good one.

Regards,

Rich Heilman

Read only

nishanthbhandar
Contributor
0 Likes
1,211

Check whether the error message is indeed coming from MESSAGE w000(zpd_teste_r).Put a break-point and check it.

Read only

Former Member
0 Likes
1,211

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.

Read only

0 Likes
1,211

What event are you firing this message at? Please post all of the code to the START-OF-SELECTION event.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,211

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!!