Saturday, July 18, 2015

Continue Statement

The CONTINUE statement is used inside a loop only. When the program controller finds the CONTINUE statement it quits the current loop pass. Hence all other statements after the CONTINUE will not be executed inside that loop. The program controller then goes to the next loop iteration.

REPORT  zabap_gui.

* Declaring the local structure of internal table
TYPES:
      BEGIN OF ty_tab,
        item     TYPE char10,
        quantity TYPE i,
        price    TYPE i,
      END OF ty_tab.

* Declaring the Standard internal table with non unique key
DATA:
      itab TYPE STANDARD TABLE OF ty_tab,
      wtab TYPE ty_tab.

* Entering records to each field
wtab-item = 'Rice'. wtab-quantity = 2. wtab-price = 80.

* Now one single row has been fulfilled with data
* Next appending one single row data into the table
APPEND wtab TO itab.

wtab-item = 'Sugar'. wtab-quantity = 1. wtab-price = 90.
APPEND wtab TO itab.

wtab-item = 'Tea'. wtab-quantity = 1. wtab-price = 100.
APPEND wtab TO itab.

wtab-item = 'Rice'. wtab-quantity = 3. wtab-price = 150.
APPEND wtab TO itab.

wtab-item = 'Horlicks'. wtab-quantity = 1. wtab-price = 200.
APPEND wtab TO itab.

wtab-item = 'Sugar'. wtab-quantity = 2. wtab-price = 70.
APPEND wtab TO itab.

WRITE:  /3 'Item',
        13 'Quantity(KG)',
        28 'Price(Rs)'.
WRITE / '=========================================='.
SKIP. " Skipping one single line

LOOP AT itab INTO wtab.
  IF wtab-item = 'Rice'.

* Continue always moves to the next iteration of the loop   
    CONTINUE.
  ENDIF.

  WRITE:  /3 wtab-item,
          12 wtab-quantity,
          25 wtab-price.
  CLEAR wtab.
ENDLOOP.

SKIP.
WRITE '=========================================='.







Whenever the program controller finds Rice item it just ignores it and goes to next loop iteration. That is why Rice item is not coming to the output.

6 comments:

Anonymous said...

Informative Blog...For a long time I was craving for a career growth in programming and then I came to know that THE CREATING EXPERTS is the one who provide training with hands on training and real time scenarios

http://thecreatingexperts.com/sap-abap-training-in-chennai/

contact 8122241286

Unknown said...

Thanks for your info...Here THE CREATING EXPERTS provide hands on training with real time scenarios

http://thecreatingexperts.com/sap-abap-training-in-chennai/

contact +91-08122241286

Anonymous said...

Hi, I learned SAP Training in Chennai from THE CREATING EXPERTS. The training was good and i got selected in leading MNC company as SAP Consultant.

contact 8122241286

www.thecreatingexperts.com

Unknown said...

nice thank you for sharing grate info sap-hr online classes

Anonymous said...

thank you for great information
i have a question
how to exit from nested loop and continue from outher loop

thanks

Unknown said...


Thanks for sharing this Informative contentsap hr apap training