cancel
Showing results for 
Search instead for 
Did you mean: 

CRM Smartform taking user parms instead of output options

Former Member
0 Kudos

ISA users that are created in the ISA admin do not have an output device specified in their user default (SU01D). So when an ISA order hits the back end (CRM) it triggers an action, which in turn calls a method and processes smarform. This smartform gets attached to an email and sent out. The problem is, that when the user is missing the output device in their user default, to attachmennt comes as a 1 kb PDF that can't be opened.

I'm trying to pass the parameters to the Smartform FM, but not taking effect..

Am I missing setting something?

control_parameters-langu = lv_language.

control_parameters-no_open = ' '. "SAP SF: General flag

control_parameters-no_close = ' '. "SAP SF: General flag

control_parameters-device = 'LOCL'. "Output device

control_parameters-no_dialog = 'X'. "suppress printer dialog

control_parameters-preview = ' '. "Print preview

control_parameters-getotf = 'X'. "Return OTF tab, no print

control_parameters-replangu1 = ' '. "Language key

control_parameters-replangu2 = ' '. "Language key

control_parameters-replangu3 = ' '. "Language key

control_parameters-startpage = ' '. "SAP SF: Object name

ls_output_options-tddest = 'LOCL'.

ls_output_options-tdnoprev = 'X'.

  • call function to process smart form

CALL FUNCTION function_name

EXPORTING

archive_index = is_archive_index

archive_index_tab = ct_archive_index_tab

archive_parameters = is_archive_parameters

control_parameters = control_parameters

mail_appl_obj = is_mail_appl_obj

mail_recipient = is_mail_recipient

mail_sender = is_mail_sender

output_options = ls_output_options

user_settings = space

orderadm_h = ls_orderadm_h

activity_h = ls_activity_h

lead_h = ls_lead_h

opport_h = ls_opport_h

orgman_h = ls_orgman_h

partner_h = lt_partner_h

pricingdata_h = ls_pricingdata_h

sales_h = ls_sales_h

shipping_h = ls_shipping_h

payplan_d_h = lt_payplan_d_h

cumulat_h = ls_cumulat_h

customer_h = ls_customer_h

acs_h = ls_acs_h

billing_h = lt_billing_h

cancel_h = lt_cancel_h

appointment_h = lt_appointment_h

billplan_d_h = lt_billplan_d_h

billplan_h = lt_billplan_h

status_d_h = lt_status_d_h

status_h = lt_status_h

srv_subject_h = lt_srv_subject_h

srv_reason_h = lt_srv_reason_h

srv_result_h = lt_srv_result_h

orderadm_i = lt_orderadm_i

orderadm_i_qt = lt_orderadm_i_qt

orderadm_i_in = lt_orderadm_i_in

orgman_i = lt_orgman_i

pricingdata_i = lt_pricingdata_i

pricing_i = lt_pricing_i

product_i = lt_product_i

sales_i = lt_sales_i

schedlin_i = lt_schedlin_i

schedlin_i_cf = lt_schedlin_i_cf

shipping_i = lt_shipping_i

partner_i = lt_partner_i

item_cstics_i = lt_item_cstics_i

customer_i = lt_customer_i

billing_i = lt_billing_i

cancel_i = lt_cancel_i

finprod_i = lt_finprod_i

ordprp_i = lt_ordprp_i

appointment_i = lt_appointment_i

billplan_d_i = lt_billplan_d_i

billplan_i = lt_billplan_i

status_i = lt_status_i

working_set_e_s_bbp = lt_working_set_e_s_bbp

language = lv_language

IMPORTING

document_output_info = es_document_output_info

job_output_info = es_job_output_info

job_output_options = es_job_output_options

EXCEPTIONS

output_canceled = 1

parameter_error = 2

OTHERS = 3.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

null

Edited by: UmaMaheswaraRao Surapaneni on Apr 1, 2009 6:25 PM

Edited by: UmaMaheswaraRao Surapaneni on Apr 1, 2009 6:26 PM

Former Member
0 Kudos

Sravanthi

Thanks for replying, but that wasn't my question. I know how to attached and send the smartform. The problem was that the ISA users do not have an output device defaulted to their user exit. So you have to code it. But through trial and error, we commented out control_parameters-device = 'LOCL'. and all is fine now.

