Question

this is my code

IF sy-ucomm = 'BTNL'.

    CONCATENATE 'C:\Users\moreiramm\Downloads\' ndf '.txt'
    INTO local.

    OPEN DATASET local FOR APPENDING IN TEXT MODE ENCODING DEFAULT.

    LOOP AT es_fich2 INTO wa_es_fich.
      IF sy-subrc = 0.
        TRANSFER wa_es_fich TO local.
        MESSAGE 'O ficheiro foi guardado no directório "C:\Users\moreiramm\Downloads" com sucesso' TYPE 'S' DISPLAY LIKE 'I'.
      ELSE.
        MESSAGE 'O ficheiro nâo foi guardado com sucesso. Repita os passos.' TYPE 'S' DISPLAY LIKE 'I'.
      ENDIF.
    ENDLOOP.

    CLOSE DATASET local.

  ELSE.

(...)

ndf = as the name of the file txt local = as the local es_fich2 = as bd where my data is wa_es_fich = as bd where my data is to save in the local file

at the end... the file was not created... why?

Was it helpful?

Solution

OPEN DATASET

is for creating server files.

Use the class:

CL_GUI_FRONTEND_SERVICES

for local file writing.

Note: CL_GUI_FRONTEND_SERVICES is not released for customer use until 7.02 (I think). It should still work fine on earlier versions, but if you are on an earlier version and are required to use released objects, the FMs GUI_UPLOAD or GUI_DOWNLOAD will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top