2003 Oct 09 12:32 PM
Hi,
I like to convert SAPscript to PDF format and publish it real time to Portal, Is there anyone did this already?
Thanks
2003 Oct 10 4:23 PM
Never done it myself, but if you have the text as OTF there's a CONVERT_OTF function module that can generate PDF out of it.
For further display of the PDF data have a look at Brian McKellers excellent BSP web log about handling generated binary files in web applications.
Depending on your general task you might also have a look at Smart Forms.
kind regards,
Dirk
2003 Oct 10 6:34 PM
I have used the CONVERT_OTF before and it works very well. However if you are trying to convert the document and can't get the OTF data you might look at the following function module: CONVERT_OTFSPOOLJOB_2_PDF. With this function, you only have to supply a spool id number. There is a similar function that you can use if you want to convert ABAP List: CONVERT_ABAPSPOOLJOB_2_PDF. Both the CONVERT_OTF and the function I mentioned return the data in table of structure TLINE (2 fields per record - TDFORMAT CHAR2 & TDLINE CHAR 132). This means that you PDF data is actually in Charater format. I have never tried to publish this to the Portal, but I have E-Mailed PDFs. I would imagine you will face a similar challenge in that now you must convert the character based PDF data to binary. The following is a code fragment from a 620 system that converts to the data to a binary table with a line width of 255 characters (this is what the E-mail interface expects). I would imagine it would be simple to convert this example to a produce a byte string instead of a byte table.
Cast to binary type and adjust table line length
data: begin of content_in,
line type tline,
dummy type tline,
end of content_in.
types pdf_raw type x length 268.
field-symbols 0.
append content_out to objbin.
endif.
2003 Oct 29 12:04 PM
To get OTF-Data is very simple. In the SAPsript-program you have a pair of two function-modules:
1. OPEN_FROM for starting the SAPscript. In the OPTIONS-parameter set TDGETOTF = 'X'.
2. now the function-module CLOSE_FORM at the end of SAPscript returns the OTFDATA as internal table, but no print-spool (or fax, email, ..) is generated.
regards, Torsten
2003 Oct 13 4:54 PM
I have done this type of development and access the PDF file dynamically generated by the program. Yes, Use smart forms and set the http header name value pair variable to application/PDF. That will do, also in case if you are using https environment delete the cache control parameters in the header.
Hope this works for you.
Suresh
2003 Oct 15 7:38 PM
Hi,
Sure this is feasible ... I did it before using an ITS server. First you need to perform the entry form within the original SAPscript ABAP program. This will create a spool request. You can get the spool request number out of the SYST fields (the exact one I cannot remember for the moment) right after the perform. Then you can use the functions as indicated by the other folks to convert your spool request into binary pdf data. Last step is to send the data towards the browser client with the proper mime field set (application/pdf). There are some standard ITS macro's available for that ... How you achieve this in the portal is depending on the underlying technology (ITS, web as; j2EE ... but all technologies have some kind of HTTP send functionality that can address this concept ) ...
Bye,
Steven
2003 Oct 21 5:46 PM
2003 Oct 29 10:38 AM
also look at method DO_REQUEST of class CL_CRM_BSP_ML_PREVIEW (in CRM 4.0) which calls CONVERT_OTF, then shows how to put the resulting xstring variable into the HTTP request.
You may also have to make setting in Adobe. To get Acrobat Reader 6.0 to automatically load with the data, I had to choose edit->preferences, internet preferences, deselect "display pdf in browser". This information was found under help->online support, which has other advice for other situations.
2003 Nov 25 8:10 PM
Try this...
http://searchsap.techtarget.com/tip/1,289483,sid21_gci933581,00.html?FromTaxonomy=%2Fpr%2F283958
Regards,
Dushyant Shetty
2014 Feb 22 7:09 AM
Hai Jhon,
You can create background job for your script print program and use standard program RSTXPDFT4.
2014 Jul 08 1:03 PM
Write as below ...
*data : lit_tline TYPE TABLE OF tline WITH HEADER LINE. " <-- declaration*
lit_record LIKE solisti1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = dl_len_in
TABLES
otf = lit_otf
lines = lit_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
***---Convert 132 to length 255
LOOP AT lit_tline INTO lwa_tline.
dl_pos = 255 - dl_len.
IF dl_pos > 134. "length of pdf_table
dl_pos = 134.
ENDIF.
lwa_record+dl_len = lwa_tline(dl_pos).
dl_len = dl_len + dl_pos.
IF dl_len = 255.
APPEND lwa_record TO lit_record.
CLEAR: lit_record, dl_len.
IF dl_pos < 134.
lwa_record = lwa_tline+dl_pos.
dl_len = 134 - dl_pos.
ENDIF.
ENDIF.
ENDLOOP.
IF dl_len > 0.
APPEND lwa_record TO lit_record.
ENDIF.
***---Send Mail
PERFORM send_mail TABLES lit_record.
ENDIF.