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: 

smartform output in OTF Format error

Former Member
0 Kudos

Hi,

I want to get the smartform output as OTF format.This data later i will convert to PDF format. The problem now is even though i passed the following code to my smartform function module, still when i execute the program i am getting the popup to enter output device.if i give the printer name as LP01 and press print button,i am getting the the output in OTF format in the table.How to avoid this popup.if i close that popup without giving printer name,my smartform function module is not successful. That means i am not getting the data in the OTF table. Please help me.

w_control_param-getotf = 'X'.

w_control_param-no_dialog = 'X'.

w_composer_param-tdnoprev = 'X'.

CALL FUNCTION v_fm_name

EXPORTING

control_parameters = w_control_param

output_options = w_composer_param

user_settings = 'X'

IMPORTING

job_output_info = v_job_info

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

Message E000 with 'Cannot convert to OTF Format'.

ENDIF.

i_otfdata[] = v_job_info-otfdata[].

Regards

Shibin

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Shibin ,

If u are getting POP-UP even after setting the the configurations

w_control_param-getotf = 'X'.

w_control_param-no_dialog = 'X'.

w_composer_param-tdnoprev = 'X'.

Then the issue could well be with the user configuration .

Do the following steps from the menu :

System -> user profile -->Own Data

Select Defaults Tab , then check if u have given OutputDevice .

Once u give this detail , your code will work fine .

I think this will solve your problem

Regards

Arun

5 REPLIES 5

Former Member
0 Kudos

Hi,

Try including w_control_param-tddest = 'LOCL'

Regards,

Darren

0 Kudos

Hi,

Just now, i checked by adding this code

w_composer_param-tddest = 'LOCL'.

But still Proplem exist.

Regards

Shibin

Former Member
0 Kudos

Hi shibin,

DATA:
  form_name TYPE rs38l_fnam,
  wa_ctrlop TYPE ssfctrlop,
  wa_outopt TYPE ssfcompop.
DATA:
  t_otfdata TYPE ssfcrescl,
  t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.

DATA:
  t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
  w_filesize TYPE i,
  w_bin_filesize TYPE i.


CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = 'Z_FLIGHT_DETAILS'
  IMPORTING
    fm_name            = form_name
  EXCEPTIONS
    no_form            = 1
    no_function_module = 2.


wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.

CALL FUNCTION '/1BCDWB/SF00000482'
  EXPORTING
    control_parameters = wa_ctrlop
    output_options     = wa_outopt
    user_settings      = 'X'
  IMPORTING
    job_output_info    = t_otfdata
  EXCEPTIONS
    formatting_error   = 1
    internal_error     = 2
    send_error         = 3
    user_canceled      = 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.

  t_otf[] = t_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'
 EXPORTING
   FORMAT                      = 'PDF'
   MAX_LINEWIDTH               = 132
*   ARCHIVE_INDEX               = ' '
*   COPYNUMBER                  = 0
*   ASCII_BIDI_VIS2LOG          = ' '
*   PDF_DELETE_OTFTAB           = ' '
  IMPORTING
   BIN_FILESIZE                 = w_bin_filesize
*   BIN_FILE                    = BIN_FILE
  TABLES
    otf                         = t_otf
    lines                       = t_pdf_tab
 EXCEPTIONS
   ERR_MAX_LINEWIDTH           = 1
   ERR_FORMAT                  = 2
   ERR_CONV_NOT_POSSIBLE       = 3
   ERR_BAD_OTF                 = 4
          .
  .
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      bin_filesize            = w_bin_filesize
      filename                = 'D:\test.PDF'
      filetype                = 'BIN'
    IMPORTING
      filelength              = w_filesize
    TABLES
      data_tab                = t_pdf_tab
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21.
  IF sy-subrc NE 0.
    MESSAGE 'file is not downloaded' TYPE 'E'.
  ELSE.
    MESSAGE 'file downloaded' TYPE 'S'.
  ENDIF.

Regards,

Sravanthi

Former Member
0 Kudos

Hi Shibin ,

If u are getting POP-UP even after setting the the configurations

w_control_param-getotf = 'X'.

w_control_param-no_dialog = 'X'.

w_composer_param-tdnoprev = 'X'.

Then the issue could well be with the user configuration .

Do the following steps from the menu :

System -> user profile -->Own Data

Select Defaults Tab , then check if u have given OutputDevice .

Once u give this detail , your code will work fine .

I think this will solve your problem

Regards

Arun

0 Kudos

Hi Arun,

I have done same thing using tcode SU3.In that output device not configured for my user.And it working fine now. Thanks a lot to all helped me.

Regards

Shibin