Skip to Content
author's profile photo Former Member
Former Member

Want to attach smartform as workitem but it doesn't work.

Dear Experts,

I want attach 'SMARTFROMS' or PWB Forms as workitem attachment but i couild not able to do .My method code is as follows...

function zbi_bill_revision_v1.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(WID) TYPE SWW_WIID

*" REFERENCE(L_DOCNO) TYPE E_PRINTDOC

*" EXPORTING

*" REFERENCE(L_WID) TYPE SWW_WIID

*"----


  • data: l_wid type SWW_WIID.

include <cntn01>.

types : begin of ty_i_tline,

i_tline type tline,

end of ty_i_tline.

data: ls_control_parameters type ssfctrlop,

w_compop type ssfcompop,

w_return type ssfcrescl,

v_len_in type so_obj_len,

it_i_otf type itcoo occurs 0 with header line,

it_i_tline type table of ty_i_tline,

  • it_zbillasses TYPE zbill_assessment,

out_opt type ssfctrlop,

fm_name like rs38l-name,

test_flag type sysubrc,

message_lines type standard table of swr_messag,

message_struct type standard table of swr_mstruc,

att_head type swr_att_header,

it_solix_tab type tsfixml,

  • wid TYPE sww_wiid,

att_id type swr_att_id,

l_c type efg_strn_printdata,

  • wa_assesment type zbill_assessment,

