Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 


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)



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.




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



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
                   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 module "SO_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.

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.

5 Comments