Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in downloading PDF to local drive.

Former Member
0 Kudos

Hi all Gurus!

I have a rquirement like this.

I have created a Smart form for PO with driver program. It works fine. But one of my requirement is when ever I configure an output in Messages and save it an output should be trigerred at the same time and a copy of the output should get saved in the local drive in PDF format.

To make this I have written a logic in driver program after call function 'lf_fm_name'. In this logic I have derived the spool request of the output generated and using function module 'CONVERT_OTFSPOOLJOB_2_PDF' converted sppol to pdf.

Then using GUI_DOWNLOAD I downloaded this PDF format to local drive. But when i configure output and save it iam getting an error as 'Error in Control Frame work' .

Part of code for downloading PDF is as follows.

lt_spoolid = lw_job_output_info-spoolids.

read table lt_spoolid into lw_spoolid index 1.

***********************************************************

*Local constant declaration

if sy-uname = 'ZBABRAM' or

sy-uname = 'ZKARJAY'.

CONSTANTS: lc_printer TYPE char4 VALUE 'LOCL',

lc_char TYPE char1 VALUE ''.

DATA: i_pdf TYPE STANDARD TABLE OF tline,

wa_pdf type tline,

g_buffer type string,

i_mess TYPE STANDARD TABLE OF solisti1,

wa_mess TYPE solisti1,

i_mess_body TYPE STANDARD TABLE OF solisti1,

wa_mess_body TYPE solisti1.

*Spool number

IF lw_spoolid IS NOT INITIAL.

*Pass the Spool number and get the PDF data

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = lw_spoolid

NO_DIALOG = space

DST_DEVICE = 'LOCL'

PDF_DESTINATION = 'C:\FILE\ram.pdf'

  • IMPORTING

  • PDF_BYTECOUNT =

  • PDF_SPOOLID =

  • OTF_PAGECOUNT =

  • BTC_JOBNAME =

  • BTC_JOBCOUNT =

TABLES

PDF = i_pdf

  • EXCEPTIONS

  • ERR_NO_OTF_SPOOLJOB = 1

  • ERR_NO_SPOOLJOB = 2.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF sy-subrc IS INITIAL.

*Transfer the 132-long strings to 255-long strings

LOOP AT i_pdf INTO wa_pdf.

TRANSLATE wa_pdf USING ' ~'.

CONCATENATE g_buffer wa_pdf INTO g_buffer.

ENDLOOP.

TRANSLATE g_buffer USING '~ '.

DO.

wa_mess = g_buffer.

APPEND wa_mess TO i_mess.

SHIFT g_buffer LEFT BY 255 PLACES.

IF g_buffer IS INITIAL.

EXIT.

ENDIF.

ENDDO.

ENDIF.

ENDIF.

*Add the mail body

REFRESH i_mess_body.

wa_mess_body = text-052.

APPEND wa_mess_body TO i_mess_body.

*******************************************

TYPE-POOLS: ABAP.

DATA: fullpath TYPE String,

filename TYPE String,

path TYPE String,

user_action TYPE I,

encoding TYPE ABAP_ENCODING.

  • Binary download

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'C:\FILE\ram.pdf'

FILETYPE = 'BIN'

  • IMPORTING

    • FILELENGTH = length

TABLES

DATA_TAB = i_mess

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

ENDIF.

But the strange thing is when i schedule printing in background iam not getting any error and it gets saved to fiel as pdf.

4 REPLIES 4

Former Member
0 Kudos

When I do printing in fore ground I am getting this error message as 'Error in control frame work'. But in Background it works perfectly.

0 Kudos

Hi,

Check if you authorization to 'C:\ram\etc.pdf'

check out with just C:/ram.pdf drive and file name

santhosh

Edited by: Kaluvala Santhosh on Sep 29, 2008 12:45 PM

0 Kudos

Hi all,

It is not possible to download form to local driver in background(send Immedietly). The only way is to either download to application server or process in fore ground(Send by periodic job).

Thanks & Regards

Ramachandran Babu

Former Member
0 Kudos

Resolved myself