cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a smart form on click of a button in web dynpro abap

Former Member
0 Kudos

Hi experts,

I have a requirement like if I click a button in a view i need ti generate a PDF through smart form.

Is this possible. If so please tell me the way..

Thanks & Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sharma,

Create Interactive form in your view, create one node say PDF_SOURCE under this one attribute PDF_SOURCE of type XSTRING.

Bind this to IF form Datasource and pdfsource.

in your button action write code to call your smartform

using SSF_FUNCTION_MODULE_NAME

using FM CONVERT_OTF and attach_file_to_response

*convert to pdf
  call function 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
    IMPORTING
      bin_filesize          = lv_bytecount
    TABLES
      otf                   = ls_job_output_info-otfdata
      lines                 = lt_lines
    EXCEPTIONS
      err_conv_not_possible = 1
      err_bad_otf           = 2.

  loop at lt_lines into ls_line.
    lv_string = ls_line.
    export mydata = lv_string to data buffer lv_buffer.
    import mydata to l_xline from data buffer lv_buffer in char-to-hex
    mode.

    concatenate l_pdfstring l_xline into l_pdfstring in byte mode.
  endloop.

  call method cl_wd_runtime_services=>attach_file_to_response
    EXPORTING
      i_filename      = 'ZWTY_PACKINGSLIP'
      i_content       = l_pdfstring
      i_mime_type     = 'BIN'
      i_in_new_window = abap_false
      i_inplace       = abap_false.

also check this..

http://abapcodexperiments.wordpress.com/2011/03/20/smartform-pdf-webdynpro-abap/

Cheers,

Kris.

Former Member
0 Kudos

Hi Kris

i have done the same thing.

i have tried doing it in the wd component on click of a button.

when the method call function module of the smartform is being executed i couldn find the values getting into the table which we pass into method convert_otf.

when i do the same thing in se38 then i m able to find the table being filled and the output is visible.

why is this diffrence occuring.

I am very new to wd so please explain in a elobrated manner.

Reply is greatly appreciated.

Regards,

Shravan.

Former Member
0 Kudos

Got My problem Solved .

thanks every one

former_member199125
Active Contributor
0 Kudos

Hi Shravan,

What changes made you to ur code in order to resolve and close the thread.

Former Member
0 Kudos

Hi,

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = l_size

bin_file = l_xfile

TABLES

otf = job_outp_inf-otfdata

lines = lt_pre_pdf.

I have set the attribute PDF_SOURCE to bin_file (i.e l_xfile).

Earlier I dindn get the values into the table job_outp_inf but later i created another applicaton where i was able to see the values in the table.

There might be some minor code mistake in my earlier application.

Regards,

Shravan

Former Member
0 Kudos

Hi,

Please search SCN on the same as there many threads already answered.

Please find the below link -

http://www.sdn.sap.com/irj/scn/elearn?rid=/webcontent/uuid/90937715-aae8-2a10-a0b9-cb86e80b084d [original link is broken]

Regards,

Lekha.

farooq_basha
Active Participant
0 Kudos

Hi Lekha,

I to have same requirement but what ever the link u mention is related to ADOBE INTERACTIVE form but i dont want to use ADOBE INTERACTIVE UI element to import the Smart Form .

Any Suggestions.

Thanks and Regards,

Shaik Farooq Basha

Former Member
0 Kudos

Hi,

You mean there is already a Smartform available and want to display it in WD. Is that right..

farooq_basha
Active Participant
0 Kudos

Yes ...I want to display Same Smartform as a PDF in WD VIEW