Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
raja_thangamani
Active Contributor
0 Kudos

Introduction: This blog describes how to display/delete the documents, which are stored in any SAP Business transactions like MM01, IE01, VA01, FB01 and WTY etc from Webdynpro Java.  

 

If you have not read the Organize your business attachments from Web & How To: Create attachments in Business Transaction from Webdynpro(Java), I would recommend to read those before you continue this blog.

 

Let's look at the outcome of this blog before we get into the details.

 

Note: We will display & delete those documents, which we created in How To: Create attachments in Business Transaction from Webdynpro(Java) of this series blog.

 

  1. Let's say my Material master has 2 attachments as shown below.
  2. Using this Webdynpro Application we will view/delete those attachments in web.
  3. Once you execute the WDJ Application, enter the Object Key Number for which you already created the attachment. In our case Material number is the object key. Click Submit. The list of attachment will be shown as below:
  4. In order to view the attachment, click on File name (Link), the attachment will be shown in pop as below:
  5. Let's look at the delete functionality. Select anyone of the line & click on delete button and click 'Yes' for confirmation. 
  6. You will get the confirmation after successful deletion of document

 

Let's look at the development steps:

 

Below is the Java webdynpro application which will look like once you are done with the development:

 

  1. Create the webdynpro project say Display_attachment and Application DisplayAttachmentt
  2. Import the BAPI which will get the attachment list & details from SAP to webdynpro by right clicking the Model. RFC detail will be explained later in this document.
  3. In following screen, choose "Import Adaptive RFC Model" also enter the necessary details 
  4. Once Model is imported successfully, add the model into webdynpro component by right clicking "Used Model" as shown below.

  5. Create the view Display_AttachmentView & create the below context node & attributes:
  6. Node AttachmentList cardinality is 0:n, selection is 0:1
  7. Attribute details are below:

    Attribute

                                    Type

    Date

    date

    Display_Doc

    com.sap.ide.webdynpro.uielementdefinitions.Resource

    DocContent

    string

    DocName

    string

    DocumentID

    string

    DocumentType

    string

    Material_No

    string

  8. The layout looks like below:
  9. Create the Event handler say "submit" and assign it to Submit button. This method will bring the list of attachments from SAP. Below is the code for the same & related methods:


  10. Create the event handler say "Displayattachment" and assign into Link (AttachmentList.DocName). This will be used to view the document. Below is the Code for the same:


  11. Create the event handler say "Delete" and assign into "Delete" button.

     
  12. RFC to get attachment List:


  13. Use RFC FM ''BDS_DOCUMENT_GET_TABLE' to display the attachment content.


  14. To delete the attachment use RFC "BDS_DOCUMENT_DELETE".

 

Download: Here is the ready to use Project file Display_attachment.

 

Hope I covered all the points & add some value to community over here...

5 Comments
Labels in this area