Background processing
sy-batch = 'X'. "programul ruleaza in background.
In cazul in care prg. ruleaza in background si se doreste folosirea unei functii care in mod normal se foloseste la procesarea in foreground...
if not sy-batch is initial.
sy-batch = ' '.
wa_batch = 'X'.
endif.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
* CODEPAGE = ' '
filename = p_desc
filetype = 'DAT'
* HEADLEN = ' '
* LINE_EXIT = ' '
* TRUNCLEN = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* DAT_D_FORMAT = ' '
* IMPORTING
* FILELENGTH =
TABLES
data_tab = inserare
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0 .
message i999(zbc) with 'Eroare scriere fisier'.
else.
write: 'am scris in ' , p_desc.
ENDIF.
if wa_batch = 'X'.
sy-batch = 'X'.
endif.
Sau, se poate folosi:
DATA: p_fileName LIKE rlgrap-filename,
tmpMblnr(19) VALUE 'TEST-document.txt',
path(26) VALUE '\\network_pc\dataset_test\'.
* "network_pc" could also be an IP-address if you don't have DNS available.
CONCATENATE path tmpMblnr INTO p_fileName.
OPEN DATASET p_fileName FOR OUTPUT IN TEXT MODE. "vezi explicatie jos
LOOP AT FileTab INTO FileTabWa.
TRANSFER FileTabWa TO p_fileName.
ENDLOOP.
CLOSE DATASET p_fileName.
.....IN TEXT MODE
If you use this addition, the contents of the file are structured in lines. Each time you use the READ DATASET or TRANSFER statement, the system reads or writes a single line. If the data object to which you are transferring the data is too big, it is padded with spaces. If it is too small, the data record is truncated.
0 Comments:
Post a Comment
<< Home