DATA : cs_mara TYPE cursor,
wa_mara TYPE mara.
OPEN CURSOR cs_mara FOR
SELECT * FROM mara WHERE mtart = 'FERT' ORDER BY PRIMARY KEY.
DO.
FETCH NEXT CURSOR cs_mara INTO wa_mara.
IF sy-subrc <> 0.
CLOSE CURSOR cs_mara.
EXIT.
ENDIF.
WRITE: / wa_mara-mtart, wa_mara-matnr.
ENDDO.