Skip to Content

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

How to Implement badi BBP_OUTPUT_CHANGE_SF to call smartform

Hi Gurus,

My query is how do i implement the smartform.

I tried to debug the standard code.

I have used the following code and i dont get the output on the screen. Can you please guide me. If possible with sample code.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = form_name

IMPORTING

fm_name = lv_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

v_contract_no = e_header-object_id.

  • Set relevant control parameters

lv_control_parameters-getotf = l_x. "OTF output

lv_control_parameters-no_dialog = l_x. "No print dialog

lv_control_parameters-preview = space. "No preview

  • Set relevant output options

lv_output_options-tdnewid = l_x. "Print parameters,

lv_output_options-tddelete = space. "Print parameters,

lv_output_options-tddest = 'LP01'.

*function module to pass the internal tables containing data and

*output settings for smartform

CALL FUNCTION lv_fm_name

EXPORTING

control_parameters = lv_control_parameters

output_options = lv_output_options

user_settings = space

wa_text = wa_text

contract_no = v_contract_no

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = lv_ssf_output

  • JOB_OUTPUT_OPTIONS =

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5

.

REFRESH lt_otfdata.

lt_otfdata[] = lv_ssf_output-otfdata[].

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.

data lt_content type bbpt_att_cont.

CALL FUNCTION 'BBP_OUTPUT_X_TABLESIZE_CHG'

EXPORTING

  • IV_APPEND = ' '

  • IV_BYTE_MODE = 'X'

  • IV_STRING =

iv_xstring = pdf_data

  • IV_SIZE =

IMPORTING

ev_size = pdf_size

  • EV_LINES =

  • EV_STRING =

  • EV_XSTRING =

TABLES

  • IT_DATA =

et_data = lt_content

  • EXCEPTIONS

  • NOENTRIES = 1

  • OTHERS = 2

.

CALL FUNCTION 'BBP_ALEWEB_DOWNLOAD'

EXPORTING

data_len = pdf_size

mime_type = 'APPLICATION/PDF'

  • DATA_TYPE = 'RAW'

tables

data_tab = lt_content

  • EXCEPTIONS

  • ITS_NOT_AVAILABLE = 1

  • OTHERS = 2

.

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
Not what you were looking for? View more on this topic or Ask a question