REPORT ZSAPN_APPLICATION_SERVER.

PARAMETERS FILE TYPE string DEFAULT 'testtemp.txt' .
PARAMETERS P_MTART TYPE MARA-MTART.

DATA IT_MARA TYPE TABLE OF MARA.
DATA WA_MARA TYPE MARA.
DATA LV_STRING TYPE STRING.
SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS
  WHERE MTART = P_MTART .
OPEN DATASET FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT IT_MARA INTO WA_MARA .

  CONCATENATE WA_MARA-MATNR WA_MARA-MTART WA_MARA-MEINS INTO LV_STRING.
  TRANSFER LV_STRING TO FILE.
ENDLOOP.

CLOSE DATASET FILE.

DATA LV_DATA TYPE STRING.

OPEN DATASET FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
  READ DATASET FILE INTO LV_DATA.
  IF SY-SUBRC <> 0.
  EXIT.
  ELSE.
  WRITE:/ LV_DATA.
  ENDIF.

ENDDO.
CLOSE DATASET FILE.
 
Serkan AKKAVAK
Computer Engineer
serkurumsal@yandex.com