wa_bill_ht type zbill_invoice_ht.

  • w_compop type ssfcompop.

  • CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

  • EXPORTING

  • formname = 'ZFORMBI_HIGH_TENSION_EMAIL'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

  • IMPORTING

  • fm_name = fm_name

  • EXCEPTIONS

  • no_form = 1

  • no_function_module = 2

  • OTHERS = 3

  • .

  • IF sy-subrc <> 0.

  • ENDIF.

  • *

    • CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

    • EXPORTING

    • i_language = sy-langu

    • IMPORTING

    • e_devtype = w_compop-tdprinter

    • EXCEPTIONS

    • no_language = 1

    • language_not_installed = 2

    • no_devtype_found = 3

    • system_error = 4

    • OTHERS = 5.

    • IF sy-subrc <> 0.

    • ENDIF.

    *

    • w_compop-tdnoprev = 'X'.

    • ls_control_parameters-getotf = 'X'.

    • ls_control_parameters-no_dialog = 'X'.

    *

    • DATA: it_isu_bi_bill_s_doc_header TYPE isu_bi_bill_s_doc_header.

    *

    *

    • CALL FUNCTION '/1BCDWB/SF00000426'

    • EXPORTING

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

  • control_parameters = ls_control_parameters

    • MAIL_APPL_OBJ =

    • MAIL_RECIPIENT =

    • MAIL_SENDER =

  • output_options = w_compop

  • user_settings = 'X'

  • pwb_data = it_isu_bi_bill_s_doc_header

  • c = l_c

  • wa_bill_ht = wa_bill_ht

  • IMPORTING

    • DOCUMENT_OUTPUT_INFO =

  • job_output_info = w_return

    • JOB_OUTPUT_OPTIONS =

  • EXCEPTIONS

  • formatting_error = 1

  • internal_error = 2

  • send_error = 3

  • user_canceled = 4

  • OTHERS = 5

  • .

  • IF sy-subrc <> 0.

  • ENDIF.

    • it_i_otf[] = w_return-otfdata[].

    • CLEAR w_return-otfdata[].

    ***************************

    data: x_printparams type eprintparams,

    it_ranges type standard table of efg_ranges,

    wa_ranges type efg_ranges,

    c_fclass(12) type c value 'IS_U_BI_BILL',

    lt_itcoo type standard table of itcoo,

    g_docno type erdk-opbel.

    clear: wa_erdk.

    select single *

    from erdk

    into wa_erdk

    where opbel = l_docno.

    x_printparams-formkey = wa_erdk-formkey.

    x_printparams-tdnoprev = 'X'.

    x_printparams-tdnoprint = 'X'.

    • x_printparams-NO_OPEN_FORM = 'X'.

    • x_printparams-NO_CLOSE_FORM = 'X'.

    x_printparams-tdgetotf = 'X'.

    x_printparams-formclass = c_fclass.

    wa_ranges-low = wa_erdk-opbel.

    append wa_ranges to it_ranges.

    data : x_header type rfgen-header.

    call function 'EFG_PRINT'

    exporting

    • X_HEADER = X_HEADER

    x_printparams = x_printparams

    • X_ARCHIVE_INDEX =

    • X_ARCHIVE_PARAMS =

    x_dialog = ' '

    • X_RECIPIENT =

    • X_SENDER =

    • X_STRN_COLLINFO =

    • X_TABN_SEL_PER_FCLASS =

    • REF_LOG = CL_EFG_LOG_NULL=>S

    • I_FLG_EMSG = '+'

    • IMPORTING

    • Y_ITCPP =

    • Y_RDI_RESULT =

    • Y_PRINTPARAMS =

    • Y_SF_RESULT =

    • Y_TAB_GENDATA =

    • Y_TABN_SEL_PER_FCLASS =

    • Y_PDF_RESULT =

    tables

    xt_ranges = it_ranges

    • XT_RANGES1 =

    • XT_RANGES2 =

    • XT_RANGES3 =

    • XT_RANGES4 =

    • XT_RANGES5 =

    • XT_RANGES6 =

    • XT_RANGES7 =

    • XT_RANGES8 =

    • XT_RANGES9 =

    yt_otf_data = lt_itcoo

    exceptions

    not_qualified = 1

    formclass_not_found = 2

    form_not_found = 3

    formclass_invalid = 4

    print_failed = 5

    form_invalid = 6

    cancelled = 7

    func_invalid = 8

    not_authorized = 9

    others = 10

    .

    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: pdf_bin type xstring,

    l_size type i.

    call function 'CONVERT_OTF'

    exporting

    format = 'PDF'

    max_linewidth = 132

    importing

    bin_filesize = l_size

    bin_file = pdf_bin

    tables

    otf = lt_itcoo[]

    lines = it_i_tline

    exceptions

    err_max_linewidth = 1

    err_format = 2

    err_conv_not_possible = 3

    err_bad_otf = 4.

    call function 'SCMS_XSTRING_TO_BINARY'

    exporting

    buffer = pdf_bin

    • APPEND_TO_TABLE = ' '

    importing

    output_length = l_size

    tables

    binary_tab = it_solix_tab

    .

    att_head-file_type = 'B'.

    att_head-file_name = 'Billing Revision'.

    att_head-file_extension = 'PDF'.

    att_head-language = 'EN'.

    • l_wid = wid + 2.

    call function 'SAP_WAPI_ATTACHMENT_ADD'

    exporting

    workitem_id = wid

    att_header = att_head

    att_txt = 'Bill Assessment'

    att_bin = pdf_bin

    document_owner = sy-uname

    language = sy-langu

    • DO_COMMIT = 'X'

    importing

    return_code = test_flag

    att_id = att_id

    tables

    message_lines = message_lines

    message_struct = message_struct.

    endfunction.

    when execute code it shows attachment successfully created but it does'nt show in attachment.

    Edited by: GURPRIT BHATIA on Jun 18, 2010 8:46 AM

    Add a comment
    10|10000 characters needed characters exceeded

    Assigned Tags

    Related questions

    2 Answers

    • author's profile photo Former Member
      Former Member
      Posted on Jun 18, 2010 at 07:34 AM

      Using Secondary method i solved that thing.

      Add a comment
      10|10000 characters needed characters exceeded

    • author's profile photo Former Member
      Former Member
      Posted on Jun 18, 2010 at 07:34 AM

      solved

      Add a comment
      10|10000 characters needed characters exceeded

    Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.