Вы находитесь на странице: 1из 23

Getting Started Newsletters Store

Products Services & Support About SCN Downloads


Industries Training & Education Partnership Developer Center
Lines of Business University Alliances Events & Webinars Innovation
Login Regi ster Welcome, Guest Search the Community
Activity Communications Actions
Browse
Web Dynpro ABAP 116 Posts
1 3 4 5 6 7 8
Previous Next
Direct Mapping Reverse Mapping
Please refer to picture 6.26. Please refer to picture 6.28.
Component: Component:
Y_EM_CONTEXT : Y_EM_CONTEXT_RM :
1. get records from Database 1. get records from Database
2. doesn't contain any view 2. a view to embed interface view
3. define a node STUDENT with attribute 3. define usage of component Y_EM_LAYOUT_RM
Interface Node: Yes (can access by other component) 4. define a InterfaceController_usage, mapping Student to that of
Y_EM_LAYOUT_RM.
Input Element: NO (can't Input by other comp. ) 5. In WDDOINIT, append some records to Node STUDENT.
4. In WDDOINIT, append some records to Node STUDENT. Y_EM_LAYOUT_RM:
Y_EM_LAYOUT: 1. show records in a table
1. show records in a table 2. define a node STUDENT with attribute
2. define usage of component Y_EM_CONTEXT Interface Node: Yes (can access by other component)
3. mapping the two STUDENT from Y_EM_CONTEXT and
Y_EM_LAYOUT in tab context.
Input Element: Yes ( Input by Y_EM_CONTEXT_RM)
372 Views 0 Comments Tags: web_dynpro, mapping, direct, reverse
Direct and Reverse mapping
Posted by he longyang Apr 10, 2013
Below are the highlights of the new SAP Corbu theme for Web Dynpro ABAP.

Corbu Theme for WebDynpro ABAP
Posted by Tarun Telang Apr 8, 2013
Highlights of the new SAP Corbu theme for Web Dynpro ABAP:
A new modern, simple looking theme with improved overall look;
Neutral design with light panes and flat surfaces
Reduced contrasts & gradients create a light and clear user interface
Color: Reduced use of neutral and dimmed colors increases the compatibility with other SAP designss
Structure: Less structuring and separating elements to support a flat and lightweight appearance
Correct Prioritization: Visual focus is on the content, instead of on navigation and functions
Tables & Containers: Reduced colors and line contrast creates a less block-like appearance
Increased font sizes to improve readability
Readability: Enlarged and easier to read typography, for example, larger font
Enhanced look for specific controls
new panel stack visualizations
new calendar design
Large set of new icons and pictograms that are modernized with new theme without affecting existing icons in
older themes -
new icon style with 16 x16 pixel size icons
All icons referenced as ~Icon/* are automatically replaced, based on the used theme.
Icons from the old icon library, referenced as ICON_* or @nn@ are not automatically replaced.

Prerequisite
SAP Corbu theme is available for the following support packs:
NW 731 SP02
the new theme is delivered with further optimizations in NW 731 SP03 and SP04

How To Apply Corbu Theme to Web Dynpro for ABAP application
To apply or activate the newly-delivered SAP CORBU theme you have to simply append the URL parameter
&sap-theme=sap_corbu to your application
(otherwise by default Wedynpro for ABAP applications use the SAP Tradeshow Plus theme. )


Development Effort Required
the Corbu theme works for all WD ABAP applications out of the box with no additional development effort.
Please perform visual verification of UIs to ensure no truncation of texts or misalignment occurs due to increased font
sizes and line height
3806 Views 17 Comments Tags: web_dynpro, webdynpro, web_dynpro_abap, webdynpro_abap, abap_wd
Hi,
can any one provide clarity on these plz




Thanks
Aashish
146 Views 0 Comments Tags: web_dynpro
Difference among component configuration,
application configration and controller configuration?
Posted by SAP WD Mar 13, 2013
Please find the list of step need to perform to achieve the handling of event from source view to target view .
Raising the event from one view and handling the
same event in another view .
Posted by Om Awasthi Feb 1, 2013

Step 1 . Identify the source view from where the event will be triggered.

Step 2 . Identify the target view where the event should be handled.

Step 3 . Register the listener name, handle name , controller and event name in the targeted view .
Listener name name of the view where even will be handled.
Handler name the method in the target view which will handle the event raised in source view
Controller name Name of the component controller used.
Event name Name of the event which is raised.
Sample code for target view written in DOINIT method .

DATA: lo_componentcontroller TYPE REF TO ig_componentcontroller,
lo_api_componentcontroller TYPE REF TO if_wd_component.

lo_api_componentcontroller->add_event_handler(
listener_name = 'V_MAIN'
handler_name = 'OK_HANDLE_MAIN'
controller_name = 'COMPONENTCONTROLLER'
event_name = 'OK_CLICKED_MAIN' ).

Step 4 . you want the target view to handle the source view event just raise the event which is declared in component
controller like below :
wd_comp_controller->fire_ok_clicked_main_evt( ) .


Resultant : Now once the ok_clicked_main event is raised from source view , the same event can be handled in the
target view method OK_HANDLE_MAIN . You can perform any action/population in this method .
1075 Views 0 Comments Tags: web_dynpro, web_dynpro_abap, webdynpro_abap, abap_wd
We have published a survey ( link) to check with Web Dynpro ABAP community, if they want a more modern and
productive development environment for Web Dynpro ABAP applications development.
The results were quite positive and ABAP in Eclipse is going in the direction to provide support for Web Dynpro
ABAP applications development.

ABAP in Eclipse 2.0 is just out as trial. Refer to blog to check how to download it: SCN Trial: ABAP Development
Tools 2.0

ABAP in Eclipse doesn't come bundled with Theme editor.Theme editor is available as standalone delivery which you
can use to edit Web Dynpro Themes.
What about having Theme Editor installed within ABAP in Eclipse IDE !!!
One of the main objectives of ABAP in Eclipse was to bring all development scenario's into one IDE. Using eclipse as
a base it is enabled automatically.

Execute following steps to install Theme Editor in ABAP in Eclipse:
1. Open the link Theme Editor download link
2. Download "Eclipse PlugIn" from the list of available downloads
3. Install ABAP in Eclipse. Follow the blog to check exact steps: Enabling ABAP in Eclipse
4. Open ABAP in Eclipse.
5. Go to Help->Instal New Software and choose Add option.
6. Choose "Archive" option and select the zip file downloaded from step 2.
7. Follow the wizard. ABAP in Eclipse will be restarted
And you have Theme editor installed in ABAP in Eclipse. Now, you can do your ABAP development and also edit Web
Dynpro ABAP themes using same IDE.
Refer to the document (Link) to know more about theme editor:
1211 Views 1 Comments Tags: abap, abap_in_eclipse, web_dynpro_abap
Edit Web Dynpro ABAP themes in ABAP in Eclipse
Posted by Ashwani Kumar Sharma Jan 31, 2013
Steps of calling of different component from select option F4 and using the value which are selected in different
component
1. Create a component ZTEST. This component will have our select option . Also make component usage of
WDR_SELECT_OPTIONS in the used components. In our example we have made GC_SELECT1 .

2. Go to main view . Make a components add the component usage from step 1 ( which is created in component
controller )


3. Create a viewContainer UI element in your MAIN view.

4. Add the WND_SELECTION_SCREEN view in the viewContainer UI element . Go to MAIN window , expand the
window and in the viewContainer UI element right click and embed .

5. Code in DOINIT method of view to create select option with a m_value_help_id = GC_SELECT1 which is created
as a used component.
6. Go to WDR_SELECT_OPTIONS component . Click on enhancement . add the component which you wants to add
which should be called at the click of select option .


7. Once added when you click on select option F4 the component added in WDR_SELECT_OPTIONS is
called .


8 . What ever value are entered can be passed back to the select option from where it is called .
Calling of different component from select option F4
and using the value which are selected in different
component
Posted by Om Awasthi Jan 25, 2013
254 Views 0 Comments Tags: web_dynpro, webdynpro, web_dynpro_abap, webdynpro_abap, abap_wd
Step to read the selected data from the table in webdynpro abap.
1. Create a method for the table in the property onselect ( like get_data ) . Please find the screen shot below .
2. Declare the internal table and work area for the attribute to fetch which is selected.
3. Give the reference to the table which you want to have use method get_selected_elements for the node
which is declared above to fetch the data .
4. Loop the selected elements and extrat the exact data which is present in the selected instance .

Sample code

DATA : lt_sel_elem TYPE wdr_context_element_set.
FIELD-SYMBOLS <ls_sel_elem> TYPE REF TO if_wd_context_element.

DATA lo_nd_n_result TYPE REF TO if_wd_context_node.

DATA ls_n_result TYPE wd_this->element_n_result.
DATA lt_n_result TYPE wd_this->elements_n_result.

* navigate from <CONTEXT> to <N_RESULT> via lead selection
lo_nd_n_result = wd_context->get_child_node( name = wd_this->wdctx_n_result ).

* @TODO handle non existant child
* IF lo_nd_n_result IS INITIAL.
* ENDIF.

CALL METHOD lo_nd_n_result->get_selected_elements
RECEIVING
set = lt_sel_elem.

**fetching selected entries
LOOP AT lt_sel_elem ASSIGNING <ls_sel_elem> .
CALL METHOD <ls_sel_elem>->get_static_attributes
IMPORTING
static_attributes = ls_n_result.
APPEND ls_n_result TO lt_n_result .
ENDLOOP.
1172 Views 0 Comments
Tags: abap, web_dynpro, web_dynpro_abap, webdynpro_abap, webdynproabap, webdynpro_f or_abap
Read selected values from table in webdynpro ABAP
Posted by Om Awasthi Jan 25, 2013
Method invocation queue
Posted by Uwe Kunath Jan 24, 2013
Popups in Webdynpro for ABAP are annoying
Recently I had the pleasure to show one of these "Are you sure?" popups in the UI. The issue with popups in
webdynpro is, due to the web based architecture, the fact that there is no real synchronous program flow as we were
used to in SAP GUI.
Instead of stopping the program flow when a popup is shown, the Webdynpro runtime continues in order to fulfill the
HTTP web request.
This means, instead of receiving the result of the user's decision right after the popup call, we usually need to
implement callback methods which are called when the user presses either "Ok", "No" and so on.
In the sample this would be the view's method ONACTIONAPPLY_CONFIRM.


Did you recognize line 29 - 34? Actually, what is done here is the preparation of the backend call which is to be
executed depending on the user's decision. The method parameters are already stored in some attributes and read
for later purpose.
In the callback method, the backend invocation might look like the code below.

Every parameter that will conditionally passed to the backend will have to be stored somewhere.
You do this kind of work one time, maybe two times or three times and you are going to be annoyed at it.
Couldn't this behaviour be achieved easier and more conventiently?

What is a method invocation queue?
A method invocation queue records method calls for later execution. Instead of storing parameters for later usage,
you will store the objects and their method calls including parameters for later usage. As ABAP still lacks function
pointers we will need to implement it manually.
Compare the above shown coding, starting at line 29 with this one.
Looks more complicated at the beginning. But the big advantage of this concept is, that you will now only have to keep
track of the method invocation queue, not method parameters. No further attributes are required.
Actually, using the fluent API, you could write lines 6 to 8 in just one single line.

The popup's callback method now looks like this.
01. DATA lo_comp_api TYPE REF TO if_wd_component.
02. DATA lo_controller_api TYPE REF TO if_wd_controller.
03. DATA ls_config TYPE wdr_popup_to_confirm.
04. DATA: lt_text_table TYPE string_table,
05. lv_text_table TYPE string,
06. lv_title TYPE string.
07. ls_config-button_cancel-enabled = abap_false.
08. lo_controller_api = wd_this->wd_get_api( ).
09. lo_comp_api = wd_comp_controller->wd_get_api( ).
10. lv_title = 'Are you sure?'.
11. lv_text_table = 'Really???'.
12. APPEND lv_text_table TO lt_text_table.
13. TRY.
14. CALL METHOD cl_wd_popup_factory=>popup_to_confirm
15. EXPORTING
16. component = lo_comp_api
17. text = lt_text_table
18. window_title = lv_title
19. configuration = ls_config
20. RECEIVING
21. popup_to_confirm = wd_this->mo_popup.
22. wd_this->mo_popup->subscribe_to_events(
23. controller = lo_controller_api
24. handler_name = 'ONACTIONAPPLY_CONFIRM' ).
25. *retrieve backend call parameters
26. DATA lv_p1 TYPE i.
27. DATA lv_p2 TYPE string.
28. *...retrieve parameters
29. *store backend call parameters in the view's attributes
30. wd_this->mv_p1 = lv_p1.
31. wd_this->mv_p2 = lv_p2.
01. METHOD ONACTIONAPPLY_CONFIRM.
02. CHECK wd_this->mo_popup->answer = if_wd_popup_to_confirm=>co_button_1_pressed.
03. wd_this->mo_some_weird_backend->perform_some_weird_operation( iv_p1 = wd_this->mv_p1 iv_p2 = wd_this->mv_p2 )
04. ENDMETHOD.
01. *retrieve backend call parameters and record backend calls
02. DATA lv_p1 TYPE i.
03. DATA lv_p2 TYPE string.
04. *...retrieve parameters
05. wd_this->mo_method_queue = zcl_method_queue=>new_method_invocation( ).
06. wd_this->mo_method_queue->with( wd_this->mo_some_weird_backend )->on( 'perform_some_weird_operation' ).
07. wd_this->mo_method_queue->add_parameter( iv_name = 'iv_p1' iv_value = lv_p1 ).
08. wd_this->mo_method_queue->add_parameter( iv_name = 'iv_p2' iv_value = lv_p2 ).
01. METHOD ONACTIONAPPLY_CONFIRM.
02. CHECK wd_this->mo_popup->answer = if_wd_popup_to_confirm=>co_button_1_pressed.
03. wd_this->mo_method_queue->flush( ).
04. ENDMETHOD.

Interested?
So here is the coding. Please be aware, this is just experimental and not meant for productive usage.
This code lacks the support of any other parameter type than IMPORTING parameters as well as proper exception
handling. However you may consider to enhance it and write about what you found out ;-)
01. CLASS zcl_method_queue DEFINITION
02. PUBLIC
03. FINAL
04. CREATE PROTECTED .
05. PUBLIC SECTION.
06. TYPE-POOLS abap .
07. CLASS-METHODS new_method_invocation
08. RETURNING
09. value(ro_method_queue) TYPE REF TO zcl_method_queue .
10. METHODS with
11. IMPORTING
12. !io_caller TYPE REF TO object
13. RETURNING
14. value(ro_method_queue) TYPE REF TO zcl_method_queue .
15. METHODS on
16. IMPORTING
17. !iv_method TYPE seocpdname
18. RETURNING
19. value(ro_method_queue) TYPE REF TO zcl_method_queue .
20. METHODS add_parameter
21. IMPORTING
22. !iv_name TYPE abap_parmname
23. value(iv_value) TYPE any
24. RETURNING
25. value(ro_method_queue) TYPE REF TO zcl_method_queue .
26. METHODS finalize .
27. METHODS flush
28. RAISING
29. zcx_method_queue .
30. PROTECTED SECTION.
31. TYPES:
32. BEGIN OF ty_s_method_invocation,
33. caller TYPE REF TO object,
34. method TYPE seocpdname,
35. parameters TYPE abap_parmbind_tab,
36. END OF ty_s_method_invocation .
37. DATA ms_method_invocation TYPE ty_s_method_invocation .
38. DATA:
39. mt_method_invocations TYPE TABLE OF ty_s_method_invocation .
40. METHODS copy_value
41. IMPORTING
42. !ir_ref TYPE REF TO data
43. RETURNING
44. value(rr_ref) TYPE REF TO data .
45. METHODS constructor .
46. PRIVATE SECTION.
47. ENDCLASS.
48. CLASS ZCL_METHOD_QUEUE IMPLEMENTATION.
49. METHOD add_parameter.
50. ro_method_queue = me.
51. DATA ls_parameter TYPE abap_parmbind.
52. DATA lr_value TYPE REF TO data.
53. ls_parameter-name = iv_name.
54. TRANSLATE ls_parameter-name TO UPPER CASE.
55. ls_parameter-kind = cl_abap_objectdescr=>exporting.
56. GET REFERENCE OF iv_value INTO lr_value.
57. ls_parameter-value = copy_value( lr_value ).
58. INSERT ls_parameter INTO TABLE ms_method_invocation-parameters.
59. ENDMETHOD. "add_parameter
60. METHOD constructor.
61. ENDMETHOD. "CONSTRUCTOR
62. METHOD copy_value.
63. FIELD-SYMBOLS <lv_in> TYPE any.
64. FIELD-SYMBOLS <lv_out> TYPE any.
65. ASSIGN ir_ref->* TO <lv_in>.
66. CREATE DATA rr_ref LIKE <lv_in>.
67. ASSIGN rr_ref->* TO <lv_out>.
68. <lv_out> = <lv_in>.
69. ENDMETHOD.
70. METHOD finalize.
71. CHECK: ms_method_invocation-caller IS NOT INITIAL AND ms_method_invocation-method IS NOT INITIAL.
72. APPEND ms_method_invocation TO mt_method_invocations.
73. CLEAR: ms_method_invocation.
74. ENDMETHOD.
75. METHOD flush.

Drawbacks of this approach
However, there's no such thing as a free lunch.
If you decide to use such a method invocation queue, you lose the where-used-list support of your backend's
methods.
Also, you can only access real backend methods and not component controller methods, as they are accesssible for
their views or windows, but not for any other objects, unless these methods are declared public.

So stay careful, be watchful and enjoy...
557 Views 0 Comments Tags: abap, web_dynpro, webdynpro, popup, popup_window, method_queue
76. FIELD-SYMBOLS <ls_call> TYPE ty_s_method_invocation.
77. DATA lo_cx_root TYPE REF TO cx_root.
78. DATA lo_objectdescr TYPE REF TO cl_abap_classdescr.
79. DATA lo_cx_sy_dyn_call_illegal_meth TYPE REF TO cx_sy_dyn_call_illegal_method.
80. DATA ls_method TYPE abap_methdescr.
81. DATA lv_has_method_been_called TYPE abap_bool.
82. DATA lv_count TYPE i.
83. DATA lt_method_parts TYPE string_table.
84. DATA lv_method_name TYPE string.
85. finalize( ).
86. LOOP AT mt_method_invocations ASSIGNING <ls_call>.
87. TRY.
88. CALL METHOD <ls_call>-caller->(<ls_call>-method) PARAMETER-TABLE <ls_call>-parameters.
89. CATCH cx_sy_dyn_call_illegal_method INTO lo_cx_sy_dyn_call_illegal_meth.
90. * no such method - try to call named method in any interface that the current object might implement
91. lv_has_method_been_called = abap_false.
92. lo_objectdescr ?= cl_abap_classdescr=>describe_by_object_ref( <ls_call>-caller ).
93. LOOP AT lo_objectdescr->methods INTO ls_method.
94. TRY.
95. lv_method_name = ls_method-name.
96. SPLIT lv_method_name AT '~' INTO TABLE lt_method_parts.
97. FIND <ls_call>-method IN TABLE lt_method_parts MATCH COUNT lv_count.
98. IF lv_count > 0.
99. CALL METHOD <ls_call>-caller->(ls_method-name) PARAMETER-TABLE <ls_call>-parameters.
100. lv_has_method_been_called = abap_true.
101. EXIT.
102. ENDIF.
103. CATCH cx_root INTO lo_cx_root.
104. CONTINUE.
105. ENDTRY.
106. ENDLOOP.
107. * has method been found?
108. IF lv_has_method_been_called = abap_false.
109. RAISE EXCEPTION TYPE zcx_method_queue
110. EXPORTING
111. previous = lo_cx_root
112. method = <ls_call>-method.
113. ENDIF.
114. CATCH cx_root INTO lo_cx_root.
115. RAISE EXCEPTION TYPE zcx_method_queue
116. EXPORTING
117. previous = lo_cx_root
118. method = <ls_call>-method.
119. ENDTRY.
120. ENDLOOP.
121. ENDMETHOD. "flush
122. METHOD new_method_invocation.
123. CREATE OBJECT ro_method_queue.
124. ENDMETHOD. "new_method_invocation
125. METHOD on.
126. ro_method_queue = me.
127. ms_method_invocation-method = iv_method.
128. TRANSLATE ms_method_invocation-method TO UPPER CASE.
129. ENDMETHOD. "on
130. METHOD with.
131. ro_method_queue = me.
132. IF ms_method_invocation-caller IS NOT INITIAL AND ms_method_invocation-method IS NOT INITIAL.
133. finalize( ).
134. ENDIF.
135. ms_method_invocation-caller = io_caller.
136. ENDMETHOD. "with
137. ENDCLASS.
How to display GOS PDF document from Webdynpro
Dear All;
One of the way to display the GOS PDF document via Webdynpro; hope this will help;

Step1: Select the list of attachments from the business document using function module
BDS_ALL_CONNECTIONS_GET; for this you need the following inputs; Classname, Classtype and objkey.

Step2: Convert the file ID (loio_id from the above function module) to xstring using the method
attachment_get_detail from the class cl_hap_wd_document_ui

Data:
lv_aid type bds_docid,
lv_fcon type string,
lv_fchex type xstring,
lv_mftyp type string,
lv_ret type bapiret2.

attachment_get_detail
(exporting
attachment_id = lv_aid
attachment_type = 'pdf'
importing
file_content = lv_fcon
file_content_hex = lv_fchex
mime_file_type = lv_mftyp
s_return = lv_ret ).

Step3: Display the document in new browser; using the method attach_file_to_response from class
cl_wd_runtime_services;
data:
l_file type string,
l_mime type string,
pdf_data type xstring.
l_mime = 'application/pdf' .
l_file = 'title.pdf' .

call method
cl_wd_runtime_services=>attach_file_to_response
exporting
i_filename = l_file
i_content = lv_fchex
i_mime_type = l_mime.
698 Views 0 Comments Tags: web_dynpro
Posted by Prabhu Rajesh Jan 16, 2013
So you want to adapt/change your SAP standard Web Dynpro ABAP (WDA) application but youd like to avoid using
code enhancements if possible. One way to achive this is Administrator Personalization and in this blog I'll explain
and give examples of this. There are other ways to achieve the same which are not covered by this blog. The other
methods to achieve code free changes to WDA applications are called Component Customization and code free
Enhancements which I might cover in a future blog.

The list of options is not exhaustive and the recommendations are my personal opinions and not necessarily based
on SAP recommendations.


1. Admin Personalization (Application Customization)
If you want to perform small changes like hiding an input field, changing a label, rearranging a table column or field
then this is the way to go. If you come from a Web Dynpro Java background the options at your hand using this
technique are very similar to the old "ctrl+right click" technique.

To get started log on to your development system and simply locate the Web Dynpro application in SE80 or SE84.
Now you might want to take a copy of the SAP standard application to perform the customization on so that you keep a
clean SAP version. I would recommend taking a copy but up to you and your companies policies. If you chose to
customize directly on the standard application your changes will not be lost during an upgrade and you can always go
Admin Personalization of your SAP Standard WDA
application How To?
Posted by Jan Thomas Nygaard Jan 14, 2013
back and check which elements where changed and reset the changes (I will show that towards the bottom of this
blog).

You now need to execute the application using "shift+F8" or "Web dynpro application->Test-> In browser - admin
mode".
You can also do the same from your development portal by executing the iview in preview mode (but I have not tested
this out in the portal so can't say if you get prompts for transports etc?).

Then locate the UI object you wish to change, right click it and chose "Settings for current configuration". Below I've
given a couple of examples and hints:
If you clicked on a table column you will be able to rearrange it and Add/Remove columns
If you click on an input field you can change text, make it invisble, add a tooltip and even mark it as mandatory
using the state property
NOTE: If you mark a field as mandatory it simply gives you a * indicator on the field and you need to ensure
that a check for mandatory attributes has or is also implemented for example using
cl_wd_dynamic_tool=>check_mandatory_attr_on_view( view_controller = l_view_controller
display_messages = abap_true ).
If you want to rearrange the input fields you have to click on the container element for example "Grouping of UI
Elements" as shown below. You then press the Re-Sort link and you will be able to move them Up and Down.


When your done and click the "Save and Close" button in the bottom right hand corner you will be prompted to save
your changes in a customization transport. As a result you only need to do this on your development system/client -
nice!

I have sometimes experienced that this customization seems to be done on the application NOT the application
configuration which means:
a) The admin personalization of the application will be available on all the application configurations associated with
it
b) You can perform admin personalization even if the application doesn't have a configuration
However, other times it is done on the application configuration as Vikrant Raj also points out in his comments to
this blog. I believe there is a bug that gives this inconsistency but the intention from SAP is probably that it should be
saved on the application configuration as I think that makes most sense. If anyone can shed any further light on this
(eg. refer to a SAP note) please let me know.

If you want to check which parts of an application has been customized select the drop down option "Personalized
Elements" and you will get a list of customized elements and be able to reset them to standard.

So this is one way to achieve the described changes. As mentioned in the introduction there aare also other ways to
do the same not covered by this blog.

NOTE: In a lot of SAP standard applications it is also possible to achieve similar things in IMG customizing so ask
your functional IMG expert first.

Here are some useful links:
End User and Administrator Personalization (SAP Library - Web Dynpro for ABAP)

Personalization and Customizing - Web Dynpro ABAP Configuration Framework - SAP Library

And even though this document is written for FPM it has a brilliant section regarding adaptation options that some of
the way are also applicable for standard WDA applications:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0a2b7c2-1598-2e10-45bc-c556df3b9576?
QuickLink=index&overridelayout=true&51591147228485

Best Regards, Jan
2528 Views 9 Comments
Tags: netweaver, wda, abap, web_dynpro, portal, sap_portal, webdynpro, customizing, netweaver_portal,
web_dynpro_abap, webdynpro_abap, enhancement, sap_netweaver, adaptation, enhancing, customization, personalization,
abap_wd
Create one webdynpro component in se80 like below screen shot

Call the other component from ur component
Posted by John Kalaiyarasan Jan 10, 2013
then create one button in your view controller layout->for that button create one custom action.
then click on that action write the following code.

DATA LO_WINDOW_MANAGER TYPE REF TO IF_WD_WINDOW_MANAGER.
DATA LO_API_COMPONENT TYPE REF TO IF_WD_COMPONENT.
DATA LO_WINDOW TYPE REF TO IF_WD_WINDOW.
data lv_str type string .


LO_API_COMPONENT = WD_COMP_CONTROLLER->WD_GET_API( ).
LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).

CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL
EXPORTING
APPLICATION_NAME = 'ZWD_TRAINING_FEEDBACK'
IMPORTING
OUT_ABSOLUTE_URL = lv_str.

In the above screen shot mention your webdynpro component name and defined variable name to hold the
component url.
CALL METHOD LO_WINDOW_MANAGER->CREATE_EXTERNAL_WINDOW
EXPORTING
URL = lv_str
MODAL = ABAP_true
HAS_MENUBAR = ABAP_TRUE
IS_RESIZABLE = ABAP_TRUE
HAS_SCROLLBARS = ABAP_TRUE
HAS_STATUSBAR = ABAP_TRUE
HAS_TOOLBAR = ABAP_TRUE
HAS_LOCATION = ABAP_TRUE
RECEIVING
WINDOW = LO_WINDOW
.

LO_WINDOW->OPEN( ).

In the above screen shot call external popup window and also pass the component url.
then right on your webdynpro component->webdynpro application.
save, active and test your application it will call the other component.
1069 Views 2 Comments Tags: web_dynpro
This blog explains how to navigate from one component view to other component view without adding Used
Components.

Scenario: Source component contains View with LinkToAction UI element, on click of this Link navigates to
Destination component View without adding Used Component in the Source Component.This is can be achieved
using Dynamic Navigation by following interface: IF_WD_NAVIGATION_SERVICES and method:
do_dynamic_navigation.

Prerequisites: Should have basic knowledge on Web Dynpro ABAP

Create Two Web Dynpro Component by following

Destination Component :

Create Web Dynpro with View and Window.
Insert Caption UI Element in the View.
Navigation from one component view to other
componet view without adding Used Components
Posted by Sridhar S Jan 7, 2013

Embed the View into Window.Activate whole component.

Source Component :

Create Web Dynpro with View and Window. See below there is no Used Component,

Insert LinkToAction UI Element in the View and Create Action write the below code assign this action to LinkToAction
UI Element.

Code:

data : lv_view_api type ref to if_wd_view_controller,
lv_nav_serv type ref to if_wd_navigation_services.
lv_view_api = wd_this->wd_get_api( ).
lv_nav_serv ?= lv_view_api.
lv_nav_serv->do_dynamic_navigation(
source_window_name = 'W_COMP2'
source_vusage_name = 'V_COMP2_USAGE_1'
source_plug_name = 'DEFAULT'
* PLUG_PARAMETERS = PLUG_PARAMETERS
target_component_name = 'ZTEST_COMP1'
target_component_usage = 'ZTEST_COMP1'
target_view_name = 'W_COMP1'
target_plug_name = 'DEFAULT'
* TARGET_EMBEDDING_POSITION = TARGET_EMBEDDING_POSITION
).


Embed this View into Window. Activate whole component.

Create the Webdynpro Application by following


Demo : Select the above application Right click and Test. When you clicks on below link it navigates to Destination
Components View.


1212 Views 0 Comments Tags: navigation, web_dynpro, dynamic
Dear All; One of the way to display the GOS PDF document via Webdynpro; hope this will help; Step1: Select the list of
attachments from the business document using function module BDS_ALL_CONNECTIONS_GET; for this you need
the following inputs; Classname, Classtype and objkey Step2: Convert the file ID (loio_id from the above function
module) to xstring using the method attachment_get_detail from the class cl_hap_wd_document_ui Data:
lv_aid type bds_docid, lv_fcon type string, lv_fchex type xstring, lv_mftyp type string, lv_ret type bapiret2.
attachment_get_detail( exporting attachment_id = lv_aid attachment_type = 'pdf' importing
file_content = lv_fcon file_content_hex = lv_fchex mime_file_type = lv_mftyp s_return =
lv_ret ). Step3: Display the document in new browser; using the method attach_file_to_response from
class cl_wd_runtime_services; data: l_file type string, l_mime type string, pdf_data type xstring. l_mime =
'application/pdf' . l_file = 'title.pdf' . call method cl_wd_runtime_services=>attach_file_to_response exporting
i_filename = l_file i_content = lv_fchex i_mime_type = l_mime.
479 Views 2 Comments Tags: web_dynpro
How to display GOS PDF document from Webdynpro
Posted by Prabhu Rajesh Jan 4, 2013
In this blog I will give a simple example on how to use a captcha in ABAP Webdynpro.

Architecture
We generate a simple string in ABAP and send it to a servlet on a J2EE server. This servlet generates an image with
SimpleCaptcha. http://simplecaptcha.sourceforge.net/ . The generated images is received on the ABAP stack and
copied to a cached response so the captchastring is not in the url of the image.
The source of the java application can be downloaded here. (tested on SAP NW 7.31 SP5)

Captcha Servlet
This is a simple servlet application that generates a captcha image from a given string.

1. Download the simplecaptcha library
2. Create an external library DC and name it captcha/lib
3. Add the simplecaptcha jar-file to the libraries folder
4. Add the jar-files to the public part of the library
5. Create a new web module development component and name it captcha
6. Add a DC dependency between the web module and the library
7. Add a new servlet and give it a name and package
8. Copy the simplecaptcha.jar to the WEB-INF/lib directory
9. Enter the following code:

Using captcha in ABAP Webdynpro
Posted by Joachim Van Praet Dec 11, 2012
01. package com.flexso.captcha;

10. Add a class WordGenerator to be able to decide which word will be used to generate the captcha image.


11. Adapt the web.xml
12. Create an enterprise application DC with the name captcha/ear
13. Add the web module to the captcha/ear project
14. Adapt the application.xml
02. import java.io.IOException;
03. import java.util.ArrayList;
04. import java.util.List;
05. import javax.servlet.ServletException;
06. import javax.servlet.http.HttpServlet;
07. import javax.servlet.http.HttpServletRequest;
08. import javax.servlet.http.HttpServletResponse;
09. import com.flexso.captcha.noise.CustomNoiseProducer;
10. import nl.captcha.Captcha;
11. import nl.captcha.servlet.CaptchaServletUtil;
12. import java.awt.Color;
13. import java.awt.Font;
14. public class CaptchaImage extends HttpServlet {
15. private static final long serialVersionUID = 1L;
16. private static int _width = 180;
17. private static int _height = 60;
18. private static final List<Color> COLORS = new ArrayList<Color>(2);
19. private static final List<Font> FONTS = new ArrayList<Font>(3);
20. static {
21. COLORS.add(Color.BLACK);
22. COLORS.add(Color.BLUE);
23. FONTS.add(new Font("Geneva", 2, 48));
24. FONTS.add(new Font("Courier", 1, 48));
25. FONTS.add(new Font("Arial", 1, 48));
26. }
27. public CaptchaImage() {
28. super();
29. }
30. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
31. response.setContentType("image/png");
32. response.setCharacterEncoding("UTF-8");
33. String word = request.getParameter("captcha");
34. WordGenerator wordRenderer = new WordGenerator(word);
35. Captcha captcha = new Captcha.Builder(_width, _height).addText(wordRenderer)
36. .gimp()
37. .addNoise())
38. .build();
39. CaptchaServletUtil.writeImage(response, captcha.getImage());
40. }
41. }
01. package com.flexso.captcha;
02. import nl.captcha.text.producer.TextProducer;
03. public class WordGenerator implements TextProducer
04. {
05. private String text = "";
06. public WordGenerator(String text){
07. this.text = text;
08. }
09. public String getText(){
10. return this.text;
11. }
12. }
01. <?xml version="1.0" encoding="UTF-8"?>
02. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
03. <display-name>LocalDevelopment~captcha~flexso.com</display-name>
04. <servlet>
05. <description></description>
06. <display-name>CaptchaImage</display-name>
07. <servlet-name>CaptchaImage</servlet-name>
08. <servlet-class>com.flexso.captcha.CaptchaImage</servlet-class>
09. </servlet>
10. <servlet-mapping>
11. <servlet-name>CaptchaImage</servlet-name>
12. <url-pattern>/captcha.png</url-pattern>
13. </servlet-mapping>
14. </web-app>
01. <?xml version="1.0" encoding="ASCII"?>
02. <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
03. <display-name>LocalDevelopment~captcha~ear~flexso.com</display-name>
04. <module>
05. <web>
06. <web-uri>flexso.com~captcha.war</web-uri>
07. <context-root>captcha</context-root>
08. </web>

15. Deploy the ear file.
16. Test the captcha http://<portalserver>:<port>/captcha/captcha.png?captcha=test


ABAP Webdynpro application
In the ABAP WD application we build a random string to send to the captcha application.
We request the captcha image on the ABAP server and provide it in a cached response to our webdynpro application
to hide the captcha string in the url.

1. Create a new web dynpro component
2. In the component controller create a context node CAPTCHA with 3 strings: SOURCE, ANSWER, IMAGE.


3. Create method generate_captcha in the component controller. In this method we create a random string, with
this string we build the url to the J2EE server to generate the captcha image. At the end of the method we copy the
image from the java server to a cached response on the ABAP stack and then we fill the context. This is the code:


4. To copy the image from the JAVA response to the ABAP response I created a separate method
GET_CACHED_URL. Importing parameter IV_URL (STRING) and returning parameter OV_URL(STRING)

09. </module>
10. </application>
01. method GENERATE_CAPTCHA .
02. CONSTANTS: CO_ALFABET type CHAR30 VALUE 'abcdefghijklmnopqrstuvwxyz'.
03. DATA: lv_captcha type CHAR08,
04. lv_i type i,
05. lv_char type CHAR01,
06. lv_seed type i,
07. lo_ran type ref to cl_abap_random_int,
08. lv_url type string,
09. lv_length type i value 8.
10. * generate a random string with length lv_length
11. lv_seed = sy-timlo.
12. lv_i = STRLEN( co_alfabet ) - 1.
13. lo_ran = cl_abap_random_int=>create( min = 0 max = lv_i seed = lv_seed ).
14. DO lv_length TIMES.
15. lv_i = lo_ran->get_next( ).
16. lv_char = CO_ALFABET+lv_i(1).
17. lv_i = lo_ran->get_next( ).
18. if lv_i MOD 2 = 0 .
19. TRANSLATE lv_char TO UPPER CASE.
20. endif.
21. CONCATENATE lv_captcha lv_char into lv_captcha.
22. ENDDO.
23. * build url to generate captcha image
24. CONCATENATE '/captcha/captcha.png?captcha=' lv_captcha into lv_url.
25. lv_url = wd_this->GET_CACHED_URL( lv_url ).
26. " Set data in context
27. DATA lo_nd_captcha TYPE REF TO if_wd_context_node.
28. DATA lo_el_captcha TYPE REF TO if_wd_context_element.
29. DATA ls_captcha TYPE wd_this->Element_captcha.
30. lo_nd_captcha = wd_context->get_child_node( name = wd_this->wdctx_captcha ).
31. lo_el_captcha = lo_nd_captcha->get_element( ).
32. lo_el_captcha->set_attribute( name = `SOURCE` value = lv_captcha ).
33. lo_el_captcha->set_attribute( name = `IMAGE` value = lv_url ).
34. endmethod.
01. method GET_CACHED_URL .
02. DATA : lo_http_client TYPE REF TO if_http_client,
03. lo_cached_response TYPE REF TO IF_HTTP_RESPONSE,
04. lv_image TYPE xstring,
05. lv_guid TYPE GUID_32.
06. " read the image on the java server
07. CALL METHOD cl_http_client=>create_by_url
08. EXPORTING
09. url = 'http://<javaserver>:<port>'

5. Open the view of the webdynpro
6. In the context tab, bind the CAPTCHA node from the componentcontroller.


7. In the layout tab add following elements to the view:
a. An image and bind the source property to attribute IMAGE af the CAPTCHA node.
b. An input field and bind the property value to attribute ANSWER of the CAPTCHA node.
c. A button check captcha and assign an action CHECK
d. A button refresh and assign an action REFRESH

8. Implement the 2 actionhandlers

10. IMPORTING
11. client = lo_http_client
12. EXCEPTIONS
13. OTHERS = 1.
14. CALL METHOD lo_http_client->request->set_header_field
15. EXPORTING
16. name = '~request_uri'
17. value = iv_url.
18. CALL METHOD lo_http_client->send
19. EXCEPTIONS
20. http_communication_failure = 1
21. http_invalid_state = 2
22. http_processing_failed = 3.
23. CALL METHOD lo_http_client->receive
24. EXCEPTIONS
25. http_communication_failure = 1
26. http_invalid_state = 2
27. http_processing_failed = 3.
28. lv_image = lo_http_client->response->get_data( ).
29. " send the image to the cached response on the ABAP server
30. CREATE OBJECT lo_cached_response TYPE CL_HTTP_RESPONSE EXPORTING ADD_C_MSG = 1.
31. " SET IMAGE TO MIME
32. lo_cached_response->SET_DATA( lv_image ).
33. lo_cached_response->SET_HEADER_FIELD( NAME = IF_HTTP_HEADER_FIELDS=>CONTENT_TYPE VALUE = 'image/png' ).
34. lo_cached_response->SET_STATUS( CODE = 200 REASON = 'OK' ).
35. lo_cached_response->SERVER_CACHE_EXPIRE_REL( EXPIRES_REL = 100 ).
36. " generate an url
37. CALL FUNCTION 'GUID_CREATE'
38. IMPORTING
39. EV_GUID_32 = lv_guid.
40. CL_WD_UTILITIES=>CONSTRUCT_WD_URL( EXPORTING
41. APPLICATION_NAME = 'Z_CAPTCHA' "WEBDYNPRO APPLICATION NAME
42. IMPORTING OUT_LOCAL_URL = OV_URL ).
43. CONCATENATE OV_URL '/' lv_guid sy-uzeit '.png' INTO OV_URL.
44. CL_HTTP_SERVER=>SERVER_CACHE_UPLOAD( URL = OV_URL RESPONSE = lo_CACHED_RESPONSE ).
45. endmethod.
01. method ONACTIONCHECK.
02. DATA lo_nd_captcha TYPE REF TO if_wd_context_node.
03. DATA lo_el_captcha TYPE REF TO if_wd_context_element.
04. DATA ls_captcha TYPE wd_this->Element_captcha.
05. * get message manager
06. data lo_api_controller type ref to if_wd_controller.
07. data lo_message_manager type ref to if_wd_message_manager.
08. data: lv_Str type string,
09. lv_text type string,
10. lv_type type I.
11. " read context
12. lo_nd_captcha = wd_context->get_child_node( name = wd_this->wdctx_captcha ).
13. lo_el_captcha = lo_nd_captcha->get_element( ).
14. lo_el_captcha->get_static_attributes( IMPORTING static_attributes = ls_captcha ).
15. " get message manager

Create a web dynpro application object and test the application!
Result:

1867 Views 5 Comments Tags: web_dynpro, web_dynpro_abap, captcha, abap_wd
16. lo_api_controller ?= wd_This->Wd_Get_Api( ).
17. CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
18. RECEIVING
19. MESSAGE_MANAGER = lo_message_manager
20. .
21. lv_type = IF_WD_MESSAGE_MANAGER=>CO_TYPE_ERROR.
22. lv_text = 'ERROR!'.
23. TRANSLATE LS_CAPTCHA-SOURCE TO UPPER CASE.
24. TRANSLATE LS_CAPTCHA-ANSWER TO UPPER CASE.
25. " compare captcha answer with the source
26. if LS_CAPTCHA-SOURCE = LS_CAPTCHA-ANSWER.
27. lv_type = IF_WD_MESSAGE_MANAGER=>CO_TYPE_STANDARD.
28. lv_text = 'OK!'.
29. endif.
30. * report message
31. CALL METHOD lo_message_manager->REPORT_MESSAGE
32. EXPORTING
33. MESSAGE_TEXT = lv_text
34. MESSAGE_TYPE = lv_type
35. RECEIVING
36. MESSAGE_ID = lv_str
37. .
38. endmethod.
39. method ONACTIONREFRESH .
40. WD_COMP_CONTROLLER->GENERATE_CAPTCHA( ).
41. endmethod.
Go to Tcode : SE80
Select MIME Repository

Select favicon.ico. The path is SAP > PUBLIC > BC > UR > Login > assests.
Change Logo on Address Bar for WD Appl
Posted by Dhivya Baskaran Dec 6, 2012


Change the icon by Right Click favicon.ico and select Upload and Replace from Upload/Download dropdown


Then select the image from local disk


Save the properties

Follow SCN
Site Index Contact Us SAP Help Portal
Privacy Terms of Use Legal Disclosure Copyright
Now if you restart the application. The URL address bar image will be the image you have uploaded. Thus we
successfully changed the Logo in Address bar.
1285 Views 7 Comments Tags: web_dynpro, basis, webdynpro_abap
1 3 4 5 6 7 8
Previous Next

Вам также может понравиться