Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
High Performance Web System

High Performance Web System

Ratings: (0)|Views: 3 |Likes:
Published by hindu_for_ever
high performance in any application
high performance in any application

More info:

Published by: hindu_for_ever on Jun 18, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as RTF, PDF, TXT or read online from Scribd
See more
See less

06/18/2012

pdf

text

original

 
High performance of Web dynpro ABAPAdded by xiaohong wu, last edited by Bharadwaj p on Nov 21, 2010 (view change)Performance for Web dynpro is very important, because it cover more than normal ABAP program,it's also related to Wgate, the HTTP request/response cycle, so the whole design is critical.First we still have to follow the performance rule for normal ABAP program when we receive thedata from database, but we have to add something more based on web side, please keep in mindthe basic rule:1. lower memory consumption, better performance.2. using MVC, split the component up if too large, usingif_wd_component_usage=>delete_component to delete all web dynpro component instances assoon as no longer needed3. Using dynamic navigation or dynamic component usages only if it is absolutely necessary.4. Set the lifetime of a view to when visible, if this view is displayed not too much.5. Keep context as small as possible, Create context only required by UI binding, use assistanceclass or other ABAP OO class as data exchange. Use singleton node, do not use any dynamicattributes if_wd_context_node_info->add_attribute, bad context design cause huge runtimememory.6. Don't raise exception in supply function, these cause runtime dump.7. Do not use container scrolling (scrollingMode<>none), create application screens that fits thestandard browser, avoid deep nesting of containers, groups and tabstrips, use the dynamic UIelement programming only if it's necessaryModel partUse assistance class as model, Creating an assistance class for a component provides thefollowing benefits:You can store coding there that is required within the component, but is not linked directly withthe layout or with the function of a controller. This could be, for example, a call of the applicationlayer or UI-based editing of the data. Method calls of the assistance class are much better from aperformance point of view than calls of methods of a Web Dynpro controller.Assistance class can store the data in the memory, The instance is available to each controller of the component through the attribute WD_ASSIST and sub component usage. The instance of assistance is in the cache at runtime can save the data has been changed. The assistance class isautomatically instantiated when a component is called.The second important function of the assistance class is the management of dynamic texts.Texts that are combined at runtime only and/or contain variables can be stored in the text pool of the assistance class as text symbols.In this tutorial I'm going to show you how to add buttons change, display, save, delete, cancel andexit on the WDA, all these buttons have the same function as SAP GUI, how to use assistanceclass to implement those functions and how to use dynamic programming to control the property of UI elements.I also show you how to use the input-help components, use the transaction code to start the WDAand exit WDA.
 
Goto SE11, I created table zcustomer with field customerId(pk), company code, city, zip code,street, zcontact with fields contactId(pk), first name, last name, email, customerId is the foreign keyto zcustomer and all the related technical setting. Goto SE24, I created persistence class for these2 tables, add zcl_oo_customer as the attribute of zcl_oo_contact. Persistence class is veryimportant way to update database if there is no BAPI available, using transaction manager of persistence class can perform faster database update, it's not the goal for this tutorial, so I didn'tcover here.Database preparation: se11, I created table zcustomer and zcontact, zcontact has the FKcustomerid for zcustomer and related persistence classes.Create assistance: se24, zcl_wd_assist should inherit from the abstract classCL_WD_COMPONENT_ASSISTANCE, public attribute ex_contact type table zcontact, publicattribute tt_contact and td_contact type table of zcontact, tt_customer and td_customer type table of zcustomer, method fill_customer with input parameter i_bukrs type bukrs, return parameter r_zcustomer type table zcustomer, methods save_customer, save_contact, delete_customer anddelete_contact, those 4 methods without parameter because the value comes from the attributes.Inside those methods I call the persistence class zca_oo_customer and zca_oo_contact, When Ifilled the customer data in the fill_customer, I filled the data to ex_contact as well.Controller partIn the controller part, I only retrieve the data and put them into context, then bind to the UI element,I try to access the database only once if no necessary, the data are temporary store in theassistance class.Preparation the controller: se80, I created WD component z_WD_customer_demo, In thecomponent controller, add assistance class zcl_wd_assist in the property. I created zcustomer node all the attributes from DDIC, cardinality 0:N, initial lead selection, singleton, selection 1:1.Child node zcontact all the attributes from DDIC, cardinality 0:N, singleton, initial lead selection,selection 0:N. Child node input with attribute i_bukrs. Add method fill_customer in the methods of component controller directly or use the service call tocall the assistance class and generate the fill_customer for you automatically.method fill_customer.method: lr_input type ref to if_wd_context_element,lr_bukrs type wd_this->element_input-i_bukrs.lr_input = wd_context->get_child_node(name = wd_this->wdctx_input)->get_element().lr_input->get_attribute( exporting name = 'I_BUKRS' importing value = lr_bukrs).Data lwa_customer type standard table of zcustomer.lwa_customer = wd_assist->fill_customer(lr_bukrs).Wd_context->get_child_node(name = wd_this->wdctx_zcustomer)->bind_table(i_customer).Endmethod.View part
 
View only display the data, this is not supposed to go the database for any reason, the viewcontroller and window controller only get the data from component controller by binding or fill thedata from assistance class, which means the data is already available for view in the runtime.I created main window and popup window, main view, popup view. Main view embed in mainwindow, popup view embed in popup window. Add exit plug in the outbound plug and check theinterface property.In the main view controller, I bind all the context of component controller to viewcontroller and add local node readonly with attribute readonly type wdy_boolean. The nodezcontact with supply function supply_contact.In the layout of view controller, I add 1 input field companycode binding with attribute i_bukrs of node input, search button on right of input field. 2 trays with 2 tables binding with nodes zcustomer and zcontact, the cell editor of table column is input field. I add buttons change, display, save,delete, cancel and exit at the bottom of all the UI elements. The readonly property of each columnof 2 tables zcustomer and zcontact bind to attribute readonly in the context node readonly.Search button: I only trigger the componentcontroller to get the data, then the data would beavailable in the assistance class instance.Method onaction_search.Wd_this->get_componentcontroller_ctr()->fill_customer().Endmethod.Search contact: I have the data in the assistance class instance, so I just fill the data in the supplyfunction, It's never been a good idea to access the database and raise the exception in the supplyfunction. Since I set the singleton for the customer node which means each time all the contactnode must related to only one parent node, this is also important for the performance.Method search_contact.Data: lr_customer_strc type if_main=>element_zcustomer,lr_contact_node type ref to if_wd_context_node,lr_contact_strc type ref to if_main=>element_zcontact,lr_contact type ref to if_main=>elements_zcontact,Lt_contact type table zcontact,Lwa_contact type zcontact.Parent_element->get_static_attributes(importing static_attributes = lr_customer_strc).Refresh lt_contact.Loop at wd_assist->ex_contact into lwa_contact where kunnr = lr_customer_strc-kunnr.Move-corresponding lwa_contact to lr_contact_strc. Append lr_contact_strc to lt_contact.Endloop.

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->