Posted By

qrist0ph on 10/19/10


Tagged

abap


Versions (?)

ABAP Write to file


 / Published in: Other
 

  1. FORM write_file.
  2. DATA lv_datei_result TYPE string.
  3. CONCATENATE '/SAPFTP/' sy-sysid '/KOND_VORERF_SCHIEF' INTO lv_datei_result.
  4. OPEN DATASET lv_datei_result FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  5. IF sy-subrc EQ 0.
  6. TRANSFER 'Ausgabe' TO lv_datei_result.
  7. CLOSE DATASET lv_datei_result.
  8. ENDIF.
  9. ENDFORM.
  10.  
  11. FORM write_file_advanced TABLES p_lt_result.
  12.  
  13. DATA: lv_str TYPE string,
  14. lv_datei_result TYPE string.
  15.  
  16. FIELD-SYMBOLS: <ls_line> TYPE ANY.
  17.  
  18. CONCATENATE '/SAPFTP/' sy-sysid '/AP00D040' INTO lv_datei_result.
  19.  
  20. OPEN DATASET lv_datei_result FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  21. IF sy-subrc EQ 0.
  22. LOOP AT p_lt_result ASSIGNING <ls_line>.
  23. TRANSFER <ls_line> TO lv_datei_result.
  24. ENDLOOP.
  25.  
  26. CLOSE DATASET lv_datei_result.
  27. ELSE.
  28. CLEAR lv_str.
  29. CONCATENATE 'Fehler beim Öffnen der Datei: ' lv_datei_result INTO lv_str SEPARATED BY space.
  30. MESSAGE lv_str TYPE 'E'.
  31. ENDIF.
  32.  
  33. ENDFORM.

Report this snippet  

You need to login to post a comment.