Integration of customer workflows

As described in the Initial Configuration the configuration expects a setup which workflow user decision step has to be pushed. Doing this we register the decision tasks for the ONE collector. Since each workflow is custom there is a need to implement an enhancement through explicit Enhancement Spots on your SAP system to read the related workflow data. This implementation will be held in custom namespace mostly Z* or Y*.

Example

The BAdI Enhancement spot /APPS/ONE_ENH_SPOT ONE gets enhanced though custom implementation class ZCL_BADI_IMPL_ONE_BANF

The call implements the interface method /APPS/ONE_IF_BADI~CHANGE_DATA where each decision task has to be processed so be able to be consumed by Sitrion ONE.

Method parameters:

Example of Purchase Requisition Task integration:

*    Purchase requisition decision task
IF iv_wi_head-wi_rh_task EQ 'TS99200002'.      

    " get related objects to work item - need to evaluate banf number
    CALL FUNCTION 'SAP_WAPI_GET_OBJECTS'
      EXPORTING
        workitem_id = iv_wi_head-wi_chckwi
        language    = sy-langu
      TABLES
        objects_2   = lt_objects.

    READ TABLE lt_objects INTO ls_object WITH KEY typeid = 'BUS2105' catid = 'BO'.
    IF sy-subrc EQ 0.
      lv_banfnr = ls_object-instid.
    ENDIF.


CHECK lv_banfnr IS NOT INITIAL.
" read related purchase requisition data
    CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'
      EXPORTING
        number                         = lv_banfnr
        account_assignment             = 'X'
        item_texts                     = 'X'
        services                       = 'X'
        service_texts                  = 'X'
      TABLES
        requisition_items              = requisition_items
        requisition_account_assignment = requisition_account_assignment
        requisition_text               = requisition_text
        requisition_limits             = requisition_limits
        requisition_contract_limits    = requisition_contract_limits
        requisition_services           = requisition_services
        requisition_services_texts     = requisition_services_texts
        requisition_srv_accass_values  = requisition_srv_accass_values
  
*    convert SAP data to ONE à ct_data[]
      "Purchase Requisition ID
    ls_data-order_no  = lv_ordernr.
    ls_data-key       = 'BANFNR'.
    CONCATENATE '<![CDATA[' lv_banfnr ']]>' INTO ls_data-value.
    APPEND ls_data TO ct_data.
    CLEAR ls_data.
    lv_ordernr = lv_ordernr + 1.

      "evaluate all related items
    LOOP AT requisition_items ASSIGNING <ls_requisition_items>.
      ls_data-order_no  = lv_ordernr.
      CONCATENATE 'ITEM_'     <ls_requisition_items>-preq_item '_CREATED_BY'  INTO ls_data-key.
      CONCATENATE '<![CDATA[' <ls_requisition_items>-created_by ']]>'         INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

      "Product
      ls_data-order_no  = lv_ordernr.
      CONCATENATE 'ITEM_'     <ls_requisition_items>-preq_item '_ARTICLE'  INTO ls_data-key.
      CONCATENATE '<![CDATA[' <ls_requisition_items>-short_text ']]>'      INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

      "Quantity
      ls_data-order_no  = lv_ordernr.
      lv_tmp_string     = <ls_requisition_items>-quantity.
      CONDENSE lv_tmp_string.
      lv_quantity       = <ls_requisition_items>-quantity.
      CONCATENATE 'ITEM_'     <ls_requisition_items>-preq_item '_QUANTITY'  INTO ls_data-key.
      CONCATENATE '<![CDATA[' lv_tmp_string ']]>' INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

*    "UNIT
      ls_data-order_no  = lv_ordernr.
      CONCATENATE 'ITEM_' <ls_requisition_items>-preq_item '_UNIT' INTO ls_data-key.
      CONCATENATE '<![CDATA[' <ls_requisition_items>-unit ']]>' INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

      "PRICE
      ls_data-order_no  = lv_ordernr.
      lv_tmp_string     = <ls_requisition_items>-c_amt_bapi.
      CONDENSE lv_tmp_string.
      lv_price  = <ls_requisition_items>-c_amt_bapi.
      CONCATENATE 'ITEM_' <ls_requisition_items>-preq_item '_PRICE' INTO ls_data-key.
      CONCATENATE '<![CDATA[' lv_tmp_string ']]>' INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

      "PRICE per UNIT
      ls_data-order_no  = lv_ordernr.
      lv_tmp_string     = <ls_requisition_items>-price_unit.
      CONDENSE lv_tmp_string.
      lv_price_unit     = <ls_requisition_items>-price_unit.
      CONCATENATE 'ITEM_' <ls_requisition_items>-preq_item '_PRICE_UNIT'  INTO ls_data-key.
      CONCATENATE '<![CDATA[' lv_tmp_string ']]>' INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

      "CURRENCY
      ls_data-order_no  = lv_ordernr.
      CONCATENATE 'ITEM_'     <ls_requisition_items>-preq_item  '_CURRENCY'  INTO ls_data-key.
      CONCATENATE '<![CDATA[' <ls_requisition_items>-currency   ']]>'        INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

      "Position sum
      lv_pos_sum = lv_price * lv_quantity.
      ls_data-order_no  = lv_ordernr.
      lv_tmp_string     = lv_pos_sum.
      CONDENSE lv_tmp_string.
      CONCATENATE 'ITEM_' <ls_requisition_items>-preq_item '_POS_SUM'  INTO ls_data-key.
      CONCATENATE '<![CDATA[' lv_tmp_string ']]>' INTO ls_data-value.
      APPEND ls_data TO ct_data.
      CLEAR ls_data.
      lv_ordernr = lv_ordernr + 1.

      lv_ges_sum = lv_ges_sum + lv_pos_sum.

    ENDLOOP.

    "total sum evaluation
    ls_data-order_no  = lv_ordernr.
    lv_tmp_string     = lv_ges_sum.
    ls_data-key       = 'ITEM_TOTAL_SUM'.
    CONCATENATE '<![CDATA[' lv_tmp_string ']]>' INTO ls_data-value.
    APPEND ls_data TO ct_data.
    CLEAR ls_data.
    lv_ordernr = lv_ordernr + 1.


  ENDIF. "decision task end

Share this page
X
Tell your colleagues and friends about Sitrion. Choose a social channel below to share this page.