Skip to Content
author's profile photo Former Member
Former Member

Event Parsing by ABAP interpreter

Hi all,

In my quest to improving my understanding of SAP ABAP, I have come accross a question, which is as follows:

When writing events such as Top-of-page, start-of-selection, etc. we do specify the name of the event & then write the processing statements.

However, there is no closing statement for the event unlike other structures/blocks like if..endif, module..endmodule, etc.

When the ABAP interpreter parses the code, how does it differentiate the statements to be included within the event block from the other following statements?

For example, how does the interpreter determine that the value assigment of SOME_INDICATOR is not to be processed in START-OF-SELECTION?

*******************************************************

  • S T A R T O F S E L E C T I O N E V E N T *

*******************************************************

START-OF-SELECTION.

DBCNT = -1.

SELECT

MATKL

MATNR

MEINS

MTART

MTPOS_MARA

INTO

CORRESPONDING FIELDS OF TABLE IT_MM

FROM

MARA.

DBCNT = SY-DBCNT.

*********************************************************

  • THIS BLOCK IS TO BE PROCESSED FOR INFORMATION DISPLAY *

*********************************************************

SOME_INDICATOR = 1.

WRITE 'TITLE OF THE REPORT COMES HERE'.

LOOP AT IT_MM.

WRITE: /1 IT_MM-MATNR , 17 SY-VLINE,

18 IT_MM-MTART , 32 SY-VLINE,

71 IT_MM-MEINS , 87 SY-VLINE,

88 IT_MM-MATKL , 103 SY-VLINE,

123 IT_MM-MTPOS_MARA , 141 SY-VLINE.

ENDLOOP.

How do I tell the interpreter to process a set of statements within a certain event block and leave out the rest?

Please clarify...

Regards,

Madhur

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 17, 2005 at 05:39 AM

    Hello Madhur,

    The following conditions terminate an Event Block.

    1. Beginning of the next event block.

    2. A Subroutine Definition.

    3. A Module Definition.

    Now, to answer your question, so long as an <i>executable</i> statement falls under an event block, you cannot ask the interpreter to ignore it.

    The only exception is to use the comment, but then a <i>comment</i> is not considered to be an <i>executable</i> statement !

    Regards,

    Anand Mandalika.

    Message was edited by: Poornanand Mandalika

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 17, 2005 at 05:48 AM

    Hi,

    You asked: How do I tell the interpreter to process a set of statements within a certain event block and leave out the rest?

    Well, the only way to tell the interpreter is to place your code in that event block. When the code is compiled and run, respective code segments are called from these events by the runtime. For leaving out a particular segment, you need to incorporate the logic in your program to skip a portion of code based on a particular condition being met.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.