简体   繁体   English

如何使用ABAP在Windows中创建新文件?

[英]How do I create a new file in windows with ABAP?

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 ndf =作为文件名txt local =作为本地es_fich2 = as bd我的数据是wa_es_fich = as bd我的数据要保存在本地文件中

at the end... the file was not created... why? 最后......文件没有创建......为什么?

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). 注意:CL_GUI_FRONTEND_SERVICES直到7.02才发布供客户使用(我认为)。 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. 它应该仍然可以在早期版本上正常工作,但如果您使用的是早期版本并且需要使用已发布的对象,则FMs GUI_UPLOAD或GUI_DOWNLOAD将起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM