5 Easy Steps To Create A Web Dynpro ABAP Application

Summary: This is a step by step guide for those ABAP consultants who want to try their hand at Web Dynpro ABAP. By following these 5 easy steps anyone who has knowledge of ABAP can create their first fully functioning Web Dynpro ABAP Application which fetches data from an SAP back-end system. This example Web Dynpro Applications displays the personal information of an employee whose personal number (PERNR) is provided.

Step 1. Create Web Dynpro Component

  1. Go to Transaction SE80, choose Web-Dynpro-Comp./Intf in the object list and provide a new name (Y_FIRST_WEBDYNPRO) and click on Display.
    Web dynpro ABAP 1
  2. Confirm you want to create the object by clicking on Yes.
    Web dynpro ABAP 2
  3. Enter the description and choose the Type radio button as Web Dynpro Component.
    Web dynpro ABAP 3

Step 2: Component Controller

  1. Go to Component Controller and Right click on the CONTEXT, select Create and then select Node.

    Web dynpro ABAP 4

    Web dynpro ABAP 4 – Click To See Larger Image

  2. Provide a Node Name as PA0002 and Dictionary Structure as PA0002 and then select Add Attribute from Structure.
    Web dynpro ABAP 5
  3. Select the following attributes from the PA0002 structure.
    Web dynpro ABAP 6
    This is how the context should look like after you have completed Step 2.3.

    Web dynpro ABAP 7

    Web Dynpro ABAP 7 – Click To See A Larger Image

Step 3: Designing the View Layout

  1. Click on MAIN View.
    Web dynpro ABAP 8
  2. Go to the Context in the view and then drag and drop the PA0002 node which appears in Right side (Component Controller) of the View.

    Web dynpro ABAP 9

    Web dynpro ABAP 9 – Click For Larger Image

  3. Now, go to the Layout Tab in View and right click the ROOTUIELEMENTCONTAINER and then choose Insert element.

    Web dynpro ABAP 10

    Web dynpro ABAP 10 – Click To See Larger Image

  4. Provide ID and select type as Label.
    Web dynpro ABAP 11
  5. Again right click the ROOTUIELEMENTCONTAINER and then choose Insert element. Select InputField UI element this time.
    Web dynpro ABAP 12
  6. Now select the EMPLOYEE_NUMBER_LBL and provide the Text property as Employee Number in the Property Editor.
    Web dynpro ABAP 13
  7. Now, we will bind the Value property of the InputField UI element to the context. This is done by clicking on the selected area and then selecting the context attribute PERNR.

    Web dynpro ABAP 14

    Web dynpro ABAP 14 – Click for A Larger Image

  8. This is how the value property will look after binding it with the required Context Attribute.
    Web dynpro ABAP 15
  9. Insert a Button UI element which will be used to fetch the data from the back-end. Bind the event property of the UI element with action SHOW_DETAILS.
    Web dynpro ABAP 16 
  10. Similarly, insert a Label and TextView UI elements for First Name, Last NameDate of Birth and Nationality Output Fields.
    Web dynpro ABAP 17Web dynpro ABAP 19
  11. This is how the ROOTELEMENTCONTAINER should look after all the required UI elements are inserted.
    Web dynpro ABAP 20

Step 4: Adding ABAP Code

  1. Now we will insert Code to the actions that were created in Step 3. Here, we will fetch data from back-end for the employee number entered by the user. Click on the Actions Tab of the View.
    Web dynpro ABAP 21
  2. Double click on SHOW_DETAILS Action
    Web dynpro ABAP 22
  3. Below is a screenshot of the ABAP Code that goes between method and endmethod.ABAP Web Dynpro Code
    Web dynpro ABAP 23
  4. Click on Save and Activate all the inactive objects created in this tutorial.
    Web dynpro ABAP 24

Step 5: Creating Web Dynpro Application

  1. Create Web Dynpro Application by right clicking the Web Dynpro.
    Web dynpro ABAP 25
  2. Give your application a name and description.
    Web dynpro ABAP 26
  3. Right click on the Web Dynpro component and activate it.
    Web dynpro ABAP 27
  4. Output : Right click on the application and select Test to run your application.
    Web dynpro ABAP 28

Output In The Web Browser

Web dynpro ABAP 29

 

Update: A follow on article is now available here: How To Use Inbound And Outbound Plugs In SAP Web Dynpro ABAP Programs

Categories

About the Author:

Pete has been working with SAP technologies for over 10 years. He started out as an ABAP consultant and then moved on to BW where he has worked many different clients covering a wide variety of industries. "I love introducing SAP technology (especially BI) to new clients and showing them how they can go from zero to hero within their business in super fast time". Contact me on twitter @PeterMoxon

5 Comments
  1. JOCA

    This documentation was very helpfull, it is quite simple and easy to follow.

    Could you please provide an example with more than one view using the outbound and inbounds plugs.

    Kind regards and many thanks

    José Carneiro