SAP-samples / btp-bridge-framework

Create a Microsoft Teams extension app to SAP S/4HANA with JSON configuration.
Apache License 2.0
5 stars 5 forks source link

Navigation in notification adaptive card to item level #22

Closed ABVN-Thien closed 1 year ago

ABVN-Thien commented 1 year ago

Hi Alex,

we are running the scenario for approval of Purchase requisition at item level. We can send notification from event-mesh with configure in notificationConfig.json as:

{
  "BusinessObjectName": "PR",
  "fields": {
    "ReceiverEmailList": "USER_EMAIL",
    "ObjectId": "PR_ID",
    "ActionId": "TASK_ID",
    "Description": "DESCRIPTION",
    "CreatedBy": "CREATED_BY",
    "Others": { "Creation Date": "CREATED_ON", "Priority": "PRIORITY" }
  },
  "DetailScreenConfig": "/frontend/simpleConfig/S4HanaOnPrem/Destination/PurchaseRequisitionItem.json",
  "origSysManagementAppURL": "https://s4hana-onprem-internal-host-ip:port/sap/bc/ui2/flp#PurchaseOrder-manage&/C_PurchaseOrderTP(PurchaseOrder='objectId',DraftUUID=guid'00000000-0000-0000-0000-000000000000',IsActiveEntity=true)"
}

Content of PurchaseRequisitionItem.json:

{
  "pageType": "Object",
  "system": "S4HanaOnPrem",
  "interface": "Destination",
  "businessObject": "PurchaseRequisition/PurchaseRequisitionItem",
  "title": "Purchase Requisition Item",
  "components": [
    {
      "type": "PropertyGrid",
      "properties": [
        {
          "content": "Purchase Requisition ID",
          "key": "PurchaseRequisitionItem"
        },
        {
          "content": "Purchase Requisition Item Category",
          "key": "PurchaseRequisitionItemCategory"
        },
        {
          "content": "Purchase Requisition Item Text",
          "key": "PurchaseRequisitionItemText"
        },
        {
          "content": "Purchasing Group",
          "key": "PurchasingGroup"
        }
      ]
    }
  ]
}

But the page loaded blank. Is it possible to perform such requirement in current version. Our expectation is:

Thank you, Thien

ABVN-Thien commented 1 year ago

Hi Alex, The correct question is how we pass the OData service entity set with 2 keys and map to the Object page.

We can list the item table image Navigate to the next page shows blank because the URL cannot build, the URL in the log is

teams-backend.cfapps.us10-001.hana.ondemand.com - [2023-06-23T07:00:37.612251210Z] "GET /gateway/S4HanaOnPrem/Destination/PurchaseRequisitionItem/10 HTTP/2.0" 404

And the page keeps loading.

sap-weikun commented 1 year ago

Hi Thien,

According to the S/4HANA OnPrem Purchase Requisition API document, it needs PurchaseRequisitionID and PurchaseRequisitionItemID to fetch PR item by ID, so this is the reason why you get a 404 when you trying to get PR item only by PR Item ID.

I would suggest you look into the Bridge Framework backend source code, backend/router/S4HanaOnPrem/OnPremDestinationRouter.js file, when you get a chance. Currently we have method to fetching the Business Object by one ID (line No. 22), and fetching children Business Object by partner's business object ID and its own ID.

So with the current Bridge Framework backend structure, I would say OData service entity set with 2 keys is possible, as long as these 2 keys are partner business object key, and children business object key. Fetching the business object with 2 keys at the same level that is currently not support yet, we will enhance it in the next version.

Best Regards, Weikun Liu

ABVN-Thien commented 1 year ago

Thanks, Weikun. Then, we may try a custom OData service where we can build the combination of keys. Looking forward for the next release.

All the best, Thien