Export in fisier text cu coloane lungime fixa
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
......................
LOOP AT TAB.
IND = IND + 1.
SUM = SUM + TAB-NET.
WRITE TAB-NAME1 TO T_NAME1+0(19).
WRITE '"' TO T_NAME1+19(1).
CONCATENATE '"' T_NAME1 INTO it_datatab-ROW.
WRITE ' ' TO it_datatab-ROW+21(1).
WRITE '" ' TO it_datatab-ROW+22(4).
WRITE TAB-STCD1 TO it_datatab-ROW+26(13).
WRITE '" "' TO it_datatab-ROW+39(3).
WRITE TAB-IBAN TO it_datatab-ROW+42(24).
WRITE '" "' TO it_datatab-ROW+66(3).
WRITE TAB-NET TO T_NET NO-GROUPING DECIMALS 0 RIGHT-JUSTIFIED.
* WRITE TAB-NET TO it_datatab-ROW+69(8) NO-GROUPING CURRENCY TAB-WAERS DECIMALS 0 RIGHT-JUSTIFIED.
CONCATENATE it_datatab-ROW T_NET INTO it_datatab-ROW.
WRITE '"' TO it_datatab-ROW+77(1).
APPEND it_datatab.
ENDLOOP.
CALL FUNCTION 'WS_FILENAME_GET'
* EXPORTING
* DEF_FILENAME = LD_FILENAME
* DEF_PATH = PATH
* MASK = ' '
* MODE = 'S'
* TITLE = ' '
IMPORTING
FILENAME = ld_filename
* RC =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
PERFORM SHOW_EXCEPTIONS USING SY-SUBRC.
ELSE.
PERFORM SHOW_EXCEPTIONS USING SY-SUBRC.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = LD_FILENAME
FILETYPE = 'DAT'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
CONFIRM_OVERWRITE = 'X'
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = it_datatab[]
* FIELDNAMES =
* 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.
0 Comments:
Post a Comment
<< Home