In the standard SAP Fiori App for the PO Approval , when the attachments are created as store business documents option (Which will be saved on the content server) these were not displayed in the App.
By following the below steps the attachment list can be displayed in the Fiori APP.
After creating the PO in SAP ECC the Attachments are attached to the PO using Business Object services as shown above and the objective is to show the above list in the SAP Fiori App.
As per the SAP note instructions 1937715, the addon will be installed on Backend system which creates the below package.
Navigate to CL_GBAPP_APV_PO_RDP->Methods->Redefinition>/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITY
Goto GET_HEADER_GOS_ATTACHMENTS method and here write an Implicit enhancement as shown below.
We will be getting the PO number as the input parameter for this method. With the PO number get all the list of attachments data using the Standard FM ARCHIV_GET_CONNECTIONS.
Fill the ET_ATTACHMENTS internal table by preparing and moving the data as shown.
For object ID, attach GUID from the connections data, get the MIME filed from the standard FM by passing the reserve filed of the connection data.
Get the description from the table TOASP by passing the AR Object and the language
Calculate the size by getting the content of the attachment using standard FM PT_ARQ_ATTACHMENT_DETAIL_GET.
From the above code the attachment list will be displayed in the App.
To download the content of the attachment we have to write code by implementing the Enhancement spot GBAPP_APV_PO.
After implementing the Enhancement spot using the Custom class. We have to write a piece of code in
The attach key will be a importing parameter for this method .
By passing the attach key to the standard FM ARCHIV_GET_CONNECTIONS we can get the attachment details.
Get the Content of the attachment using the standard FM PT_ARQ_ATTACHMENT_DETAIL_GET.
Get the description of the downloaded file by getting the File description from the table toasp by passing the connection data and the language
Concatenate the file description along with the file extension and get the MIME type from the standard FM SDOK_MIMETYPE_GET.
If we click on the attachment it will download the file to the space on the local disk.
In this way we can achieve the functionality of attaching the Documents of different types which gets saved on content server for a purchase order in Fiori APP.