F Control Break Statement Program in SAP ABAP | CodeTheta

Control Break Statement Program in SAP ABAP

October 13, 2019

Code :
REPORT ZVP_CONTROL_BREAK.

TYPESBEGIN OF TY_MARC,
         MATNR TYPE MARC-MATNR,
         WERKS TYPE MARC-WERKS,
       END OF TY_MARC.

DATAIT_MARC TYPE TABLE OF TY_MARC,
      WA_MARC TYPE TY_MARC,
      WA_TEMP TYPE TY_MARC.


SELECT MATNR
       WERKS
  FROM MARC INTO TABLE IT_MARC UP TO 20 ROWS.
DELETE IT_MARC WHERE MATNR SPACE.

WRITE:'FULL TABLE'.
LOOP AT IT_MARC INTO WA_MARC.
  WRITE:/ SY-TABIX,
          WA_MARC-MATNR,
          WA_MARC-WERKS.
ENDLOOP.

WRITE:'AT FIRST'.
LOOP AT IT_MARC INTO WA_MARC.
  WA_TEMP WA_MARC.
  AT FIRST.
    WRITE:/ SY-TABIX,
              WA_TEMP-MATNR,
              WA_TEMP-WERKS.
  ENDAT.
ENDLOOP.

WRITE:'AT LAST'.
LOOP AT IT_MARC INTO WA_MARC.
  WA_TEMP WA_MARC.
  AT LAST.
    WRITE:/ SY-TABIX,
              WA_TEMP-MATNR,
              WA_TEMP-WERKS.
  ENDAT.
ENDLOOP.

WRITE:'AT NEW'.
LOOP AT IT_MARC INTO WA_MARC.
  WA_TEMP WA_MARC.
  AT NEW MATNR.
    WRITE:/ SY-TABIX,
              WA_TEMP-MATNR,
              WA_TEMP-WERKS.
  ENDAT.
ENDLOOP.

WRITE:'AT END OF'.
LOOP AT IT_MARC INTO WA_MARC.
  WA_TEMP WA_MARC.
  AT END OF MATNR.
    WRITE:/ SY-TABIX,
              WA_TEMP-MATNR,
              WA_TEMP-WERKS.
  ENDAT.
ENDLOOP.

Output :


IDE Used To Test This Code : SAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment