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 One List.
Method Parameters
Type | Name | Description |
---|---|---|
Importing | IT_TASK_ID | OneList Task ID being actioned (SAP workflow work item ID) |
Exporting | ET_OBJ_DETAIL | Table of object details |
Exception | /IQX/CX_ONELIST_ADAPTER | Raised 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:
Component | Type | Length | Description |
---|---|---|---|
TASK_TYPE | CHAR | 50 | IQX - OneList Task Type |
ASSIGNEES | TABLE | Number of users processing one or more objects | |
TASK_ID | CHAR | 50 | IQX - OneList Task ID (FAB Form Inst. or SAP WF WorkItem ID) |
TITLE | STRING | Title | |
OBJECT_TYPE | CHAR | 50 | IQX - OneList Object type |
OBJECT_ID | CHAR | 100 | IQX - OneList Object Id |
REQUESTOR | STRING | Requestor Name | |
REQUESTED_DATE | DATS | 8 | Requested Date |
DUE_DATE | DATS | 8 | Due Date |
PRIORITY | CHAR | 25 | Priority |
ORIGINAL_ASSIGNEE | CHAR | 12 | User Name of Original Assignee |
STATUS | CHAR | 25 | Status |
ACTIONS | TABLE | Table type of Actions | |
DOCUMENTS | TABLE | OneList - Document | |
JSON | STRING | 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:
Code Block |
---|
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.
|