Skip to Content

BSP application which adds external document (URL) to the purchase requisition

This blog explains how to create an URL attachments to the purchase requisition using BSP application.


  • Basic knowledge on BSP applications, OOABAP and HTML.

Creating URL’s manually from SAP

We can create URL attachments manually by going to transaction ME51N

click on “services for Object” button-> Create->Create External Document(URL)


You will get the popup, please enter title and address and click on green tick shown in the below screen shot.


Now the URL will be saved to the SAP.

img 3.png

Step by step procedure to create URL attachments using BSP application.

Step 1: Let’s create BSP application using transaction SE80, choose BSP application from the drop down and give the name of the application.

Step 2: Right click on the BSP application and create the controller

img 4.png

Step 3: Create Controller class in the controller as shown in the below screen shot


Step 4: Place the cursor on DO_REQUEST method and click on redefine button.


Step 5: we are going to Implement our logic within the DO_REQUEST method.

Here I am giving an overview for the creating the .For complete code find the attached “ABAP code document” in this blog.

Follow the below steps for URL attachments.

  i. Get all the form field values using the method “get_form_field”

    For example

              CALL METHOD request->get_form_field
= c_url
                      value = lv_url.

ii.  Create the reference for the View(UI).

       r_obj_view = create_view( view_name = ‘zcreateexturl_view.htm’ ).  

iii.  To specify that the purchasing document is purchase requisition,use the bus type as  BUS2105 and pass as parameter to the below function module.

iv. Use the Standard function moduleSO_FOLDER_ROOT_ID_GET” to get the folder root ID(All the URL attachments are stored under this folder ).

v. We are going to pass the Pass title and URL as parameters to the function module  “SO_OBJECT_INSERT”. This function module will create the object Id.

vi. To make the necessary changes to the database create the binary relation and commit it. Now the Title and URL will be attached to the purchase requisition.

vii. Send the response back to the UL using the method set_attribute. weather created successfully or failed.

For Example :

             CALL METHOD r_obj_view->set_attribute
= c_message
                        value = lv_message.

Step 6: Right click on the BSP application create the page and choose radio button “View” as shown in the below screen shot.


Click on the Layout tab using HTML Code design the UI.

Please find the HTML code in the attached “BSP Code document”

Step 7: Declare page attributes as shown in the below screen shot. The values for the below variables are being sent from the controller.


Step 8: Right click on the BSP application and test it. You will be navigated to browser.


***Note: Before you test it make sure both the CONTROLLER and VIEW should be activated.***

Step 9: Give the purchase requisition number and hit enter.


Step 10: The Item details of given purchase requisition number and two input fields will be displayed.

Enter the title and URL click on submit button.


Step 11: If you get the status message, your URL will be attached to the purchase requisition successfully


Step 12: Check weather the URL is added to purchase requisition(ME51N) or not.


You must be Logged on to comment or reply to a post.
  • Hi Girish,

    Nicely documented, but however SAP already provided some standard classes and BAPI's which serves the same functionality.

    Standard class:


    Standard BAPI:


    Keep going.


    B Raghu Prasad.

    • Hi Raghu,

      As you said SAP has given some functionalities,but there are some problems which i have faced with the standard ones, for example if i used standard one some of them were raising the popup to enter the values, it works within the SAP where as from out side of sap i.e from browser it doesn't work. As per my analysis and knowledge I understand that the  flow is getting the root folder and storing the URL attachments in the folder as standard  sap was doing, I have implemented it in my application.The standard functionalities you mentioned was helpful...

      Thanks and Regards,

      Girish Kumar

      • Hi Girish,

        I understand there were some problems that you have faced. You could have mentioned the problems in the blog that you faced while working on the browser.

        By the way, try the BAPI: "UA_RFC_PDCE_ATTACHMENT_CREATE", It should work.


        B Raghu Prasad