0

I try to change the error message indicator from Warning to Error

I change my code from below:

message W101(ZPP) with 'PPTMEL' lv_value lw_resb-charg .

to

message E101(ZPP) with 'PPTMEL' lv_value lw_resb-charg .

However nothing change, hopefully can get some advise.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
NG SUIT YAN
  • 45
  • 1
  • 6
  • In what context do you create that message? Messages have different effects during different phases of program execution. It is also possible that you put that message into code which is executed as part of a SAP standard process in form of some customer exit, event function module, BAdI or whatever. In that case it is possible that any messages from the customer code get caught by the standard code, processed and reposted in some shape or form. That processing might override the message type. – Philipp Aug 02 '22 at 14:29

1 Answers1

2

You can specify that behavior with the DISPLAY LIKE addition.

Effect

When this addition is used, the icon of the message type specified in dtype is displayed instead of the associated icon. dtype expects a character-like data objects containing one of the values "A", "E", "I", "S", or "W" in uppercase letters.

For messages displayed in a dialog box by default, the short text is still displayed as a dialog box. Messages with the type "E" or "W" (except those for PBO and LOAD-OF-PROGRAM) are displayed as a dialog window if dtype contains "A" or "I". Messages with the type "S" are always displayed in the status bar, regardless of the dtype. The latter also applies to messages of the type "I" for PBO and LOAD-OF-PROGRAM. Messages of the type "X" always cause a runtime error.

Notes

The usage of this addition does not influence the behavior determined by the message type, but only the type of display.

Specifying "X" for dtype is not recommended, since no icon is assigned to this message type.

So in your case message E101(ZPP) with 'PPTMEL' lv_value lw_resb-charg display like 'E'.

SAP has a few unexpected handlings of messages which are described in the docu.

For example:

In list processing, a message of type "W" is always converted to type "E" before further context-dependent handling takes place. The message is then handled in accordance with the other context.

So without DISPLAY LIKE 'W' in your message statement your warning message would have a error icon. I assume something similar happens in your processing.

peterulb
  • 2,869
  • 13
  • 20