2009 Sep 18 6:07 PM
Hi All,
I have executed a job and converted the spool into a PDF file. Now I have to write a logic that would upload the pdf file to the application server. Is it possible, if yes kindly advise as to how to proceed on this?
Thanks in Advance...
Pablo
2009 Sep 18 6:31 PM
using XML parser you can read the values from it and save as per your need.
2009 Sep 18 6:19 PM
Hi,
hmm...Its not possible to upload a PDF to application server.
But rather, instead of converting the spool to PDF, convert it to text using func module: RSPO_RETURN_SPOOLJOB and upload it in app.server.
Hope this helps.
Regards,
Subramanian
2009 Sep 18 9:48 PM
hmm...Its not possible to upload a PDF to application server.
What makes you think that? A PDf is just a collection of binary data and it can be written to the app server in the normal manner...
2009 Sep 19 3:07 PM
Hi Subramanian PL,
this is an interesting statement:
"hmm...Its not possible to upload a PDF to application server."
We do it all the time using the BDS/GOS business document services(generic object services.
There is so much information available, i.e. see [Generic object services (GOS)|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3414900)ID0296261850DB11388102312450677412End?blog=/pub/wlg/3399#thread]
Kind regards,
Clemens
2009 Sep 18 6:31 PM
using XML parser you can read the values from it and save as per your need.
2009 Sep 18 6:59 PM
Can you please let me know of the Steps involved? I am not aware of mechanism of uploading a PDF file on Application Server using XML Parser.
Thanks
Pablo
2009 Sep 18 7:12 PM
XML parsing will read the fields for you from the pdf data(after a gui_upload)
and then store these values in come variables and store these variables or tables to server.
please search in sdn. there are many posts on parsing pdf data
2009 Sep 18 8:56 PM
Hi,
This can be done directly by using OPEN DATASET in BINARY MODE. Check this sample
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
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.
data: filename(30) type c value '\user\temp\file.pdf'. " Application server path
open dataset filename for output in binary mode.
if sy-subrc = o.
loop at it_pdf_output.
transfer it_pdf_output-tdformat to filename.
transfer it_pdf_output-tdline to filename.
endif.
endloop.
Regards,
Vikranth
2009 Sep 19 12:06 PM
HI Pablo,
Try this way. It works.Do not worry about what is there in i_pdf. Because it contains binary data.
Thanks, Venkat.O
REPORT ZTEST_NOTEPAD.
DATA:L_LAY TYPE PRI_PARAMS-PAART,
L_LINES TYPE PRI_PARAMS-LINCT,
L_COLS TYPE PRI_PARAMS-LINSZ,
L_VAL TYPE C,
LW_PRIPAR TYPE PRI_PARAMS,
LW_ARCPAR TYPE ARC_PARAMS,
SPOOLID LIKE TSP01-RQIDENT.
I_PDF TYPE STANDARD TABLE OF TLINE.
PARAMETERS :P_FILE(60) TYPE C DEFAULT './pdfdata.pdf'.
START-OF-SELECTION.
L_LAY = 'X_65_132'.
L_LINES = 65.
L_COLS = 132.
"Read, determine, change spool print parameters and archive parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
IN_ARCHIVE_PARAMETERS = LW_ARCPAR
IN_PARAMETERS = LW_PRIPAR
LAYOUT = L_LAY
LINE_COUNT = L_LINES
LINE_SIZE = L_COLS
NO_DIALOG = 'X'
IMPORTING
OUT_ARCHIVE_PARAMETERS = LW_ARCPAR
OUT_PARAMETERS = LW_PRIPAR
VALID = L_VAL.
IF L_VAL NE SPACE AND SY-SUBRC = 0.
LW_PRIPAR-PRREL = SPACE.
LW_PRIPAR-PRIMM = SPACE.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS LW_PRIPAR
ARCHIVE PARAMETERS LW_ARCPAR
NO DIALOG.
ENDIF.
WRITE 'Output in spool'.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
DATA:TEXT TYPE STRING.
CONCATENATE 'Spool' SY-SPONO 'is generated' INTO TEXT SEPARATED BY SPACE.
MESSAGE TEXT TYPE 'S'.
SPOOLID = SY-SPONO.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = SPOOLID
NO_DIALOG = SPACE
TABLES
PDF = I_PDF.
DATA: W_PDF LIKE LINE OF I_PDF.
OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
LOOP AT I_PDF INTO W_PDF.
TRANSFER W_PDF TO P_FILE.
ENDLOOP.
ENDIF.
CLOSE DATASET P_FILE.