Tuesday, September 25, 2018

STOP CONTINUE STATEMENT IN SAP ABAP,

STOP: 


what will be the output of  using stop statement without end-of-selection
 in normal program. 
 
REPORT Ztest.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.

START-OF-SELECTION.
  SELECT * FROM MARA INTO TABLE IT_MARA UP TO 20 ROWS.
  STOP.

  LOOP AT IT_MARA INTO WA_MARA.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART.
  ENDLOOP.
 
 
ANSWER: NO OUTPUT.
 
IF WE WRITE END-OF-SELECTION THEN THIS CODE WILL WORK, AS IN THIS PARTICULAR 
CONDITION AFTER GETTING STOP, IT STOPS IT EXECUTE AND GOES TO ANOTHER BLOCK ,
IF USED INSIDE LOOP OR IF, THEY WOULD COME OUT OF THE LOOP.
 
 
 
REPORT ZTEST.
DATA: IT_MARA TYPE TABLE OF MARA,
      WA_MARA TYPE MARA.

START-OF-SELECTION.
  SELECT * FROM MARA INTO TABLE IT_MARA UP TO 20 ROWS.
  STOP.

END-OF-SELECTION.
  LOOP AT IT_MARA INTO WA_MARA.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART.
  ENDLOOP.
 

ANSWER: IT WILL SHOW THE DATA.



CONTINUE 

CONTINUE is a statement, which is used to skip execution of a record


inside loop.. endloop, do..endo, while..endwhile etc. This keyword can 
only be used inside the  loops.