Print duplicate service ticket form in CRM

...Previous

5.    Now what? This should definitely print the output of the service ticket number entered.

6.    Sample code:

REPORT zcrmd_order.
TABLES: crmd_orderadm_h.
"--------- Selection Screen --------"
SELECTION-SCREEN BEGIN OF BLOCK crm WITH FRAME TITLE text-001.
SELECT-OPTIONS: obj_id FOR crmd_orderadm_h-object_id NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK crm.
DATA: wa_cparam TYPE ssfctrlop,
      wa_output TYPE ssfcompop,
      ssf_name TYPE tdsfname,
      func_mod_name TYPE rs38l_fnam.
DATA: es_output_orderadm_h      TYPE  crmt_output_orderadm_h_com,
      es_output_activity_h      TYPE  crmt_output_activity_h_com,
      es_output_lead_h          TYPE  crmt_output_lead_h_com,
      es_output_opport_h        TYPE  crmt_output_opport_h_com,
      es_output_orgman_h        TYPE  crmt_output_orgman_h_com,
      es_output_pricingdata_h   TYPE  crmt_output_pricingdata_h_com,
      es_output_sales_h         TYPE  crmt_output_sales_h_com,
      es_output_shipping_h      TYPE  crmt_output_shipping_h_com,
      et_output_partner_h       TYPE  crmt_output_partner_h_comt,
      et_output_payplan_d_h     TYPE  crmt_output_payplan_d_h_comt,
      es_output_customer_h      TYPE  crmt_output_customer_h_com,
      es_output_cumulat_h       TYPE  crmt_output_cumulat_h_com,
      et_output_billing_h       TYPE  crmt_output_billing_h_comt,
      et_output_cancel_h        TYPE  crmt_output_cancel_h_comt,
      et_output_appointment_h   TYPE  crmt_output_appointment_h_comt,
      et_output_billplan_d_h    TYPE  crmt_output_billplan_d_h_comt,
      et_output_billplan_h      TYPE  crmt_output_billplan_h_comt,
      et_output_status_d_h      TYPE  crmt_output_status_d_h_comt,
      et_output_srv_subject_h   TYPE  crmt_output_srv_subject_h_comt,
      et_output_srv_subject_i   TYPE  crmt_output_srv_subject_h_comt,
      et_output_srv_refobj_h    TYPE  crmt_output_srv_refobj_h_comt,
      et_output_srv_refobj_i    TYPE  crmt_output_srv_refobj_h_comt,
      et_output_srv_reason_h    TYPE  crmt_output_srv_reason_h_comt,
      et_output_srv_result_h    TYPE  crmt_output_srv_result_h_comt,
      es_output_acs_h           TYPE  crmt_acs_h_com,
      et_output_orderadm_i      TYPE  crmt_output_orderadm_i_comt,
      et_output_orgman_i        TYPE  crmt_output_orgman_i_comt,
      et_output_pricingdata_i   TYPE  crmt_output_pricingdata_i_comt,
      et_output_pricing_i       TYPE  crmt_output_pricing_i_comt,
      et_output_product_i       TYPE  crmt_output_product_i_comt,
      et_output_sales_i         TYPE  crmt_output_sales_i_comt,
      et_output_shipping_i      TYPE  crmt_output_shipping_i_comt,
      et_output_schedlin_i      TYPE  crmt_output_schedlin_i_comt,
      et_output_partner_i       TYPE  crmt_output_partner_i_comt,
      et_item_cstics_i          TYPE  crmt_item_cstics_tab,
      et_output_customer_i      TYPE  crmt_output_customer_i_comt,
      et_output_billing_i       TYPE  crmt_output_billing_i_comt,
      et_output_cancel_i        TYPE  crmt_output_cancel_i_comt,
      et_output_finprod_i       TYPE  crmt_output_finprod_i_comt,
      et_output_ordprp_i        TYPE  crmt_output_ordprp_i_comt,
      et_output_ordprp_i_d      TYPE  crmt_output_ordprp_i_d_comt,
      et_output_ordprp_objl_i_d TYPE  crmt_output_ordprp_objl_i_comt,
      et_output_appointment_i   TYPE  crmt_output_appointment_i_comt,
      et_output_billplan_d_i    TYPE  crmt_output_billplan_d_i_comt,
      et_output_billplan_i      TYPE  crmt_output_billplan_i_comt,
      et_output_orderadm_i_qt   TYPE  crmt_output_orderadm_i_qt_comt,
      et_output_orderadm_i_in   TYPE  crmt_output_orderadm_i_in_comt,
      et_output_schedlin_i_cf   TYPE  crmt_output_schedlin_i_cf_comt,
      et_output_status_i        TYPE  crmt_output_status_i_comt,
      et_output_service_i       TYPE  crmt_output_service_i_comt,
      et_output_wrk_set_e_s_bbp TYPE  /1cn/working_set_e_s_bbp_t,
      ev_language               LIKE  sy-langu,
      et_output_service_i_assi  TYPE  crmt_output_service_i_ass_comt,
      es_output_buag_h          TYPE  crmt_output_buag_h_com,
      et_output_buag_i          TYPE  crmt_output_buag_i_comt,
      et_output_price_agmts_h   TYPE  /1cn/working_set_e_s_crm_t,
      et_output_price_agmts_i   TYPE  /1cn/working_set_e_s_crm_t,
      et_output_status_h        TYPE  crmt_output_status_h_comt,
      guid                      TYPE  crmt_object_guid.
SELECT SINGLE guid INTO guid FROM crmd_orderadm_h WHERE object_id = obj_id-low.
IF NOT guid IS INITIAL.
  wa_cparam-no_dialog = 'X'.
  wa_cparam-preview = 'X'.
  wa_output-tddest = 'LP01'.
  wa_output-tdtitle = 'Order Confirmation'.
  wa_output-tdnewid = 'X'.
  wa_output-tdimmed = 'X'.
  wa_output-tdcopies = '001'.
  CALL FUNCTION 'CRM_OUTPUT_SINGLE_READ'
    EXPORTING
      iv_smart_form             = 'ZSRV_TICKET'
      iv_guid                   = guid
    IMPORTING
      es_output_orderadm_h      = es_output_orderadm_h
      es_output_activity_h      = es_output_activity_h
      es_output_lead_h          = es_output_lead_h
      es_output_opport_h        = es_output_opport_h
      es_output_orgman_h        = es_output_orgman_h
      es_output_pricingdata_h   = es_output_pricingdata_h
      es_output_sales_h         = es_output_sales_h
      es_output_shipping_h      = es_output_shipping_h
      et_output_partner_h       = et_output_partner_h
      et_output_payplan_d_h     = et_output_payplan_d_h
      es_output_customer_h      = es_output_customer_h
      es_output_cumulat_h       = es_output_cumulat_h
      et_output_billing_h       = et_output_billing_h
      et_output_cancel_h        = et_output_cancel_h
      et_output_appointment_h   = et_output_appointment_h
      et_output_billplan_d_h    = et_output_billplan_d_h
      et_output_billplan_h      = et_output_billplan_h
      et_output_status_d_h      = et_output_status_d_h
      et_output_srv_subject_h   = et_output_srv_subject_h
      et_output_srv_subject_i   = et_output_srv_subject_i
      et_output_srv_refobj_h    = et_output_srv_refobj_h
      et_output_srv_refobj_i    = et_output_srv_refobj_i
      et_output_srv_reason_h    = et_output_srv_reason_h
      et_output_srv_result_h    = et_output_srv_result_h
      et_output_status_h        = et_output_status_h
      es_output_acs_h           = es_output_acs_h
      et_output_orderadm_i      = et_output_orderadm_i
      et_output_orgman_i        = et_output_orgman_i
      et_output_pricingdata_i   = et_output_pricingdata_i
      et_output_pricing_i       = et_output_pricing_i
      et_output_product_i       = et_output_product_i
      et_output_sales_i         = et_output_sales_i
      et_output_shipping_i      = et_output_shipping_i
      et_output_schedlin_i      = et_output_schedlin_i
      et_output_partner_i       = et_output_partner_i
      et_item_cstics_i          = et_item_cstics_i
      et_output_customer_i      = et_output_customer_i
      et_output_billing_i       = et_output_billing_i
      et_output_cancel_i        = et_output_cancel_i
      et_output_finprod_i       = et_output_finprod_i
      et_output_ordprp_i        = et_output_ordprp_i
      et_output_ordprp_i_d      = et_output_ordprp_i_d
      et_output_ordprp_objl_i_d = et_output_ordprp_objl_i_d
      et_output_appointment_i   = et_output_appointment_i
      et_output_billplan_d_i    = et_output_billplan_d_i
      et_output_billplan_i      = et_output_billplan_i
      et_output_orderadm_i_qt   = et_output_orderadm_i_qt
      et_output_orderadm_i_in   = et_output_orderadm_i_in
      et_output_schedlin_i_cf   = et_output_schedlin_i_cf
      et_output_status_i        = et_output_status_i
      et_output_service_i       = et_output_service_i
      et_output_wrk_set_e_s_bbp = et_output_wrk_set_e_s_bbp
      ev_language               = ev_language
      et_output_service_i_assi  = et_output_service_i_assi
      es_output_buag_h          = es_output_buag_h
      et_output_buag_i          = et_output_buag_i
      et_output_price_agmts_h   = et_output_price_agmts_h
      et_output_price_agmts_i   = et_output_price_agmts_i.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname = 'ZSRV_TICKET'
    IMPORTING
      fm_name  = func_mod_name.
  CALL FUNCTION func_mod_name
    EXPORTING
      control_parameters  = wa_cparam
      output_options      = wa_output
      user_settings       = 'X'
      orderadm_h          = es_output_orderadm_h
      activity_h          = es_output_activity_h
      opport_h            = es_output_opport_h
      orgman_h            = es_output_orgman_h
      partner_h           = et_output_partner_h
      pricingdata_h       = es_output_pricingdata_h
      sales_h             = es_output_sales_h
      shipping_h          = es_output_shipping_h
      payplan_d_h         = et_output_payplan_d_h
      cumulat_h           = es_output_cumulat_h
      customer_h          = es_output_customer_h
      acs_h               = es_output_acs_h
      billing_h           = et_output_billing_h
      cancel_h            = et_output_cancel_h
      appointment_h       = et_output_appointment_h
      billplan_d_h        = et_output_billplan_d_h
      billplan_h          = et_output_billplan_h
      status_d_h          = et_output_status_d_h
      status_h            = et_output_status_h
      srv_subject_h       = et_output_srv_subject_h
      srv_reason_h        = et_output_srv_reason_h
      srv_result_h        = et_output_srv_result_h
      orderadm_i          = et_output_orderadm_i
      orderadm_i_qt       = et_output_orderadm_i_qt
      orderadm_i_in       = et_output_orderadm_i_in
      orgman_i            = et_output_orgman_i
      pricingdata_i       = et_output_pricingdata_i
      pricing_i           = et_output_pricing_i
      product_i           = et_output_product_i
      sales_i             = et_output_sales_i
      schedlin_i          = et_output_schedlin_i
      schedlin_i_cf       = et_output_schedlin_i_cf
      shipping_i          = et_output_shipping_i
      partner_i           = et_output_partner_i
      item_cstics_i       = et_item_cstics_i
      customer_i          = et_output_customer_i
      billing_i           = et_output_billing_i
      cancel_i            = et_output_cancel_i
      finprod_i           = et_output_finprod_i
      ordprp_i            = et_output_ordprp_i
      appointment_i       = et_output_appointment_i
      billplan_d_i        = et_output_billplan_d_i
      billplan_i          = et_output_billplan_i
      status_i            = et_output_status_i
      working_set_e_s_bbp = et_output_wrk_set_e_s_bbp
      language            = ev_language
    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.
ELSE.
  MESSAGE 'Ticket does not exists' TYPE 'I'.
ENDIF.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image