on 05-15-2008 11:49 PM
Hello,
We have a custom report (R/3 report) which is too complex to be converted to a smart/adobe form.
The requirement is to show this report on portal for users to be able to print/save it.
The idea we have is:
1. Print the report to spool.
2. Convert the spool to pdf.
3. Render the pdf to portal.
How can we retrieve a pdf (spool) from the backend to portal?
What is the best way of doing this?
Is it possible to:
create an rfc (in the backend) that exports an xstring with the binary of the pdf (of the report)
Using webdynpro, create pdf form based on binary xstring.
Please guide me through any documentation available on this topic.
Thanks,
LN
You can achieve this by creating a bsp which lurks the spool job into an iframe container.
So create a flow logic BSP view with the name filename.pdf, then put code like this in there.
event handler for data retrieval
generated result: PDF format
DATA: l_pdf_xstring TYPE xstring.
DATA: lt_lines TYPE TABLE OF tline.
DATA: ls_line TYPE c LENGTH 134.
DATA: l_pdf_len TYPE i.
DATA: l_spoolno TYPE i.
DATA: l_tsp01 TYPE tsp01.
DATA: l_type TYPE rststyname.
DATA: l_value TYPE char10.
DATA: l_name TYPE rstsoname.
DATA: l_xrec TYPE x LENGTH 268.
DATA: l_xstr TYPE xstring.
FIELD-SYMBOLS <c_rec> TYPE c.
GET PARAMETER ID 'ZSIFAD100_SPOOLNO' FIELD l_value.
l_spoolno = l_value.
SELECT SINGLE * FROM tsp01 INTO l_tsp01 WHERE rqident = l_spoolno.
IF sy-subrc NE 0.
EXIT.
ENDIF.
l_name = l_tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = l_tsp01-rqclient
name = l_name
IMPORTING
objtype = l_type
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
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 l_type(3) = 'OTF'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_spoolno
IMPORTING
pdf_bytecount = l_pdf_len
TABLES
pdf = lt_lines
EXCEPTIONS
OTHERS = 12.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_spoolno
IMPORTING
pdf_bytecount = l_pdf_len
TABLES
pdf = lt_lines
EXCEPTIONS
OTHERS = 12.
ENDIF.
IF sy-subrc = 0.
LOOP AT lt_lines INTO ls_line.
ASSIGN l_xrec TO <c_rec> CASTING.
<c_rec> = ls_line.
CONCATENATE l_xstr l_xrec INTO l_xstr IN BYTE MODE.
ENDLOOP.
l_pdf_xstring = l_xstr(l_pdf_len).
ENDIF.
response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
some Browsers have caching problems when loading PDF format
response->set_header_field(
name = 'cache-control'
value = 'max-age=0' ).
start PDF viewer either in the Browser or as a separate window
if pdf_in_browser is initial.
*response->set_header_field(
name = 'content-disposition'
value = 'attachment; filename=webforms.pdf' ).
endif.
finally display PDF format in Browser
l_pdf_len = XSTRLEN( l_pdf_xstring ).
response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
navigation->response_complete( ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any Ideas???
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.