Skip to Content

When you click on an action button in CIC0 you will execute some front-office process. You will get the reference to the current BOR object but sometimes you need to get additional objects from the clipboard. Here is a small piece of code that retrieves all the BOR objects from the clipboard. This can be a method in a class, or a function.

FUNCTION zcs_cic0_get_clipboard.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  EXPORTING
*"     VALUE(E_CONTAINER) TYPE  SWLOBJECTS_T
*"----------------------------------------------------------------------
* Code inspired by standard function CCM_HAB_EXECUTE
  DATA: lt_subscrn TYPE TABLE OF ewcomobj INITIAL SIZE 6,
        ls_subscrn TYPE ewcomobj,
        lt_xtsc    TYPE cic0_objif,
        lt_xtainer TYPE ewcnt_xtain,
        lt_mkl     TYPE cic0_objif,
        lt_marked  TYPE ewcnt_element_list.
  DATA: ls_cont TYPE ewcnt_cont,
        ls_def  TYPE ewcnt_def.
  DATA: ls_object TYPE swc_object,
        ls_swlobj TYPE swlobjects.
* get neccessary interfaces of used Objects
* this direct call to the workbench is unflexible
* there should be a mechanism to 'call my caller'
  CALL FUNCTION 'CIC_GET_WORKBENCH_COMPONENTS'
    EXPORTING
      x_handle  = 1
    TABLES
      y_objects = lt_subscrn.
* look for xtainer source (clipboard) associated to action
* In 4.6A there is only one clipboard component possible
  LOOP AT lt_subscrn INTO ls_subscrn.
    ewcom_get_interface ls_subscrn 'XTSOURCE' lt_xtsc.
    IF sy-subrc = 0.
      EXIT.
    ENDIF.
  ENDLOOP.
* get clipboard objects
  ewcom_call_xtsource_get lt_xtsc lt_xtainer.
  IF sy-subrc = 0.
*   get marklist
    ewcom_get_interface lt_xtsc 'MARKLIST' lt_mkl.
    ewcom_call_marklist_get lt_mkl lt_marked.
  ENDIF.
* convert to BOR objects
  LOOP AT lt_xtainer-def INTO ls_def
                        WHERE reftype = 'O'.
    swc_get_element lt_xtainer-cont ls_def-element ls_object.
    IF sy-subrc = 0.
      swc_get_object_key  ls_object ls_swlobj-objkey.
      swc_get_object_type ls_object ls_swlobj-objtype.
      ls_swlobj-element = ls_def-element.
      ls_swlobj-tab_index = ls_def-editorder.
      APPEND ls_swlobj TO e_container.
    ENDIF.
  ENDLOOP.
ENDFUNCTION.

Of course you need some reference to the includes that contain the definitions.


TYPE-POOLS: ewcnt.
INCLUDE:
    <cntn01>,
    ccm_macros,
    iebamac1,
    iebacons,
    iewcom_gen,
    iewcom_xtsource,
    iewcom_xtsink,
    iewcom_marklist,
    iewcom_searchpar,
    cic_events_okcodes_activities.

With this function it is now possible to get reference to multiple BOR objects from the CIC0 clipboard.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply