cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in displaying the smartform from Webdynpro screen

Former Member
0 Kudos

Hello experts,

I am calling a smartform on some action event method in an webdynpro abap screen.

PDF is getting generated and being displayed when I test the component using the web dynpro application with user having developer role.

But the actual issue being faced is - while I am clicking on the same button of the screen in portal (different user- only having portal authorizations) the pdf is not getting generated.

Please guide me.

Thanks in advance.

Best regards,

Ramana

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos


Hi,

Do you mean that when testing the WD-ABAP application directly you are able to check the PDF popup, but when you access the same WD-ABAP application from the iview in the portal, the PDF popup is not coming ?

Please confirm.

Ashish

Former Member
0 Kudos

Exactly Ashish.

@Harsha - I've already maintained the printer as 'LP01' in SU01- defaults tab

harsha_jalakam
Active Contributor
0 Kudos

Hi Ramana,

Please check if your pop up blocker is turned off.

Former Member
0 Kudos

method onactionprint_challana .



  data: l_x(1) value 'X'.

  data: lv_text               type char3,

        lv_syucomm            type char1,

        ls_pdf                type xstring,

        lv_fm_name            type rs38l_fnam,

        lv_control_parameters type ssfctrlop,

        lv_output_options     type ssfcompop,

        xsfparam_line   type ssfxsfp,

        lv_ssf_output         type ssfcrescl,

        lt_otfdata            type table of itcoo.

  data : t_ssfcrescl     type ssfcrescl.

  data : l_lang type nast-spras.

  data: wa_benificiary type zemd_benificiary_ac_det.

  call function 'SSF_FUNCTION_MODULE_NAME'

    exporting

      formname           = 'ZEMD_PAY_ONLINE_CHALLANA'

      variant            = ' '

      direct_call        = ' '

    importing

      fm_name            = lv_fm_name

    exceptions

      no_form            = 1

      no_function_module = 2

      others             = 3.

  if sy-subrc <> 0.

** Implement suitable error handling here

  endif.



  lv_output_options-tdprinter  = 'PDF'. "'PDF1'.

  "lv_output_options-tddest     = 'LP01'.

  lv_output_options-tdimmed    = 'X'.

  lv_output_options-tddelete   = ' '.

  "lv_output_options-tdlifetime = 'X'.

  lv_output_options-tddest     = 'LP01'.

  lv_output_options-tdnewid    = 'X'. "Print parameters,




  lv_control_parameters-langu = 'E'.

  lv_control_parameters-preview = 'X'.

  lv_control_parameters-no_dialog = ' '.

  lv_control_parameters-getotf abap_true.

  "lv_control_parameters-device = 'PRINTER'.


  select single * from zemd_ben_ac into corresponding fields of wa_benificiary.


  call function lv_fm_name

   exporting

     control_parameters          = lv_control_parameters

     output_options              = lv_output_options

     user_settings               = 'X'

     wa_benificiary              = wa_benificiary

   importing

     job_output_info             = t_ssfcrescl

exceptions

   formatting_error           = 1

   internal_error             = 2

   send_error                 = 3

   user_canceled              = 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.

  refresh lt_otfdata[]

  lt_otfdata[] = t_ssfcrescl-otfdata[].


  call function 'SSFCOMP_PDF_PREVIEW'

    exporting

      i_otf                    = lt_otfdata

    exceptions

      convert_otf_to_pdf_error = 1

      cntl_error               = 2

      others                   = 3.


  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: l_dummy type standard table of tline,

        pdf_data type xstring,

        pdf_size type i.



  clear: pdf_data, pdf_size.



** convert otf to pdf

  call function 'CONVERT_OTF'

    exporting

      format                = 'PDF'

    importing

      bin_filesize          = pdf_size

      bin_file              = pdf_data

    tables

      otf                   = lt_otfdata[]

      lines                 = l_dummy

    exceptions

      err_max_linewidth     = 1

      err_format            = 2

      err_conv_not_possible = 3

      others                = 4.



  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 pdf_data is not initial.

    call method cl_wd_runtime_services=>attach_file_to_response

      exporting

        i_filename      = 'Bank Challana.pdf'

        i_content       = pdf_data 

        i_mime_type     = 'pdf'

        i_in_new_window = abap_true

        i_inplace       = abap_true.

  endif.


endmethod.

Former Member
0 Kudos

No Harsha. Above is the sample code I am using.

former_member184578
Active Contributor
0 Kudos

Hi,

Front-end printing is not possible with Local printer from portal. Check this SAP Note for resolution: SAP Note - 1753723

hope this helps,

Regards,

Kiran

Former Member
0 Kudos

Hi Kiran,

Gone through the note.

In my code -

call function lv_fm_name

    exporting

      control_parameters          = lv_control_parameters

     output_options              = lv_output_options

     user_settings               = 'X'

     wa_benificiary              = wa_benificiary

    importing

     job_output_info             = t_ssfcrescl

exceptions

   formatting_error           = 1

   internal_error             = 2

   send_error                 = 3

   user_canceled              = 4

   others                     = 5

I am not getting any data t_ssfcrescl  in this. Might be some issue with control parameters or output options.

Regards,

Ramana.

Former Member
0 Kudos

The fact that the "t_ssfcrescl"  is not returning anything means that the smartform is not called.

Please try this.

   * Output Options
  if iv_print ne 'X'. "In case of only preview popup".
    clear ls_output.
    ls_output-tdnoprev = 'X'.
    ls_output-tdprinter = 'PDF1'.
    lv_tick = '√'.
    ls_cparam-getotf = 'X'.
  else.
    ls_output-tddest =   'FINQ'.
    ls_output-tdimmed = 'X'.
    ls_output-tdnewid = 'X'.
    ls_cparam-device = 'PRINTER'.
  endif.

* Get the FM name to call the smartform.

    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
      formname           = lv_fm_sform " your smartform name"
*     VARIANT            = ' '
*     DIRECT_CALL        = ' '
    importing
      fm_name            = lv_fmmodule
    exceptions
      no_form            = 1
      no_function_module = 2
      others             = 3.

* Call the smartform FM name.

   call function lv_fmmodule
    exporting
      control_parameters   = ls_cparam
      output_options       = ls_output
      user_settings        = 'X'
    importing
      job_output_info      = ls_otf_from_fm
    exceptions
      formatting_error     = 1
      internal_error       = 2
      send_error           = 3
      user_canceled        = 4
      others               = 5.

* Convert to PDF format in case of preview.

  lt_otf[] = ls_otf_from_fm-otfdata.

  clear:lv_bin_filesize,lv_bin_file.

    call function 'CONVERT_OTF'
    exporting
      format                = 'PDF'
    importing
      bin_filesize          = lv_bin_filesize
      bin_file              = lv_bin_file
    tables
      otf                   = lt_otf
      lines                 = lt_pdf_tab
    exceptions
      err_max_linewidth     = 1
      err_format            = 2
      err_conv_not_possible = 3
      err_bad_otf           = 4
      others                = 5.

Now what ever is returned from lv_bin_file is to be binded back to the context attribute of type xstring, and then data mapped to the UI element of type "interactive form".

This should work.

harsha_jalakam
Active Contributor
0 Kudos

Hi Ramana,

It seems to be Authorization issues with the User ID. Maintain userid for printer  output in LP01 and check if it can help.

Regards,

Harsha