Skip to Content


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

Prerequisites

  • 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)

/wp-content/uploads/2015/09/sap_785872.png



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

/wp-content/uploads/2015/09/img2_785969.png



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

/wp-content/uploads/2015/09/img5_785976.jpg



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

/wp-content/uploads/2015/09/img7_785981.png



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
                   EXPORTING
          name 
= c_url
        RECEIVING
                      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
                    EXPORTING
          name 
= 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.

/wp-content/uploads/2015/09/img9_786197.png

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.

/wp-content/uploads/2015/09/img10_786599.png



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.

/wp-content/uploads/2015/09/img11_786600.png




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.

/wp-content/uploads/2015/09/img12_786601.png

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

/wp-content/uploads/2015/09/img13_786744.png



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

/wp-content/uploads/2015/09/img14_794175.jpg

To report this post you need to login first.

5 Comments

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

  1. Raghu Prasad

    Hi Girish,

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

    Standard class:

    CL_UA_RFC_CONNECTOR->ATTACHMENT_CREATE

    Standard BAPI:

    UA_RFC_PDCE_ATTACHMENT_CREATE

    Keep going.

    Regards,

    B Raghu Prasad.

    (0) 
    1. Girish Kumar Vedurupaka Post author

      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

      (0) 
      1. Raghu Prasad

        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.

        Regards,

        B Raghu Prasad

        (0) 

Leave a Reply