Former Member
0 Kudos

Hi Cathy,

DATA:
 i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
 i_tline TYPE TABLE OF tline WITH HEADER LINE,
 i_receivers TYPE  TABLE OF somlreci1 WITH HEADER LINE,
 i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
 i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
 i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
 i_objbin LIKE solisti1  OCCURS 0 WITH HEADER LINE,
 i_reclist LIKE somlreci1  OCCURS 0 WITH HEADER LINE.

DATA:
  w_objhead TYPE soli_tab,
  w_ctrlop TYPE ssfctrlop,
  w_compop TYPE ssfcompop,
  w_return TYPE ssfcrescl,
  w_doc_chng TYPE sodocchgi1,
  w_data TYPE sodocchgi1,
  w_buffer TYPE string.

DATA:
 v_form_name TYPE rs38l_fnam,
 v_len_in LIKE sood-objlen,
 v_len_out LIKE sood-objlen,
 v_len_outn TYPE i,
 v_lines_txt TYPE i,
 v_lines_bin TYPE i.


CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname           = 'Z_SMARTFORM'
  IMPORTING
    fm_name            = v_form_name
  EXCEPTIONS
    no_form            = 1
    no_function_module = 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.

w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.



CALL FUNCTION '/1BCDWB/SF00000200'
  EXPORTING
    control_parameters = w_ctrlop
    output_options     = w_compop
    user_settings      = 'X'
  IMPORTING
    job_output_info    = w_return
  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.


i_otf[] = w_return-otfdata[].


CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format                = 'PDF'
    max_linewidth         = 132
  IMPORTING
    bin_filesize          = v_len_in
  TABLES
    otf                   = i_otf
    lines                 = i_tline
  EXCEPTIONS
    err_max_linewidth     = 1
    err_format            = 2
    err_conv_not_possible = 3
    err_bad_otf           = 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.


LOOP AT i_tline.

  TRANSLATE i_tline USING '~'.
  CONCATENATE w_buffer i_tline INTO w_buffer.

ENDLOOP.

TRANSLATE w_buffer USING '~'.


DO.
  i_record = w_buffer.
  APPEND i_record.
  SHIFT w_buffer LEFT BY 255 PLACES.
  IF w_buffer IS INITIAL.
    EXIT.
  ENDIF.
ENDDO.

REFRESH :
  i_reclist,
  i_objtxt,
  i_objbin,
  i_objpack.

CLEAR w_objhead.

i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.


i_objtxt = 'Find attached the output of the smartform.'.
APPEND i_objtxt.
i_objtxt = 'Regards,'.
APPEND i_objtxt.
i_objtxt = 'Sravanthi'.
APPEND i_objtxt.

DESCRIBE TABLE i_objtxt LINES v_lines_txt.


w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10 .
w_doc_chng-obj_descr  = 'Smart form output'.
w_doc_chng-sensitivty = 'F'.
w_doc_chng-doc_size = v_lines_txt * 255.

CLEAR i_objpack-transf_bin.

i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.

i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type  = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'smartform output' 'pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.

CLEAR i_reclist.


i_reclist-receiver = ''." ---------------> email id
i_reclist-express  = 'X'.
i_reclist-rec_type  = 'U'.
APPEND i_reclist.


CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
  EXPORTING
    document_data              = w_doc_chng
    put_in_outbox              = 'X'
    commit_work                = 'X'
  TABLES
    packing_list               = i_objpack
    contents_bin               = i_objbin
    object_header              = w_objhead
    contents_txt               = i_objtxt
    receivers                  = i_reclist
  EXCEPTIONS
    too_many_receivers         = 1
    document_not_sent          = 2
    document_type_not_exist    = 3
    operation_no_authorization = 4
    parameter_error            = 5
    x_error                    = 6
    enqueue_error              = 7
    OTHERS                     = 8.
IF sy-subrc NE 0.
  WRITE:/ 'Error When Sending the File', sy-subrc.
ELSE.
  WRITE:/ 'Mail sent'.
ENDIF.

Regards,

Sravanthi