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.

/wp-content/uploads/2016/07/1_1001706.png

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.

/wp-content/uploads/2016/07/2_1001711.png

/wp-content/uploads/2016/07/3_1001712.png

Navigate to CL_GBAPP_APV_PO_RDP->Methods->Redefinition>/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITY

       

/wp-content/uploads/2016/07/4_1001713.png

Goto GET_HEADER_GOS_ATTACHMENTS method and here write an Implicit enhancement as shown below.

/wp-content/uploads/2016/07/5_1001714.png

/wp-content/uploads/2016/07/7_1001715.png

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.

/wp-content/uploads/2016/07/8_1001716.png

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.

/wp-content/uploads/2016/07/9_1001729.png

/wp-content/uploads/2016/07/10_1001730.png

From the above code the attachment list will be displayed in the App.

/wp-content/uploads/2016/07/11_1001731.png

To download the content of the attachment we have to write code by implementing the Enhancement spot GBAPP_APV_PO.

/wp-content/uploads/2016/07/12_1001732.png

/wp-content/uploads/2016/07/13_1001733.png

After implementing the Enhancement spot using the Custom class. We have to write a piece of code in

IF_GBAPP_EX_APV_PO_RDP~CHANGE_ATTACHMENT_CONTENT_API

The attach key will be a importing parameter for this method .

/wp-content/uploads/2016/07/14_1001734.png

/wp-content/uploads/2016/07/15_1001735.png

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.

/wp-content/uploads/2016/07/16_1001736.png

/wp-content/uploads/2016/07/17_1001737.png

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.

To report this post you need to login first.

18 Comments

You must be Logged on to comment or reply to a post.

  1. Manuel Ramirez

    Hi Pavan, I have the same problem, thank you for the guide.

    I’m trying to implement this, but I can’t find it very clear.

    Can you add the code in text instead of photo?

    If I try to follow what I see in the photos, I find that some variables that you are using are not declared and the code line before the implementation is 91, btu after is 110.

    Can you share what is in between? Are you declaring there the variables that are not declared?

    (0) 
      1. Manuel Ramirez

        Yes, great, thank!

        I’m having some issues like that I don’t have the FM PT_ARQ_ATTACHMENT_DETAIL_GET and the second part is not being triggered by my fiori app, but I guess it will be fine.

        Great post, thanks.

        (0) 
  2. Manuel Ramirez

    Hi Pavan.

    I was trying this. The first part worked fine for me, and I can see now the attachments tab with all the attachments, but the second part is not working, and when I click to download, I’m just getting a blank txt file with name $value,txt

    This is what i did, screen by screen.

    Go to SE18 and select Enhancement Spot GBAPP_APV_PO

    /wp-content/uploads/2016/09/bapi1_1029247.png

    Inside there, go to the second BADi Definition, GBAPP_APV_PO_RDP and select the example class CL_GBAPP_APV_PO_RDP_EXAMPLE

    /wp-content/uploads/2016/09/bapi2_1029317.png

    Then, select the method IF_GBAPP_EX_APV_PO_RDP~CHANGE_ATTACHMENT_CONTENT_API

    /wp-content/uploads/2016/09/bapi3_1029318.png

    Inside there, create an enhancement implementatino and write the code provided.

    /wp-content/uploads/2016/09/bapi4_1029319.png

    To troubleshoot this, I set an external breakpoint inside the enhancement, but is never triggered.

    Do you have any suggestions?

    Thank you in advance.

    Regards.

    (0) 
    1. Pavan Bhumireddy Post author

      Hi

      From the above screenshot i can see that you have written an implicit enhancement in the BADI method.

      There is no need of any implicit enhancement in BADI method. you just have to write the code in the BADI method with out any implicit enhancement.

      You can compare the screenshots of IF_GBAPP_EX_APV_PO_RDP~CHANGE_ATTACHMENT_CONTENT_API done by you and me. you will get to know the issue.

      If you place an external break-point it will get trigger once you solve the above issue.


      Thanks & Regards

      Pavan

      (0) 
          1. Manuel Ramirez

            Thanks, it is triggering now, but still the file is wrong.

            Unfortunatelly, I don’t have PT_ARQ_ATTACHMENT_DETAIL_GET in my system. Do you know some alternative?

            Regards.

            (0) 
  3. Manuel Ramirez

    HI Pavan.

    Finally I did it, it looks fine, but when I download the file, is always a 0 bytes file with name “$value()”.

    I was looking and I found people with a similat issue on Approve Travel request and there is a note for that, but is on the odata for that app.

    Do you have any idea about this?

    Regards.

    (0) 
    1. Pavan Bhumireddy Post author

      Hi Manuel

      If the file size is 0 bytes then the content is not getting transferred, please check it while debugging and try to pass the file content into cs_stream .

      The file name you can pass it in the parameters cv_file_name.

      Also you have to pass the MIME type into cv_mime_type

      I don’t think any SAP Note is required to achieve this functionality.

      Please check the sample code once again and everything is available to resolve the above issue.

      Thanks & Regards

      Pavan

      (0) 

Leave a Reply