MichaelB.
7/25/2018 - 6:59 PM

Display a text MESSAGE

Provide feedback to the user Translatable to other languages Do not have to use literals, do not have to recompile the program every time they change Need to store messages in message class -> these classes get stored in DB table T100 To create new message use forward navigation or go to transaction SE91 Need to create message class first, with customer namespace rules (Start with Z) Leave messages button selected in SE91 Messages are not part of your program Have to fill in attributes first There are different message types: A, E, I, S, W, & X A: a termination message, message box is thrown up and the program terminates E: error message, tells user there is an error. Has a different effect depending on where you use it. In selection screen, processing of that event stops, message is displayed and user is able to amend their entry. At selection screen will fire again after they press execute. IF statement will test whether user entered the correct values. Error message will pop up as long as entry is incorrect. Error message outside of event, causes program to terminate. I: Information, message in dialog box. Once confirmed program continues. S: Status notification, message in dialog box. Once confirmed program continues and message appears in status bar of the next screen. W: Same as E, but pertains to warnings instead of errors X: No message is displayed, and program terminates with a short dump. Normally short dump occurs only when a runtime error occurs. X type messages allow you to force a program termination. WITH addition allows us to include 4 different operands or parameters that we can pass into our message. Can display value that user entered onto the screen. Need to have an error message that can accept parameters. & in error message will insert value user entered onto screen into message. i.e. (Employee Number & is too high). Check whether there are already message classes with message that you can use.

MESSAGE MessagetypeMessagenumber(Messageclass).


TABLES: zemployees.

DATA: wa_employee LIKE zemployees-employee.

PARAMETERS: my_ee    LIKE zemployees-employee DEFAULT '12345678' OBLIGATORY.

INITIALIZATION.

  SELECT * FROM zemployees.
    wa_employee = zemployees-employee.
  ENDSELECT.

AT SELECTION-SCREEN ON my_ee.
* Check to make sure the employee number is not greater than the
* last employee number in our table.
  IF my_ee > wa_employee.
    MESSAGE e000(zmes).
  ENDIF.
  
**********************************************************************************
* with entered parameter displaying on the screen

  IF my_ee > wa_employee.
    MESSAGE e001(zmes) WITH my_ee.
  ENDIF.