Skip to Content
0
Former Member
Jan 20, 2011 at 06:00 PM

Z-Button - How to call a Action Profile to Open a PDF-Doc. within an Event?

50 Views

Hi Experts,

we have created a Z-Button that afterwards creates an event. In the coding for the event an Action Profile should be called and a PDF-Document should be opened. We have copied the coding from the standard button 'Print Preview' which is calling the standard event: EH_ONPRINT_PREVIEW.

We have also defined a Z Action Profile which is a copie of SERVICE_CONFIRMATION. Our problem is we don't know how why our Z-Action Prodile is not called? What is the class lr_actioncontext (TYPE REF TO cl_crm_bol_entity)?

DATA: lr_cn               TYPE REF TO cl_bsp_wd_context_node,
        lr_adminh           TYPE REF TO cl_crm_bol_entity,
        lr_actioncontext    TYPE REF TO cl_crm_bol_entity,
        lv_adminh_guid      TYPE string,
        lv_url              TYPE string,
        lc_head_context     TYPE REF TO cl_doc_context_crm_order,
        lt_item_context     TYPE ppftctxpos,
        iv_header_guid      TYPE crmt_object_guid,
        lif_decision_pop    TYPE REF TO if_bsp_wd_popup,
        lv_string           TYPE string.

  CHECK gv_print_preview_enabled = abap_true.

  lr_cn = me->get_context_node( gc_cn_btadminh ).
  CHECK lr_cn IS BOUND.

  lr_adminh ?= lr_cn->collection_wrapper->get_current( ).
  CHECK lr_adminh IS BOUND.

  lv_adminh_guid   =  lr_adminh->get_property_as_string( iv_attr_name = 'GUID' ).
  lr_actioncontext = lr_adminh->get_related_entity( iv_relation_name = 'BTHeaderAction' ). "#EC NOTEXT

  CLEAR gt_print_actions.
  CLEAR gr_action_popup.

  iv_header_guid = lv_adminh_guid.

  CALL METHOD cl_crm_uiu_actions_tools=>get_action_definition
    RECEIVING
      rv_action_def = lv_string.

  CALL METHOD cl_crm_uiu_actions_tools=>show_print_actions_popup
    EXPORTING
      ir_action_context       = lr_actioncontext
      ir_parent_node          = lr_adminh
      ir_view_controller      = me
      ir_component_controller = comp_controller
      iv_event_name           = gc_ev_print_preview_closed
      iv_for_preview          = abap_true
      iv_appl_guid            = lv_adminh_guid
    IMPORTING
      et_actions              = gt_print_actions
      ev_url                  = lv_url
    CHANGING
      cr_decision_popup       = gr_action_popup.

  IF lv_url IS NOT INITIAL.
    call_print_preview_popup( lv_url ).
  ENDIF.

Best Regards