Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

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

$
0
0


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)

sap.png



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

img2.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

img5.jpg

 



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

img7.png

 



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


Here I am giving an overview for the creating the .For complete code find the attached "ABAP codedocument" 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.  Creating 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 of 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.

img9.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.

img10.png



Step 8: Right click on the BSP ppplication 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.

img11.png




Step 10: The Item details of given purchase requisition number and two input fields will be displayed when the user gives the

Enter the title and URL click on submit button.

img12.png

 

 

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

img13.png



Step 12: Check weather the URLis added to ME51N transaction or not.

img14.jpg

 

When you double click on title, URL will be opened in the browser...


Viewing all articles
Browse latest Browse all 2548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>