LetsWebDynpro.PartIISAPYard
SAP YARD
TUTORIALS
CODE SNIPPETS
HELP FORUM
SAP QUIZ
15
Shares
Transparent Container
Enteremail
Subscribe
Subscribe!
Follow@sapyard
NOVEMBER 3, 2014
http://www.sapyard.com/letswebdynpropartii/
1/31
10/30/2016
LetsWebDynpro.PartIISAPYard
In Part I, we gave you a very basic overview of Web Dynpro. In this part we
will create one Web Dynpro Application.
Before we develop our rst Web Dynpro application, let me ask, what steps
do you follow while writing a normal ABAP program/report in SE38/SE80,
which has a selectionscreen; an output screen and a custom transaction
code?
15
Shares
http://www.sapyard.com/letswebdynpropartii/
SAPYard
656likes
Liked
Youand2otherfriendslikethis
Subscribe!
Abapinho
7MostPopular&FeaturedArticles
10/30/2016
LetsWebDynpro.PartIISAPYard
Lets assume the requirement of your functional speci cation says: Create a
Portal screen which would display the SAP users rst name and last name. Use
table view USER_ADDR to retrieve data.
Fiori App - An
Introduction from an
ABAPer
NetworkedBlogs
Blog:
SAPYard
Topics:
Abap,Sap,Hana
Give a meaning description and name (as shown in next picture) for your
default/main Window and View. Name it as per your project standard.
Usually we have WI_ or W_ for windows and VI_ or V_ for views. Then save it.
Give appropriate package and transport number else save it as local object if
you do not want to move to next environment. Now you have created your
rst WD component which is empty.
http://www.sapyard.com/letswebdynpropartii/
Followourblog
3/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
http://www.sapyard.com/letswebdynpropartii/
NOVEMBER 3, 2014
4/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Right click the CONTEXT ->Create-> Node. This is the name of your
structure used in selection screen parameter. We generally use CN_ for
context node and CA_ forcontext attribute. Give a meaningful name and hit
enter.
http://www.sapyard.com/letswebdynpropartii/
Subscribe!
5/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
You created a structure, but it is empty. You need elds in the structure to
make it complete. Right click on the context name CN_SELECTION_SCR >Create->Attribute; give a name and data-type of the eld and save and
activate all the objects of the components. This is theglobal variable for the
selection screen.
http://www.sapyard.com/letswebdynpropartii/
Subscribe!
6/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
As I mentioned in PART I, the global variable are not directly available to the
views. We need to make the view know that the global variable
(CN_SELECTION_SCR) would be used in that view. This can be done by
dragging the COMPONENT CONTROLLER Context attribute to View
Context. Expand the View in the left panel. Double click on the view name.
Click the Context Tab on the right Panel. On the right panel there is a split.
Left for View and Right side for COMPONENT CONTROLLER Context. Left
click on the CONTEXT CN_SELECTION_SCR hold and drag and put it on top
of V_MAIN CONTEXT on the left. This is like USING/CHANGE Parameters of
SUB ROUTINE (PERFORMS) in normalprogram.
http://www.sapyard.com/letswebdynpropartii/
7/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
8/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Now let us de ne an input parameter for the screen (just like we do in SE38).
Right click on Transparent Container and create Input eld.
http://www.sapyard.com/letswebdynpropartii/
Subscribe!
9/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
This is just a variable, but what data would it hold? We will link this input
eld to the USERID eld de ned in the context CN_SELECTION_SCR. Click
on the yellow icon on the right side of value property and bind it with
USERID. It is just like our PARAMETERS: P_INPUT TYPE XUBNAME. Any
value entered in this parameter in selection screen is passed to P_INPUT and
it can be used in the whole program.
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
10/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Let us give a meaningful label to the selection screen parameter. Just like in
SE38, we create Selection Screen text, in the similar way, a LABEL UI
element tagged to Input Field would act as its text, which would be displayed
in the selection screen. Right click on Transparent Container and create the
Label. Populate the Label For eld.
http://www.sapyard.com/letswebdynpropartii/
Subscribe!
11/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
http://www.sapyard.com/letswebdynpropartii/
Subscribe!
12/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
Let us look how the window looks. In the main window, the default main
view is assigned. So, whatever we have designed till now is available to be
http://www.sapyard.com/letswebdynpropartii/
13/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
http://www.sapyard.com/letswebdynpropartii/
Subscribe!
14/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
15/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
Now you can execute it by F8 or by right clicking the application and Test.
16/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Link an action to the button. Click on the create icon on the right of
onAction Events property. Give a meaningful name and description to the
action. A method is created for this action in the background as shown.
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
17/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
18/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
So output type is de ned but it is not yet linked to any variable. Let us create
three input elds in a transparent container and link the values to
corresponding elds in the CONTEXT CN_USER_DETAIL. Below it is shown
for only USERID. We need to do for all three.
http://www.sapyard.com/letswebdynpropartii/
19/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Since these three attributes would be used for display only, let us check the
displayOnly property for all three.
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
20/31
10/30/2016
LetsWebDynpro.PartIISAPYard
You would like to see the three attribute in one row, not in one column. For
this we need to change the layout type to Matrix Layout. We would speak
more about Flow, Matrixdata and Matrix Head data layout in subsequent
sessions.
15
Shares
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
21/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
It has the input eld and the execute button. But, what will the button do,
we have still not de ned the data extraction and displaylogic.
Step 6: Start of Selection:
Read the value entered by user in the INPUT Field USERID in the portal
screen. This can be easily done by reading the CONTEXT which is linked to
http://www.sapyard.com/letswebdynpropartii/
22/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
Check the READ radio button and then hit the CONTEXT and choose the
CONTEXT eld which is bound/linked to the INPUT eld. Hit enter. All the
http://www.sapyard.com/letswebdynpropartii/
23/31
10/30/2016
LetsWebDynpro.PartIISAPYard
code is generated foryou. Remove the commented code and some check
codes which are not needed for our scenario. Whatever user enters in
IP_USERID eld in selection screen is available invariable lv_userid.
15
Shares
Now, whatever data you want to display in the three attribute of the output
context, we need to SET them, i.e. we can use the same magic wand to SET
the CN_USER_DETAILcontext as shown.
http://www.sapyard.com/letswebdynpropartii/
Subscribe!
24/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
The LS_CN_USER_DETAIL structure would display the user details. But, the
structure is still empty. We need to select the data and populate
thestructure. We will write a simple select statement and populate the
structure as shown.
http://www.sapyard.com/letswebdynpropartii/
25/31
10/30/2016
LetsWebDynpro.PartIISAPYard
PS: This is the only piece of code we write for this application.. Isnt it awesome..
15
Shares
Uffff !!! We have done all steps. Fetched data based on input eld and
populated the output structure. And linked all the UI elements to the
underlying context.
Subscribe!
Let us test our rst baby..Let me enter an SAP user id present in our system
and hit the Get Data button. Abracadabra Details are displayed..
http://www.sapyard.com/letswebdynpropartii/
26/31
10/30/2016
LetsWebDynpro.PartIISAPYard
This was one of the simple valid project requirements. Please do not smile, this
was one of the requirement in one of our project..
We would add on the
complexity and explore the different features of Web Dynpro in subsequent
parts. Till then,please play around this component and stay tuned.
In Part III,we would create more than one input elds, a button and a table
with multiplelines as output.
15
Shares
If you need any explanation in any steps shown, please leave your comment or
email us your query. We would be happy to elaborate.
If you want to get practical issues and resolutions straight to your inbox, please
SUBSCRIBE. We respect your privacy and take protecting it seriously.
If you liked this post, please hit the share button at the left side of your screen.
Thank you very much for your time!!
Subscribe!
27/31
10/30/2016
LetsWebDynpro.PartIISAPYard
Shares
10
Subscribe!
0
http://www.sapyard.com/letswebdynpropartii/
28/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Previous post
5 COMMENTS
Next post
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
29/31
10/30/2016
LetsWebDynpro.PartIISAPYard
Regards,
http://www.SAPYard.com
Arun Kumar | February 23, 2015 at 12:49 pm | Reply
Hi Guys,
Can u pls check this post :
http://scn.sap.com/thread/3701858
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
30/31
10/30/2016
LetsWebDynpro.PartIISAPYard
15
Shares
Subscribe!
http://www.sapyard.com/letswebdynpropartii/
31/31