*----------------------------------------------------------------------* * DECLARATIONS * *----------------------------------------------------------------------* DATA: BEGIN OF gt_out OCCURS 0, bukrs LIKE BSEG-BUKRS, belnr LIKE BSEG-BELNR, gjahr LIKE BSEG-GJAHR, [...] END OF gt_out. *----------------------------------------------------------------------* * LAYOUT * *----------------------------------------------------------------------* PARAMETERS: pa_file TYPE STRING LOWER CASE. *----------------------------------------------------------------------* * FORM OUTPUT_XLS * *----------------------------------------------------------------------* FORM output_xls. DATA: BEGIN OF ls_fields, name(40), END OF ls_fields, lt_fields LIKE ls_fields OCCURS 0. DEFINE append_field. ls_fields-name = &1. APPEND ls_fields TO lt_fields. END-OF-DEFINITION. append_field 'FirstField'. [...] append_field 'LastField'. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING FILENAME = pa_file WRITE_FIELD_SEPARATOR = 'X' TRUNC_TRAILING_BLANKS = 'X' TABLES DATA_TAB = gt_out FIELDNAMES = lt_fields EXCEPTIONS FILE_WRITE_ERROR = 1 NO_BATCH = 2 GUI_REFUSE_FILETRANSFER = 3 INVALID_TYPE = 4 NO_AUTHORITY = 5 UNKNOWN_ERROR = 6 HEADER_NOT_ALLOWED = 7 SEPARATOR_NOT_ALLOWED = 8 FILESIZE_NOT_ALLOWED = 9 HEADER_TOO_LONG = 10 DP_ERROR_CREATE = 11 DP_ERROR_SEND = 12 DP_ERROR_WRITE = 13 UNKNOWN_DP_ERROR = 14 ACCESS_DENIED = 15 DP_OUT_OF_MEMORY = 16 DISK_FULL = 17 DP_TIMEOUT = 18 FILE_NOT_FOUND = 19 DATAPROVIDER_EXCEPTION = 20 CONTROL_FLUSH_ERROR = 21 OTHERS = 22. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. "output_xls
martedì 7 aprile 2015
Esportare un semplice file di Excel
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento