Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Moudle : SAP CRM TECHNICAL

Author: Rasmi Ranjan Pradhan

Hi All,

In one of my requirement, I have to show  a custom Program from web ui view  level means when we click the attribute it will call the program and show the smart forms

This Is my Overview Page and when I click On transaction history View 'Zsmart_form_demo '  then it will show a  z program and from Z program to populate  the smartform

My  challenge is that to call a z program through web-ui

So I got an idea to lunch The program T.code In ui so  I go through the T.code

CRMS_IC_CROSS_SYS

Make a note of logical system and URL also.

And find the link

http://.com:8000/sap/bc/gui/sap/its/webgui/!?~transaction=IC_LTX&~okcode=ICEXECUTE

so my intention is that replace  IC_LTX  with the custom T.code so  I write the code like that in one event.

method eh_ondocflow.
call method super->eh_ondocflow
exporting
htmlb_event    = htmlb_event
htmlb_event_ex = htmlb_event_ex.

data: lv_index
type i, lv_column type string,
lr_coco
type ref to cl_btdocflo_bspwdcomponen_impl, " local coco impl
lr_entity
type ref to cl_crm_bol_entity,
lr_window
type ref to cl_bsp_wd_window,
gv_popup 
type ref to if_bsp_wd_popup,
lv_adminh_obj
type string,
gs_type
type  crmst_docflow_btil.
cl_thtmlb_util=>get_event_info(
exporting
iv_event = htmlb_event_ex
importing
ev_index = lv_index
ev_column = lv_column ).
*   * Find Rec
lr_entity ?= me->typed_context->btdocflow->collection_wrapper->find( iv_index = lv_index ).
*  lv_adminh_obj = lr_entity->get_property_as_string( iv_attr_name = 'CREATED_BY' ).

*  lv_adminh_obj = lr_entity->GET_PROPERTIES( ES_ATTRIBUTES = 'CREATED_BY' ).

*  GET_PROPERTY_AS_VALUE
***  IF NOT GT_ATTR IS  BOUND.
***  gs_type-ref_guid = GT_ATTR-ref_guid.
***  ENDIF.
* iNSERT rec into component controller
lr_coco ?= me->comp_controller.
lr_coco->typed_context->btdocflow->collection_wrapper->clear_collection( ).
lr_coco->typed_context->btdocflow->collection_wrapper->add( iv_entity = lr_entity iv_set_focus = abap_true ).
* Navigate - Select type of navigation based on which link
***  CASE lv_column.
***    when 'id_description'.
***      IF GV_POPUP IS INITIAL.
***        GV_POPUP = COMP_CONTROLLER->WINDOW_MANAGER->CREATE_POPUP( iv_interface_view_name = 'Z05_EMPTY/MainWindow' iv_usage_name = 'CU_OV' iv_title = 'POP_UP' ).
***      endif.
***      GV_POPUP->SET_ON_CLOSE_EVENT( IV_VIEW = ME IV_EVENT_NAME = 'CLOSE_GV_POPUP' ).
***      GV_POPUP->SET_WINDOW_WIDTH( 640 ).
***      GV_POPUP->SET_DISPLAY_MODE( IF_BSP_WD_POPUP=>C_DISPLAY_MODE_SURROUNDED ).
***      GV_POPUP->OPEN( ).
***endcase.
*******bidyut
types:
begin of ty_zcr4_tab,
mandt
type mandt,
objtype_a
type swo_objtyp,
objkey_b
type crmt_doc_flow_id_wrk,
end of ty_zcr4_tab.
data: wa_zcr4_tab
type  ty_zcr4_tab,
it_zcr4_tab
type table of ty_zcr4_tab.

wa_zcr4_tab-mandt = sy-mandt.
wa_zcr4_tab-objtype_a =
'5000040'.
wa_zcr4_tab-objkey_b =
'ZSMART_FORM_DEMO'.
append  wa_zcr4_tab to it_zcr4_tab .
modify zcr4_tab from table it_zcr4_tab.
*************

data: lr_struct_ref
type ref to crmt_gsurlpopup_params,

lr_value_node
type ref to cl_bsp_wd_value_node,

