‎2008 Apr 22 9:54 AM
Hi all experts,
Please help. I've been on it for days and I can't seem to find any solution. Here's the scenario,
1. I get all the finished status spool in table TBTCO.
2. Match with TBTCP to get the spool number.
3. Open the graphical display of the spool to get the office
code using FM RSPO_RETURN_ABAP_SPOOLJOB.
4. Create a folder in the presentation folder for that office
code.
5. Create a pdf output for that spool.
6. Save all pdf output with the same office codes in the
created the presentation folder.
My problem is that an error keeps popping out. It says "Error calling Data provider". Maybe it's because I do it in background process, but I have to because if I don't, I get an "ABAP Runtime error." O please help me. Below are the FMs I used.
LOOP AT itab.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = itab-sp_numb
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
AT NEW sp_name.
CONCATENATE: p_file itab-sp_name '\' INTO p_file.
ENDAT.
AT NEW br_code.
PERFORM get_brcode.
CONCATENATE: p_file brc '\' INTO p_file.
ENDAT.
AT NEW dumon.
CONCATENATE: p_file itab-dumon '\' INTO p_file.
ENDAT.
IF sy-subrc = 0.
IF p_pres EQ 'X'.
MOVE p_file TO lv_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_file
filetype = 'BIN'
TABLES
data_tab = it_pdf_output.
IF sy-subrc <> 0.
MESSAGE e398(00) WITH 'Error creating file' p_file.
ELSE.
MESSAGE i398(00) WITH 'File Created' p_file.
ENDIF.
ELSE.
APPEND LINES OF it_pdf_output TO lt_conv.
IF lt_conv[] IS NOT INITIAL.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
LOOP AT lt_conv INTO lv_string.
TRANSFER lv_string TO p_file.
ENDLOOP.
CLOSE DATASET p_file.
IF sy-subrc EQ 0.
MESSAGE i398(00) WITH 'File Created' p_file.
ELSE.
MESSAGE e398(00) WITH 'Error closing file' p_file.
ENDIF.
ELSE.
MESSAGE e398(00) WITH 'Error creating file' p_file.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
Points will be rewarded to the best answer. Points will also be to those who bothered. Thanks a lot.
Anna
‎2008 Apr 22 11:49 AM
Hi,
The problems comes from the use of function module GUI_DOWNLOAD. You can't use it in background .
If you want to download the file in background use Abap Instruction "OPEN DATASET" and so on. I suggest you to use also Logical File it's a better solution .
Hope this help you
Regards
‎2008 Apr 22 11:49 AM
Hi,
The problems comes from the use of function module GUI_DOWNLOAD. You can't use it in background .
If you want to download the file in background use Abap Instruction "OPEN DATASET" and so on. I suggest you to use also Logical File it's a better solution .
Hope this help you
Regards