Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

error in getting job_output_info-otfdata

hi experts,

i am developing the code to convert smartform into PDF after output,

to convert i need otfdata from FM but am not getting any data from job_output_info-otfdata

can any one please suggest on this

data:st_job_output_info TYPE ssfcrescl OCCURS 100 WITH HEADER LINE.

control-getotf = 'X'.

CALL FUNCTION fm_name

EXPORTING

control_parameters = control

output_options = output

user_settings = 'X'

IMPORTING

document_output_info = st_document_output_info

job_output_info = st_job_output_info

job_output_options = st_job_output_options

TABLES

gtbl_disdoc = gtbl_disdoc

gtbl_cust = gtbl_cust

gtbl_townadd = gtbl_townadd

EXCEPTIONS formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • error handling

ENDIF.

t_otf[] = st_job_output_info-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

  • MAX_LINEWIDTH = 132

IMPORTING

BIN_FILESIZE = v_bin_filesize

TABLES

otf = t_otf "st_job_output_info-otfdata

lines = it_lines

EXCEPTIONS

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

ERR_BAD_OTF = 4

OTHERS = 5

.

IF sy-subrc <> 0.

ENDIF.

CONCATENATE 'smrt' '.pdf' p_contact '_'

wc_cpudt '_' wc_cputm

INTO w_file_name.

*

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = v_bin_filesize

filename = w_file_name

filetype = 'BIN'

TABLES

data_tab = it_lines[]

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

OTHERS = 22.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Former Member
Former Member replied

Hi Santhosh,

The code looks ok, i see that you are open_ssf and the actual call to the SF are in different sub routines, so

1) Are you sure that that control_parameters still has proper values when the SF is being called.

2) Also the SY-SUBRC value after the SF is called, is it Zero or some other value.

Could you try calling the SF like below, without SSF_OPEN and SSF_CLOSE and let me know the results.

  DATA: ssfcrescl      TYPE ssfcrescl,
        output_options TYPE ssfcresop,
        ssfcompop      TYPE ssfcompop,
        ssfctrlop      TYPE ssfctrlop,
        l_spoolid      TYPE tsp01-rqident,
        li_pdf         TYPE STANDARD TABLE OF tline.

  ssfctrlop-no_dialog = 'X'.
  ssfctrlop-device    = 'PRINTER'.
  ssfcompop-tdnewid   = 'X'.
  ssfcompop-tdimmed   = 'X'.
  ssfctrlop-preview = 'X'.
  ssfcompop-tdprinter = 'PDF1'.
  ssfcompop-tddest    = 'LP01'.
  ssfctrlop-getotf    = 'X'.

  CALL FUNCTION '/1BCDWB/SF00000024'
    EXPORTING
      control_parameters = ssfctrlop
      output_options     = ssfcompop
      user_settings      = 'X'
    IMPORTING
      job_output_info    = ssfcrescl
      job_output_options = output_options
    TABLES

      gtbl_disdoc = gtbl_disdoc 

      gtbl_cust = gtbl_cust 

      gtbl_townadd = gtbl_townadd 
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.

  IF sy-subrc NE 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ELSE.

    DATA: li_otf TYPE STANDARD TABLE OF itcoo,
          l_bin_size TYPE i,
          l_bin_file TYPE xstring.

    CALL FUNCTION 'CONVERT_OTF'
     EXPORTING
       format                      = 'PDF'
     IMPORTING
       bin_filesize                = l_bin_size
       bin_file                    = l_bin_file
      TABLES
        otf                         = ssfcrescl-otfdata[]
        lines                       = li_pdf
   EXCEPTIONS
     ERR_MAX_LINEWIDTH           = 1
     ERR_FORMAT                  = 2
     ERR_CONV_NOT_POSSIBLE       = 3
     ERR_BAD_OTF                 = 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.
    ELSE.
      bin_file = l_bin_file.
    ENDIF.

  ENDIF.

Regards,

Chen

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question