lr_bo_coll   
type ref to if_bol_bo_col,

lw_url_params
type crmt_gsurlpopup_params.


if not gv_popup is bound.

gv_popup ?= comp_controller->window_manager->create_popup(

iv_interface_view_name =
'GSURLPOPUP/MainWindow'

iv_usage_name          =
'CUGSURLPopup'

iv_title               =
'Google'

).

endif.
data: v_its_url
type crmc_ic_boradm-its_url,
f2
type string value 'IC_LTX',
f3
type string value 'Z_SMART_FORM'.
select its_url from crmc_ic_boradm into v_its_url where mapped_logsys = 'CRM'.
endselect.
if v_its_url  ca f2.
replace f2 in v_its_url  with f3.
*   write : / f1.
endif.
lw_url_params-url =
'http://cit47-srvr.ivlgroup.com:8000/sap/bc/gui/sap/its/webgui/!?~transaction=Z_SMART_FORM&~okcode=IC...'.
* replace LC_ltx with 
Z_SMART_FORM

lw_url_params-scrolling = abap_false.


get reference of lw_url_params into lr_struct_ref.


create object lr_value_node
exporting
iv_data_ref = lr_struct_ref.


create object lr_bo_coll

type

cl_crm_bol_bo_col.


lr_bo_coll->add( lr_value_node ).



data lr_ctxt_node type ref to cl_bsp_wd_context_node.



lr_ctxt_node ?= gv_popup->get_context_node( iv_cnode_name =
'PARAMS'   ).



lr_ctxt_node->set_collection(

collection                    = lr_bo_coll

).



gv_popup->open( ).
*  data: f1 type char10 VALUE 'ID1'.
*  data: f2 type char10 .
*  f2 = '5000040'.
* get parameter id 'TDSFNAME' field f1.

*  EXPORT F2 = F2 TO MEMORY ID F1.
**CALL TRANSACTION 'Z_SMART_FORM' AND SKIP FIRST SCREEN.
*  submit Z_SMART_FORM and return.
endmethod.


After that when I click on

A popup will come

Code for the Program

*&---------------------------------------------------------------------*
*& Report  Z_SMART_FORM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report  z_smart_form.
tables: crmd_orderadm_h,
zcr4_tab.

types:
begin of ty_zcr4_tab,
mandt
type mandt,
objtype_a
type swo_objtyp,
objkey_b
type crmt_doc_flow_id_wrk,
end of ty_zcr4_tab.
data: wa_zcr4_tab
type  ty_zcr4_tab,
it_zcr4_tab
type table of ty_zcr4_tab.
data: f1
type zcr4_tab-objtype_a,
f2
type zcr4_tab-objkey_b.

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_***_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.

*data : f2 type TDSFNAME.
* data: f1 type char10 VALUE 'ID1'.

initialization.

*set parameter id 'SSFNAME' field f2.
*  IMPORT f1 FROM MEMORY ID F1.
*  IMPORT f2 = f2 FROM MEMORY ID F1.

*obj_id-low = f2.
start-of-selection.

select single guid into guid from crmd_orderadm_h where object_id = obj_id-low.

select mandt
objtype_a
objkey_b
from zcr4_tab into table it_zcr4_tab .
loop at it_zcr4_tab into wa_zcr4_tab.
f1 = wa_zcr4_tab-objtype_a.
f2 = wa_zcr4_tab-objkey_b.
endloop.
*delete it_ZCR4_TAB .

*IF it_ZCR4_TAB IS NOT INITIAL.
*delete  ZCR4_TAB from  TABLE it_ZCR4_TAB.
*ENDIF.
*delete  ZCR4_TAB from wa_ZCR4_TAB. """""""""
*  delete  ZCR4_TAB FROM  WHERE OBJTYPE_A = wa_ZCR4_TAB-OBJTYPE_A AND
*        OBJKEY_B  = wa_ZCR4_TAB-OBJKEY_B .

if it_zcr4_tab is not initial.
delete  zcr4_tab from  table it_zcr4_tab.
endif.

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             = 'ZSMART_FORM_DEMO'
***      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 =
'ZSMART_FORM_DEMO'
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.

2 Comments
Labels in this area