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: 

PDF format of smartform

Former Member
0 Kudos

I will have to save my smartforms in the following location after everytime it gets executed.

C:\Documents and Settings\Administrator\Desktop\nabanita.pdf

I'll be giving that location path as an input in the selection screen and execute it. SMART FORM preview will generate and at the same time it will get saved to that specified loc. Kindly provide the logic for the same.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Ok, once the Smart form is called, you have all the PDF data in your internal table, right ?

then do this. to convert the OTF to PDF.



 loop at w_sfoutput-otfdata into w_otfdata.
            append w_otfdata to t_otfdata.
          endloop.
          if not t_otfdata[] is initial.
* To convert the OTF to PDF.
            call function 'CONVERT_OTF_2_PDF'
              importing
                bin_filesize           = filesize
              tables
                otf                    = t_otfdata
                doctab_archive         = doctab_archive
                lines                  = pdf_lines
              exceptions
                err_conv_not_possible  = 1
                err_otf_mc_noendmarker = 2
                others                 = 3.

ok, once converted to PDF, you can use either open dataset, close dataset, and trasfer to save it in an application server path or use Function modules like WS_upload or GUI_upload or so.. to pass to a front end path.


        open dataset file_name in binary mode for output.
              check sy-subrc is initial.
              loop at pdf_lines.
                transfer pdf_lines to file_name.
              endloop.
              close dataset file_name.

2 REPLIES 2

venkat_o
Active Contributor
0 Kudos

HI Nandi, <li> Check the link : <strong>[Convert Smartform into PDF and Download|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450&overridelayout=true]</strong> Thanks Venkat.O

Former Member
0 Kudos

Ok, once the Smart form is called, you have all the PDF data in your internal table, right ?

then do this. to convert the OTF to PDF.



 loop at w_sfoutput-otfdata into w_otfdata.
            append w_otfdata to t_otfdata.
          endloop.
          if not t_otfdata[] is initial.
* To convert the OTF to PDF.
            call function 'CONVERT_OTF_2_PDF'
              importing
                bin_filesize           = filesize
              tables
                otf                    = t_otfdata
                doctab_archive         = doctab_archive
                lines                  = pdf_lines
              exceptions
                err_conv_not_possible  = 1
                err_otf_mc_noendmarker = 2
                others                 = 3.

ok, once converted to PDF, you can use either open dataset, close dataset, and trasfer to save it in an application server path or use Function modules like WS_upload or GUI_upload or so.. to pass to a front end path.


        open dataset file_name in binary mode for output.
              check sy-subrc is initial.
              loop at pdf_lines.
                transfer pdf_lines to file_name.
              endloop.
              close dataset file_name.