Redefine method GET_OBJECT_DETAILS

This method is executed in the implementation class whenever the SAP object details are requested from OneList.

In this method, you can define the ABAP logic to retrieve the required details from the SAP object that needs to be passed to OneList. 

Method Parameters

Parameter Type
Parameter Name
Description
Data Type
ImportingIT_TASK_IDOneList Task ID being actioned (SAP workflow work item ID)TT_OL_TASK_ID
ExportingET_OBJ_DETAILTable of object details/IQX/OL_TASK_DETAIL_TT
Exception/IQX/CX_ONELIST_ADAPTERRaised exception during adapter execution

Method Implementation

Custom ABAP logic can be implemented using the import parameters sent by OneList to retrieve the SAP object details that can be sent back to OneList using the export parameter

The export parameter ET_OBJ_DETAIL is a table of type /IQX/OL_TASK_DETAIL_ST with the following structure:

ComponentTypeLengthDescription
TASK_TYPECHAR50IQX - OneList Task Type
ASSIGNEESTABLE
Number of users processing one or more objects
TASK_IDCHAR50IQX - OneList Task ID (FAB Form Inst. or SAP WF WorkItem ID)
TITLESTRING
Title
OBJECT_TYPECHAR50IQX - OneList Object type
OBJECT_IDCHAR100IQX - OneList Object Id
REQUESTORSTRING
Requestor Name
REQUESTED_DATEDATS8Requested Date
DUE_DATEDATS8Due Date
PRIORITYCHAR25Priority
ORIGINAL_ASSIGNEECHAR12User Name of Original Assignee
STATUSCHAR25Status
ACTIONSTABLE
Table type of Actions
DOCUMENTSTABLE
OneList - Document
JSONSTRING
Task detail in JSON format


An example of ABAP code that can be implemented to retrieve Purchase Order details based on the work item number sent by OneList: 

  METHOD get_object_details.

    CONSTANTS: lc_classname   TYPE swr_obj_2-typeid VALUE 'BUS2012',
               lc_catid       TYPE swr_obj_2-catid  VALUE 'BO'.

    DATA: ld_return_code      TYPE sy-subrc,
          lw_leading_object_2 TYPE swr_obj_2,
          lt_objects_2        TYPE STANDARD TABLE OF swr_obj_2,
          ls_po_object        TYPE /iqx/ol_task_detail_st,
          ls_po_detail        TYPE /iqx/ol_purchase_order_st,
          ld_wi_number		  TYPE sww_wiid, 
          ld_po_number        TYPE bapiekko-po_number,
          ld_oid              TYPE os_guid,
          ld_objkey           TYPE swotobjid-objkey,
          ld_classname        TYPE bapibds01-classname,
          ld_classtype        TYPE bapibds01-classtype,
          ld_username         TYPE username,
          ls_address          TYPE bapiaddr3,
          lt_return           TYPE STANDARD TABLE OF bapiret2.

	"Work item number
	ld_wi_number = it_task_id.

    "Get object attached to WorkItem
    CALL FUNCTION 'SAP_WAPI_GET_OBJECTS'
      EXPORTING
        workitem_id      = ld_wi_number
      IMPORTING
        return_code      = ld_return_code
        leading_object_2 = lw_leading_object_2
      TABLES
        objects_2        = lt_objects_2.

    IF lw_leading_object_2 IS INITIAL.
      IF lines( lt_objects_2 ) > 0.
        DELETE lt_objects_2 WHERE catid <> lc_catid.
        READ TABLE lt_objects_2 INTO lw_leading_object_2 WITH KEY catid = lc_catid.
      ENDIF.
    ENDIF.

    CHECK lw_leading_object_2 IS NOT INITIAL.
    ld_po_number = lw_leading_object_2.

    "Get PO detail
    ls_po_detail = me->get_po_detail( id_po_number = ld_po_number ).

    "Only carry on IF PO details having data.
    CHECK ls_po_detail IS NOT INITIAL.

    "Get task header
    ls_po_object = me->get_task_header( id_wi_number = ld_wi_number ).

    "Set object Id
    ls_po_object-object_type = lw_leading_object_2-typeid.
    ls_po_object-object_id = lw_leading_object_2-instid.

    "Get requestor
    IF ls_po_detail-created_by IS NOT INITIAL.
      ld_username = ls_po_detail-created_by.
      CALL FUNCTION 'BAPI_USER_GET_DETAIL'
        EXPORTING
          username = ld_username
        IMPORTING
          address  = ls_address
        TABLES
          return   = lt_return.
      READ TABLE lt_return WITH KEY type = 'E' BINARY SEARCH TRANSPORTING NO FIELDS.
      IF sy-subrc <> 0.
        CONCATENATE ls_address-firstname  ls_address-lastname INTO  ls_po_object-requestor SEPARATED BY space.
      ENDIF.
    ENDIF.

    "Serialize po detail to JSON string
    ls_po_object-json = /iqx/cl_onelist_json_util=>data_to_json( ia_data = ls_po_detail ).

    "Get PO action
    ls_po_object-actions = me->get_po_action( ).

    "Get PO document attachments
    ld_objkey = ld_po_number.
    ld_classname = lc_classname.
    ld_classtype = lc_catid.
    ls_po_object-documents = me->get_bds_documents( id_classname = ld_classname id_classtype = ld_classtype id_objkey = ld_objkey ).

    "Return detail object
    et_obj_detail = ls_po_object.

  ENDMETHOD.

Note

The object detail retrieved from SAP should be serialized into a JSON string which gets passed back to OneList. It is important that the OneList configuration is set up to consume and deserialize the JSON structure accordingly.