on 11-14-2008 9:46 AM
Hi,
from what I have seen, the subject of the mail sent from my smartform is taken from the Description field of the smartform.
Is there a way to do something like a dynamic subject ? Like prio or subject of the message.
Kind Regards
Dirk
Dear Kohlen,
it is possible to change the subject by using Mail notification.
Do following:
1. Make a copy of CL_DOC_PROCESSING_CRM_ORDER
2. Change Methode CRM_SRVORDER_EXEC_SMART_FORM.
20080505 MR: Aenderung des Replace Befehls
Original:
REPLACE '&' WITH ls_orderadm_h-object_id
INTO ls_output_options-tdtitle.
REPLACE '&1' WITH ls_orderadm_h-object_id
INTO ls_output_options-tdtitle.
REPLACE '&2' WITH ls_activity_h-priority
INTO ls_output_options-tdtitle.
REPLACE '&3' WITH ls_orderadm_h-description
INTO ls_output_options-tdtitle.
By doing this you can use &1, &2, &3 for changing the subject in the smartform. This is one purpose. Another way is to change ls_output_options-tdtitle in the methode. Look at the method, in the beginning there is a function call CRM_OUTPUT_SINGLE_READ. After the call you have all informations in several local tables. So it is very easy to change the subject with informations you need.
After the changes you have to customizing the action profile. Please change the "Processing Types" for your actions. (In this case for your action "Send Mail") You have to change the Processing Class from CL_DOC_PROCESSING_CRM_ORDER to ZCL_DOC_PROCESSING_CRM_ORDER. If you use your own Smartform, you have also to change the form name.
That's it.
I hope it helps.
Kind regards
Marc
Edited by: Marc Resch on Nov 17, 2008 4:09 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc,
Thank you for the reply.
I have followed as suggested below. The Smart form has DESC as &1:&2:&3 how ever emails are just going out as 800000001:&2:&3 in subject.
"
1. Make a copy of CL_DOC_PROCESSING_CRM_ORDER
2. Change Methode CRM_SRVORDER_EXEC_SMART_FORM.
REPLACE '&1' WITH ls_orderadm_h-object_id
INTO ls_output_options-tdtitle.
REPLACE '&2' WITH ls_activity_h-priority
INTO ls_output_options-tdtitle.
REPLACE '&3' WITH ls_orderadm_h-description
INTO ls_output_options-tdtitle.
By doing this you can use &1, &2, &3 for changing the subject in the smartform."
regards
Satyam
full code:
METHOD CRM_SRVORDER_EXEC_SMART_FORM.
*This Method is used to print service order.
* generally used constants of generic order
INCLUDE: crm_direct.
DATA:
control_parameters TYPE ssfctrlop.
* function name
DATA: function_name TYPE rs38l_fnam,
dummy(254) TYPE c,
ls_archive_index TYPE toa_dara,
ls_orderadm_h TYPE crmt_output_orderadm_h_com,
ls_activity_h TYPE crmt_output_activity_h_com,
ls_opport_h TYPE crmt_output_opport_h_com,
ls_orgman_h TYPE crmt_output_orgman_h_com,
lt_partner_h TYPE crmt_output_partner_h_comt,
ls_pricingdata_h TYPE crmt_output_pricingdata_h_com,
ls_sales_h TYPE crmt_output_sales_h_com,
ls_shipping_h TYPE crmt_output_shipping_h_com,
lt_payplan_d_h TYPE crmt_output_payplan_d_h_comt,
ls_customer_h TYPE crmt_output_customer_h_com,
ls_cumulat_h TYPE crmt_output_cumulat_h_com,
lt_billing_h TYPE crmt_output_billing_h_comt,
lt_cancel_h TYPE crmt_output_cancel_h_comt,
lt_appointment_h TYPE crmt_output_appointment_h_comt,
lt_billplan_d_h TYPE crmt_output_billplan_d_h_comt,
lt_billplan_h TYPE crmt_output_billplan_h_comt,
lt_status_d_h TYPE crmt_output_status_d_h_comt,
lt_status_h TYPE crmt_output_status_h_comt,
lt_srv_subject_h TYPE crmt_output_srv_subject_h_comt,
lt_srv_reason_h TYPE crmt_output_srv_reason_h_comt,
lt_srv_result_h TYPE crmt_output_srv_result_h_comt,
ls_acs_h TYPE crmt_acs_h_com,
lt_srv_subject_i TYPE crmt_output_srv_subject_h_comt,
lt_srv_refobj_h TYPE crmt_output_srv_refobj_h_comt,
lt_srv_refobj_i TYPE crmt_output_srv_refobj_h_comt,
lt_orderadm_i TYPE crmt_output_orderadm_i_comt,
lt_orgman_i TYPE crmt_output_orgman_i_comt,
lt_pricingdata_i TYPE crmt_output_pricingdata_i_comt,
lt_pricing_i TYPE crmt_output_pricing_i_comt,
lt_product_i TYPE crmt_output_product_i_comt,
lt_sales_i TYPE crmt_output_sales_i_comt,
lt_service_i TYPE crmt_output_service_i_comt,
lt_shipping_i TYPE crmt_output_shipping_i_comt,
lt_schedlin_i TYPE crmt_output_schedlin_i_comt,
lt_customer_i TYPE crmt_output_customer_i_comt,
lt_partner_i TYPE crmt_output_partner_i_comt,
lt_item_cstics_i TYPE crmt_item_cstics_tab,
lt_billing_i TYPE crmt_output_billing_i_comt,
lt_cancel_i TYPE crmt_output_cancel_i_comt,
lt_finprod_i TYPE crmt_output_finprod_i_comt,
lt_ordprp_i TYPE crmt_output_ordprp_i_comt,
lt_appointment_i TYPE crmt_output_appointment_i_comt,
lt_billplan_d_i TYPE crmt_output_billplan_d_i_comt,
lt_billplan_i TYPE crmt_output_billplan_i_comt,
lt_orderadm_i_qt TYPE crmt_output_orderadm_i_qt_comt,
lt_orderadm_i_in TYPE crmt_output_orderadm_i_in_comt,
lt_schedlin_i_cf TYPE crmt_output_schedlin_i_cf_comt,
lt_status_i TYPE crmt_output_status_i_comt,
lt_working_set_e_s_bbp TYPE /1cn/working_set_e_s_bbp_t,
lv_language LIKE sy-langu,
lo_order TYPE REF TO cl_doc_crm_order,
lv_object_guid TYPE crmt_object_guid,
lv_status TYPE jstat,
lt_status TYPE TABLE OF jstat,
lv_error_tab_wrk TYPE ssferror,
ls_output_options TYPE ssfcompop,
* for assignments - begin
lt_service_i_assi TYPE crmt_output_service_i_ass_comt
* for assignments - end
.
DATA: lv_devtype TYPE rspoptype.
* fill internal structure for the output options
ls_output_options = is_output_options.
* get the function name for this smart form
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = ip_smart_form
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
fm_name = function_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
* add an error message to processing protocol
MESSAGE i015(sppf_media) WITH ip_smart_form INTO dummy.
CALL METHOD cl_log_ppf=>add_message
EXPORTING
ip_problemclass = '1'
ip_handle = ip_application_log.
EXIT.
ENDIF.
* determine the tables of the application
CALL FUNCTION 'CRM_OUTPUT_SINGLE_READ'
EXPORTING
iv_object = io_appl_object
iv_smart_form = ip_smart_form
ir_partner = io_partner
IMPORTING
es_output_orderadm_h = ls_orderadm_h
es_output_activity_h = ls_activity_h
es_output_opport_h = ls_opport_h
es_output_orgman_h = ls_orgman_h
es_output_pricingdata_h = ls_pricingdata_h
es_output_sales_h = ls_sales_h
es_output_shipping_h = ls_shipping_h
et_output_partner_h = lt_partner_h
et_output_payplan_d_h = lt_payplan_d_h
es_output_customer_h = ls_customer_h
es_output_cumulat_h = ls_cumulat_h
et_output_billing_h = lt_billing_h
et_output_cancel_h = lt_cancel_h
et_output_appointment_h = lt_appointment_h
et_output_billplan_d_h = lt_billplan_d_h
et_output_billplan_h = lt_billplan_h
et_output_status_d_h = lt_status_d_h
et_output_status_h = lt_status_h
et_output_srv_subject_h = lt_srv_subject_h
et_output_srv_reason_h = lt_srv_reason_h
et_output_srv_result_h = lt_srv_result_h
et_output_srv_refobj_h = lt_srv_refobj_h
et_output_srv_refobj_i = lt_srv_refobj_i
et_output_srv_subject_i = lt_srv_subject_i
es_output_acs_h = ls_acs_h
et_output_orderadm_i = lt_orderadm_i
et_output_orgman_i = lt_orgman_i
et_output_pricingdata_i = lt_pricingdata_i
et_output_pricing_i = lt_pricing_i
et_output_product_i = lt_product_i
et_output_sales_i = lt_sales_i
et_output_service_i = lt_service_i
et_output_shipping_i = lt_shipping_i
et_output_schedlin_i = lt_schedlin_i
et_output_partner_i = lt_partner_i
et_item_cstics_i = lt_item_cstics_i
et_output_customer_i = lt_customer_i
et_output_billing_i = lt_billing_i
et_output_cancel_i = lt_cancel_i
et_output_finprod_i = lt_finprod_i
et_output_ordprp_i = lt_ordprp_i
et_output_appointment_i = lt_appointment_i
et_output_billplan_d_i = lt_billplan_d_i
et_output_billplan_i = lt_billplan_i
et_output_orderadm_i_qt = lt_orderadm_i_qt
et_output_orderadm_i_in = lt_orderadm_i_in
et_output_schedlin_i_cf = lt_schedlin_i_cf
et_output_status_i = lt_status_i
et_output_wrk_set_e_s_bbp = lt_working_set_e_s_bbp
ev_language = lv_language
* for assignments - begin
et_output_service_i_assi = lt_service_i_assi
* for assignments - end
.
* set mail title
SELECT SINGLE caption INTO ls_output_options-tdtitle
FROM stxfadmt WHERE
formname = ip_smart_form AND
langu = lv_language.
IF ls_output_options-tdtitle IS INITIAL.
SELECT SINGLE caption INTO ls_output_options-tdtitle
FROM stxfadmt WHERE
formname = ip_smart_form.
ENDIF.
REPLACE '&1' WITH ls_orderadm_h-object_id
INTO ls_output_options-tdtitle.
REPLACE '&2' WITH ls_activity_h-priority
INTO ls_output_options-tdtitle.
REPLACE '&3' WITH ls_orderadm_h-description
INTO ls_output_options-tdtitle.
*---------- is_mail_appl_obj -------------------------------------------
* fill this parameter if your application object is a BOR object
* the output will be connected with the BOR object via SAP Office
* this is done for mail and fax but not for print outputs
* ------>
* is_mail_appl_obj-LOGSYS =
* is_mail_appl_obj-OBJTYPE =
* is_mail_appl_obj-OBJKEY =
* is_mail_appl_obj-DESCRIBE =
* ------>
*-----------------------------------------------------------------------
*-----------language of smart form--------------------------------------
* determin here the language of the smart form
control_parameters = is_control_parameters.
control_parameters-langu = lv_language.
*-----------------------------------------------------------------------
IF control_parameters-langu <> sy-langu AND control_parameters-preview = 'X'.
*If the language of the smartform stored in control_parameters
*does not match the logon language, get the device type from
*the smartform language. This will allow correct results for
*the print preview of smartforms in different languages / codepages.
lv_devtype = ls_output_options-tdprinter.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = control_parameters-langu
IMPORTING
e_devtype = ls_output_options-tdprinter
EXCEPTIONS
no_language = 1
language_not_installed = 2
no_devtype_found = 3
system_error = 4
OTHERS = 5.
IF sy-subrc <> 0 OR ls_output_options-tdprinter IS INITIAL.
ls_output_options-tdprinter = lv_devtype.
ENDIF.
ENDIF.
*-----------fill archive parameters for archive link -------------------
IF is_output_options-tdarmod = '2' OR
is_output_options-tdarmod = '3'.
* archive_index_tab
READ TABLE ct_archive_index_tab INTO ls_archive_index INDEX 1.
ls_archive_index-object_id = ls_orderadm_h-guid.
IF ls_archive_index-object_id IS INITIAL.
DELETE ct_archive_index_tab INDEX 1.
ELSE.
MODIFY ct_archive_index_tab FROM ls_archive_index INDEX 1.
ENDIF.
ENDIF.
*-----------------------------------------------------------------------
TRY.
* call function to process smart form (new forms)
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 = ip_user_settings
orderadm_h = ls_orderadm_h
activity_h = ls_activity_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
srv_subject_i = lt_srv_subject_i
srv_refobj_h = lt_srv_refobj_h
srv_refobj_i = lt_srv_refobj_i
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
service_i = lt_service_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
* for assignments - begin
service_i_assi = lt_service_i_assi
* for assignments - end
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.
CATCH cx_sy_dyn_call_parameter_error.
* call function to process smart form (old forms)
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 = ip_user_settings
orderadm_h = ls_orderadm_h
activity_h = ls_activity_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
srv_subject_i = lt_srv_subject_i
srv_refobj_h = lt_srv_refobj_h
srv_refobj_i = lt_srv_refobj_i
orderadm_i = lt_orderadm_i
orderadm_i_qt = lt_orderadm_i_qt
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
service_i = lt_service_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
* for assignments - begin
service_i_assi = lt_service_i_assi
* for assignments - end
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.
ENDTRY.
IF sy-subrc = 0.
IF is_control_parameters-preview IS INITIAL.
* determine header guid to set status printed
lo_order ?= io_appl_object.
lv_object_guid = lo_order->get_crm_obj_guid( ).
* set status printed into the crm order
CALL FUNCTION 'CRM_STATUS_SET_INTERN'
EXPORTING
iv_objnr = lv_object_guid
iv_status = gc_status-printed
xnoauto = true
EXCEPTIONS
object_not_found = 1
status_inconsistent = 2
status_not_allowed = 3
OTHERS = 4.
ENDIF.
ELSE.
CASE sy-subrc.
WHEN 1.
MESSAGE e016(sppf_media) INTO dummy.
WHEN 2.
MESSAGE e017(sppf_media) WITH function_name INTO dummy.
WHEN 3.
MESSAGE e018(sppf_media) WITH function_name INTO dummy.
ENDCASE.
CALL METHOD cl_log_ppf=>add_message
EXPORTING
ip_problemclass = '1'
ip_handle = ip_application_log.
ENDIF.
* get error table
CALL FUNCTION 'SSF_READ_ERRORS'
IMPORTING
errortab = et_error_tab.
* fill error into crm_order status
LOOP AT et_error_tab INTO lv_error_tab_wrk
WHERE msgty = gc_msgtype-error.
CALL FUNCTION 'CRM_MESSAGE_COLLECT'
EXPORTING
iv_caller_name = gc_object_name-order
iv_msgno = lv_error_tab_wrk-msgno
iv_msgid = lv_error_tab_wrk-msgid
iv_msgty = lv_error_tab_wrk-msgty
iv_msgv1 = lv_error_tab_wrk-msgv1
iv_msgv2 = lv_error_tab_wrk-msgv2
iv_msgv3 = lv_error_tab_wrk-msgv3
iv_msgv4 = lv_error_tab_wrk-msgv4
* IV_ERROR_RELEVANCE = FALSE
iv_msglevel = gc_msglevel-administrator
EXCEPTIONS
not_found = 1
appl_log_error = 2
OTHERS = 3.
ENDLOOP.
ENDMETHOD.
Hello Dirk,
Well, as far dynamic subject as concern, it is not possible to get a dynamic subject in mails for ChaRM/Service Desk. However, you can include priority of the message in the Body of the mail by writing a small ABAP code.
Hope it helps.
Cheers,
Satish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.