Create URL (With Parameters) Launcher Button On View1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Define Global Data context

Now Add button

Define URL

Define URL parameters

Create transaction launcher

Define Logical Link

In Navigation Bar profile Define Generic Outbound Plug Mappings

In IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW method of TL handler


class ZCL_NOTIF_APPOINTMENT_TL add code to add the URL parameters

METHOD if_crm_ic_action_handler~prepare_data_flow.
DATA: __gdc
TYPE REF TO if_crm_ui_data_context,
__source TYPE
string,
__line
TYPE
string,
__path
TYPE
crmt_ic_ac_identify_path.
DATA: lv_notif_no TYPE crm_isu_qmnum,
lv_sydate
TYPE syst_datum,
lv_date
TYPE string,
lv_value
TYPE string.
__source = 'ZSELECTED_SERVICE_NOTIFICATION/NOTIF_NO'.
__gdc ?=
cl_crm_ui_data_context_srv=>get_instance( gv_view_controller ).
********** Begin of parameter declaration ***********

IF __gdc IS BOUND.
TRY.
CALL METHOD __gdc->get_entity_attribute_as_value
EXPORTING
path = __source
IMPORTING
value = lv_notif_no.
CATCH cx_crm_bdc_no_data cx_crm_bdc_xpath_error cx_root.
CLEAR lv_notif_no .
ENDTRY.
ENDIF.

CLEAR lv_value.
lv_value = 'BnLogin'.
add_parameter(
iv_name = 'task'
iv_value = lv_value ).
CLEAR lv_value.
lv_value = 'run'.
add_parameter(
iv_name = 'action'
iv_value = lv_value ).
CLEAR lv_value.
lv_value = 'DCC800'.
add_parameter(
iv_name = 'username'
iv_value = lv_value ).
CLEAR lv_value.
lv_value = 'ic21demo'.
add_parameter(
iv_name = 'password'
iv_value = lv_value ).
CLEAR lv_value.
lv_value = 'yes' .
add_parameter(
iv_name = 'automaticLogin'
iv_value = lv_value ).
CLEAR lv_value.
lv_value = 'BnFreeTimeSlots'.
add_parameter(
iv_name = 'task'
iv_value = lv_value ).
CLEAR lv_value.
lv_value = 'load'.
add_parameter(
iv_name = 'action'
iv_value = lv_value

).

CLEAR lv_value.
lv_value = lv_notif_no.
add_parameter(
iv_name = 'callId'
iv_value = lv_value ).
CLEAR lv_value.
lv_value = '1'.
add_parameter(
iv_name = 'actionNo'
iv_value = lv_value ).

lv_sydate = sy-datum.

format date into DD+MMM+YYYY+00:00


CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
input = lv_sydate
IMPORTING
output = lv_date.

CLEAR lv_value.
CONCATENATE lv_date+3(2) '+' lv_date+0(3) '+' lv_date+6(4) '+' '00:00'
INTO lv_value.
add_parameter(
iv_name = 'dateFrom'
iv_value = lv_value ).
me->add_source_session( ).

* Data flow is complete - set to false if data is missing


gv_data_flow_complete = abap_true.

In the event handler method set the entity in the GDC and call the Generic
Outbound Plug Mapping
DATA: lv_index
TYPE i,
lr_entity
TYPE
lr_gdc
TYPE
lr_nav_descr TYPE
lr_msg
TYPE
lr_navigation TYPE
lr_col
TYPE
.

REF
REF
REF
REF
REF
REF

TO
TO
TO
TO
TO
TO

cl_crm_bol_entity,
if_crm_ui_data_context,
if_bol_bo_property_access,
cl_bsp_wd_message_service,
if_crm_ui_navigation_service,
cl_crm_bol_bo_col

cl_thtmlb_util=>get_event_info(
EXPORTING
iv_event = htmlb_event_ex
IMPORTING
ev_index = lv_index
).
lr_entity ?= me->ztyped_context->isuservicenotification>collection_wrapper->get_current( ).
IF lr_entity IS BOUND.
* set GDC for invoice
lr_gdc ?= cl_crm_ui_data_context_srv=>get_instance( iv_controller =
me ).
TRY.
CALL METHOD lr_gdc->set_entity
EXPORTING
name = 'ZSELECTED_SERVICE_NOTIFICATION'
value = lr_entity.
CATCH cx_crm_ui_dc_param_not_defined .
ENDTRY.

* navigate to transaction launcher


CALL METHOD cl_crm_ui_descriptor_obj_srv=>create_ui_object_based
EXPORTING
iv_ui_object_type
= 'ZAPPOINTMENT_BOOK'
iv_ui_object_action = 'B'
RECEIVING
rr_result
= lr_nav_descr.
CHECK lr_nav_descr IS BOUND.
lr_navigation = cl_crm_ui_navigation_service=>get_instance( me ).
CHECK lr_navigation IS BOUND.
CREATE OBJECT lr_col TYPE cl_crm_bol_bo_col.
CHECK lr_col IS BOUND.
lr_col->if_bol_bo_col~add( lr_nav_descr ).
lr_navigation->navigate_dynamically( iv_data_collection = lr_col ).
ENDIF.

You might also like