Hi Fiori Consultants!
Let’s come straight to the point. Yup, there is a problem with Fiori PO and PR apps attachments. When attachment is stored in Content Server. Attachment stored in content server are not displayed in the said apps. I came across a post on SCN addressing the same problem.
I really liked that approach but we had the same issue and we catered it with somewhat a different approach. I am going to explain that and that somewhat simpler one.
So here we are, we have an attachment problem in SAP Fiori Standard PO and PR apps. Please find below the steps to know how to get attachments to these apps from Content Server.
I am assuming that you are done with the BADI implementation for the apps, we get methods there to address our changes in those methods, also shown below.
Now if we are done with the above step then we will move ahead, if not then follow this document.
Moving towards the next step. Now go to method CHANGE_HEADER_DETAILS_INFO_API of your class as shown below:
Now go to Structure of CS_HEADER_DETAILS_X that is: GBAPPS_APV_PO_IT_X_HNI as shown below:
Now go to attachment Table Type as shown below and add a field for your attachment URL.
Now we are done with adding a field in our attachment structure and that field in now the part of structure GBAPPS_APV_PO_IT_X_HNI.
Next step is to go in BADI implementation for Field extensibility as shown below:
Go to method: IF_GBAPP_EX_APV_PO_MDP~ENHANCE_GW_SERVICE_ENTITY_MDP
Here you have to register your field you just added to your Attachment structure so that it should be visible in Fiori App. From now onwards we are going to fetch attachments and send to Fiori app.
For this purpose, we have to go back to method IF_GBAPP_EX_APV_PO_RDP~CHANGE_HEADER_DETAILS_INFO_API and call the standard FM: ARCHIVOBJECT_GET_URI. Here we will pass BUSOBJECT, PO Number, Location to this FM and it will return all the attachments stored against the respective PO Number.
LT_URI contains all the attachments against one PO. Now just loop through the internal to fill in the details.
And finally move the attachment table to original Header table.
In Frontend we just have to map the new custom field to attachment control and attachment would be visible!
Hurray! We are done with the attachment issue in PO. Repeat the same procedure for Approve Purchase Requisition app.
Please let me know how did you find this post.