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

STOP KEYWORD

Former Member
0 Likes
2,284

Hi

what is the replacement keyword for STOP in OO Context

its giving mesg as

The STOP statement is not supported in the OO context.

thanks,

Hi

what is the replacement keyword for STOP in OO Context

its giving mesg as

The STOP statement is not supported in the OO context.

thanks,

11 REPLIES 11
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,713

hi Kiran,

Can depend on your requirement... what do you want to achieve?

thanks

ec

Read only

0 Likes
1,713

hI

IF I REPLACE EXIT KEYWORD IT'S GOING OUT OF FORM ROUTINE

THIS IF CONDITION IS IN FORM ROUTINE

FORM OPEN_DATA_SET.

IF NOT PR_UNIX1 IS INITIAL AND NOT PR_PC1 IS INITIAL.

OPEN DATASET PR_UNIX1 FOR INPUT IN BINARY MODE.

IF SY-SUBRC <> 0.

MESSAGE S206 WITH PR_UNIX1.

EXIT.

ENDIF.

ENDIF.

ENDFORM.

Read only

0 Likes
1,713

than you should place an ELSE somewhere...

FORM OPEN_DATA_SET.

IF NOT PR_UNIX1 IS INITIAL AND NOT PR_PC1 IS INITIAL.

OPEN DATASET PR_UNIX1 FOR INPUT IN BINARY MODE.

IF SY-SUBRC <> 0.

MESSAGE S206 WITH PR_UNIX1.

ELSE.

  • this will run if sy-subrc is 0

ENDIF.

ENDIF.

ENDFORM.

Read only

0 Likes
1,713

Can you be a bit clearer about the context of the code you are trying to write? - you mention that you want to replace "stop" in OO but the example you gave was a form not a method.

The main use I found for a "stop" within a report was to instantly pass control to the "end-of-selection" event e.g. if no data found after doing the a database selection. If this is the context of the code you are asking about, then you will probably need to recode this to set and pass a flag, e.g. "g_stop type sap_boolean" set to "X", and test this variable before executing each subsequent chunk of logic.

Jonathan

Read only

Former Member
0 Likes
1,713

Hi

IF SY-SUBRC <> 0.

MESSAGE S206 WITH PR_UNIX3.

STOP.

ENDIF.

Read only

0 Likes
1,713

replace with EXIT

Read only

0 Likes
1,713

IF SY-SUBRC <> 0 .

I WANT TO TERMINATE THE PROGRAM

HOW? WITHOUT USING STOP

Read only

0 Likes
1,713

try this

<b>LEAVE PROGRAM.</b>

Read only

Former Member
0 Likes
1,713

Hi KIran,

You can use CONTINUE statement.

Ex.

A loop pass is exited using CONTINUE if the loop index sy-index is an odd number.

DATA remainder TYPE i.

DO 20 TIMES.

remainder = sy-index MOD 2.

IF remainder <> 0.

CONTINUE.

ENDIF.

WRITE / sy-index.

ENDDO.

Regards,

Pritha.

Reward points if helpful.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,713

u can use exit, but u cant trigger end of selection.

Read only

Former Member
0 Likes
1,713

An interesting OO context if you're in a form...