SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Obsolete Language Elements → Obsolete Processing of External Data → Contexts (Obsolete) →Contexts, message handling
The example illustrates how messages can be handled in contexts.
Source Code
REPORT demo_context_message.
DATA: c_from TYPE spfli-cityfrom,
c_to TYPE spfli-cityto.
CONTEXTS docu_test1.
DATA: context_inst TYPE context_docu_test1.
DATA: itab TYPE TABLE OF symsg,
line LIKE LINE OF itab.
SUPPLY carrid = 'XX'
connid = '400'
TO CONTEXT context_inst.
DEMAND cityfrom = c_from
cityto = c_to
FROM CONTEXT context_inst MESSAGES INTO itab.
IF sy-subrc NE 0.
line = itab[ 1 ].
MESSAGE ID line-msgid TYPE 'I' NUMBER line-msgno
WITH line-msgv1 line-msgv2 DISPLAY LIKE line-msgty.
ENDIF.
DEMAND cityfrom = c_from
cityto = c_to
FROM CONTEXT context_inst.
Description
First, the message handling is executed in the program which is achieved via the additon MESSAGES INTO of the statement DEMAND. The message is then available for further processing in the internal table itab. At the second DEMAND statement, the message handling is carried out by the system and the program cancels with an error message.