find the errors in the ABAP code and correct it.
*&---------------------------------------------------------------------*
*& Report ZBOM_READ_DATA
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZBOM_READ_DATA.


TYPE-POOLS:SLIS.
TYPES:BEGIN OF gty_type,
       MATNR type MATNR,
       WERKS TYPE WERKS_D,
       STLNR TYPE STNUM,
       STLAN TYPE STLAN,
       STLKN TYPE STLKN,
       STPOZ TYPE CIM_COUNT,
      END OF gty_type.


TYPES: BEGIN OF gty_mast,
       MATNR type MATNR,
       WERKS TYPE WERKS_D,
       STLAN TYPE STLAN,
       STLNR TYPE STNUM,
      END OF gty_MAST.

TYPES: BEGIN OF gty_stko,
         MATNR type MATNR,
         STLTY TYPE STLTY,
       END OF gty_stko.

TYPES: BEGIN OF gty_stpo,
        MATNR type MATNR,
        STPOZ TYPE CIM_COUNT,
        STLKN TYPE STLKN,
       END OF gty_stpo.

DATA: gt_mast TYPE TABLE OF gty_mast,
      gw_mast TYPE gty_mast,
      gt_stko TYPE TABLE OF gty_stko,
      gw_stko TYPE gty_stko,
      gt_stpo TYPE TABLE OF gty_stpo,
      gw_stpo TYPE gty_stpo,
      gt_type type table of gty_type,
      gw_type type gty_type,
      gv_matnr TYPE matnr,
      gd_repid     like sy-repid.

DATA:LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.


SELECT-OPTIONS:S_MATNR for gv_matnr.


SELECt  MATNR
       WERKS
       STLAN
       STLNR
  FROM MAST
  into TABLE gt_mast
  WHERE matnr in S_MATNR.


SELECT MATNR
       STLTY
     FROM STKO
     INTO TABLE gt_stko
     FOR ALL ENTRIES IN gt_mast
      WHERE MATNR = gt_mast-MATNR.


SELECT MATNR
       STPOZ
       STLKN
       FROM STPO
       INTO TABLE gt_stpo
        FOR ALL ENTRIES IN gt_stko
      WHERE MATNR = gt_stko-MATNR
        and STLTY = gt_stko-STLTY.


LOOP AT gt_mast INTO gw_mast.



LOOP AT gt_stko INTO gw_stko WHERE MATNR = gw_mast-matnr.

MOVE: gw_mast-MATNR to gw_type-MATNR,
       gw_mast-WERKS to gw_type-WERKS,
       gw_mast-STLAN to gw_type-STLAN,
       gw_mast-STLNR to gw_type-STLNR.

MOVE: gw_stko-stlty to gw_type-stlty.

LOOP AT gt_stpo INTO gw_stpo WHERE MATNR = gw_stko-matnr
                               and stlty = gw_stko-stlty.

MOVE: gw_stpo-stlkn to gw_type-STLKN.



APPEND gw_type to gt_type.


ENDLOOP.

ENDLOOP.
CLEAR: gw_mast,gw_type.

ENDLOOP.


LS_FIELDCAT-fieldname   = 'MATNR'.
  LS_FIELDCAT-seltext_m   = 'Material Number'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.

LS_FIELDCAT-fieldname   = 'WRRKS'.
  LS_FIELDCAT-seltext_m   = 'Plant'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.

  LS_FIELDCAT-fieldname   = 'STLAN'.
  LS_FIELDCAT-seltext_m   = 'BOM USAGE'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.

  LS_FIELDCAT-fieldname   = 'STLNR'.
  LS_FIELDCAT-seltext_m   = 'BILL OF MATERIAL'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.

  LS_FIELDCAT-fieldname   = 'STLTY'.
  LS_FIELDCAT-seltext_m   = 'BOM CATEGORY'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.

  LS_FIELDCAT-fieldname   = 'STLKN'.
  LS_FIELDCAT-seltext_m   = 'BOM item node number'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.

  LS_FIELDCAT-fieldname   = 'STPOZ'.
  LS_FIELDCAT-seltext_m   = 'Internal counter'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.

  LS_FIELDCAT-fieldname   = 'STLKN'.
  LS_FIELDCAT-seltext_m   = 'BOM item node number'.
  LS_FIELDCAT-col_pos     = 1.
  append LS_FIELDCAT to LT_FIELDCAT.
  clear  LS_FIELDCAT.


gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gd_repid
IT_FIELDCAT = LT_FIELDCAT
TABLES
T_OUTTAB = gt_type
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.