10-31-2007 12:13 PM
Hi people,
You could help me please.
1 - In this case, i have a simple program to download a itab contents. When i executing it on-line, saving in a local drive, the file is created normally, but when is executed in Background saving in a local drive too, the Job is terminated, but the file isn't created. In the end of this message have a example of the code.
2 - In other case, I have 1 program that executing in background too, the JOB aren't concluded and occurs Exception Error: UNKNOWN_ERROR.
Code Example for the 1. problem.
-
REPORT ZZ_TESTE .
tables: t030.
data: it_t030 LIKE t030 OCCURS 0 WITH HEADER LINE,
i_ktopl LIKE t030-ktopl,
v_tabix like sy-tabix.
data: begin of itab_t030 occurs 0.
include structure t030.
data: end of itab_t030.
selection-screen begin of block b1 with frame title text-001.
parameters: p_ktopl like t030-ktopl obligatory.
selection-screen end of block b1.
v_tabix = sy-tabix.
select ktopl
ktosl
bwmod
komok
bklas
konts
konth
FROM t030
INTO table it_t030
WHERE ktopl = p_ktopl.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\TESTE_FLAVIO.TXT'
FILETYPE = 'ASC'
DAT_MODE = space
TABLES
DATA_TAB = it_t030
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.
10-31-2007 6:58 PM
People,
Excuse me, but think that I didn't understand. I'm trying to save the file in my computer and not in the server. I can do it using Open Dataset in background ?
tks,
10-31-2007 12:18 PM
Hi,
In background the GUI_DOWNLOAD FM fails...so u have to use OPEN DATASET .so that ur file will be downloaded to application server....
Internal table to display error contracts .
i_error TYPE STANDARD TABLE OF t_error.
Declaration of local variables
DATA : lv_dsn3(1000) TYPE c,
lv_dsn4(1000) TYPE c.
IF NOT i_error IS INITIAL.
LOOP AT i_error INTO wa_error.
CONCATENATE wa_error-lifnr
wa_error-evart
wa_error-vedat
wa_error-ekorg
wa_error-ekgrp
wa_error-epstp
wa_error-knttp
wa_error-bukrs
wa_error-kdatb
wa_error-kdate
wa_error-ktwrt
wa_error-waers
wa_error-wkurs
wa_error-inco1
wa_error-inco2
wa_error-ihran
wa_error-angnr
wa_error-msg
INTO wa_input1 SEPARATED BY c_tab .
APPEND wa_input1 TO i_input1.
CLEAR : wa_input1,
wa_error.
ENDLOOP.
Move the contract error files to the application server
CONCATENATE v_fname1(15) lc_path1 p_aerfl1 INTO lv_dsn3.
OPEN DATASET lv_dsn3 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CHECK sy-subrc EQ 0.
LOOP AT i_input1 INTO wa_input1.
TRANSFER wa_input1 TO lv_dsn3.
ENDLOOP.
CLOSE DATASET lv_dsn3.
ENDIF.
Rewrad if helpful.
Regards,
Nagaraj
10-31-2007 12:20 PM
See some times there will be some authorizationproblems,becoz whn u use some server related areas,it will say this kind of error..Becoz u r telling tht it is not showing any error in foreground right...
It might be also one of the problem...
U can OOABAP,Use classes and methods from that classes to download..
Reward if useful
10-31-2007 12:21 PM
Hi,
Replace 'ASC' with 'DAT', Try
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\TESTE_FLAVIO.TXT'
FILETYPE = 'DAT'
DAT_MODE = space
TABLES
DATA_TAB = it_t030
Bye,
KC
10-31-2007 12:37 PM
In background you cannot access local gui property, cause there is no "local disk" nor Graphical User Interface.
Some ways to solve your problem :
- Use a dataset (on application server)
- Use ftp
Regards
10-31-2007 12:59 PM
10-31-2007 1:33 PM
10-31-2007 12:46 PM
Hi
gui_download will use URL to download file. it works only in frontend.
In background mode it can't read URL . SO you can't use gui_dwonload
If you are downloading from application server you can use open dataset statement.
10-31-2007 1:08 PM
Hi Flavio,
The recommended option is to download it on application server & then ask the user to transfer it manually to presentation server.
Transaction CG3Y & CG3Z are used for the same.
Please use OPEN DATASET to download file on application server.
Best regards,
Prashant
10-31-2007 6:58 PM
People,
Excuse me, but think that I didn't understand. I'm trying to save the file in my computer and not in the server. I can do it using Open Dataset in background ?
tks,
10-31-2007 7:12 PM
11-02-2007 7:04 AM
No you cannot save your file to your personal computer in background, except if YOUR PC is a FTP server....
Look at these blogs : <a href="/people/monalisa.biswal/blog/2007/06/28/download-in-background in Background</a> and <a href="/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap FTP Commands From ABAP</a>
Regards