2013 Sep 09 3:54 PM
Dear all,
I would like to export some data from ABAP WebDynpro standard Table (Not ALV and it will not be implemented with ALV) to PDF File.
Do you have any ideas how to achieve this? I searched for this subject on sap scn forum, but I found only solutions with ABAP WebDynpro ALV, but we have quite complex output table so we don't want to implement it in such way. I need some Function Module to convert data from internal table to PDF file to be opened ('Downloaded').
Best Regards
Vladislav
2013 Sep 09 3:57 PM
Hi,
my solution is not really beautiful ..
Create a Smartforms, and ask your smartforms to convert in PDF
--> Call a smartforms in webdynpro : http://www.zbalai.com/_abap/content/420_web_dynpro_for_abap_tips_and_tricks/Web_Dynpro_for_ABAP_Tips...
I'm sure you will find example to convert OTF to PDF
regards
Fred
Dear all,
I would like to export some data from ABAP WebDynpro standard Table (Not ALV and it will not be implemented with ALV) to PDF File.
Do you have any ideas how to achieve this? I searched for this subject on sap scn forum, but I found only solutions with ABAP WebDynpro ALV, but we have quite complex output table so we don't want to implement it in such way. I need some Function Module to convert data from internal table to PDF file to be opened ('Downloaded').
Best Regards
Vladislav
2013 Sep 09 3:57 PM
Hi,
my solution is not really beautiful ..
Create a Smartforms, and ask your smartforms to convert in PDF
--> Call a smartforms in webdynpro : http://www.zbalai.com/_abap/content/420_web_dynpro_for_abap_tips_and_tricks/Web_Dynpro_for_ABAP_Tips...
I'm sure you will find example to convert OTF to PDF
regards
Fred
2013 Sep 10 6:17 AM
Hi,
Could you please try with below code and let me know.
DATA lo_nd_spool_input TYPE REF TO if_wd_context_node.
DATA lo_el_spool_input TYPE REF TO if_wd_context_element.
DATA ls_spool_input TYPE wd_this->element_spool_input.
DATA lv_spool_id TYPE wd_this->element_spool_input-spool_id.
lo_nd_spool_input = wd_context->get_child_node( name = wd_this->wdctx_spool_input ).
lo_el_spool_input = lo_nd_spool_input->get_element( ).
lo_el_spool_input->get_attribute(
EXPORTING
name = `SPOOL_ID`
IMPORTING
value = lv_spool_id ).
data pdf_bytecount type i.
data pdf type STANDARD TABLE OF tline.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = lv_spool_id
* NO_DIALOG = NO_DIALOG
* DST_DEVICE = DST_DEVICE
* PDF_DESTINATION = PDF_DESTINATION
IMPORTING
PDF_BYTECOUNT = PDF_BYTECOUNT
* PDF_SPOOLID = PDF_SPOOLID
* LIST_PAGECOUNT = LIST_PAGECOUNT
* BTC_JOBNAME = BTC_JOBNAME
* BTC_JOBCOUNT = BTC_JOBCOUNT
TABLES
PDF = PDF
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.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
data x_pdf type xstring.
data output type string.
data itab LIKE LINE OF pdf.
LOOP AT pdf INTO itab .
TRANSLATE itab USING ' ~'.
CONCATENATE output itab INTO output IN CHARACTER MODE.
ENDLOOP.
TRANSLATE output USING '~ ' .
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = output
* MIMETYPE = ' '
* ENCODING = ENCODING
IMPORTING
BUFFER = x_pdf
* EXCEPTIONS
* FAILED = 1
* OTHERS = 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.
cl_wd_runtime_services=>attach_file_to_response(
i_filename = 'table_data.pdf'
i_content = x_pdf
i_mime_type = 'application/pdf'
* i_in_new_window = ABAP_FALSE
* i_inplace = ABAP_FALSE
).
Best Regards,
Abirami
2013 Sep 10 6:28 AM
2013 Sep 10 6:29 AM
Hi,
You can create an ADOBE Form from your context itself directly and use the ADOBE Interactive Form component in WDA to open the form.
Later the form can be used in any way... View / Save / Print / download .....
Lot of reference can be found on google...
SAPTechnical.COM - Demo scenario on Adobe Interactive Forms using ABAP WebDynpro
Regards
2013 Sep 10 6:54 AM
Hello,
Create a smart form with all format(means table, header, paragraph using different style) you want to show in your PDF. and then it will give a FM name use that FM to generate the PDF with same data.
<Link farm removed>
.. Chans...
Message was edited by: Suhas Saha
2013 Sep 10 8:21 AM
Hello,
Thanks for your answers!
We have already Excel output (XML File) export from WD Table, can I use it to export somehow as PDF File?
Best Regards
Vladislav
2013 Sep 10 8:28 AM
PDF file is like a print document, you will need a format, a font family, a font size .... the table structure ...
you can't juts ask SAP to transform a table to a PDF .. it's why everybody propose to convert from something : ALV, Smartforms, Adobe Form, ...
regards
Fred
2013 Sep 10 9:08 AM
no you can't use it directly. you have to follow all the steps given (either smart forms or adobe forms).
On google you can find how to use smartforms and adobe forms..
BR
chandra..
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |