Home > SAP Tips > ABAP/Java developer tips > Web Dynpro ABAP Quick Tip: Table column sorting in four steps
SAP Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ABAP/JAVA DEVELOPER TIPS

Web Dynpro ABAP Quick Tip: Table column sorting in four steps


Mohammed Anzy S
08.17.2007
Rating: -4.80- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


This tip is for those who are very new to Web Dynpro ABAP and want to learn about the quick tips which can help solve issues. In today’s edition we will be covering table column sorting in four steps.

 

Most of us are familiar with the Table UI element and when we create a normal table and bind it to the context node, during the run time it appears like above. But in this case , the data is not complex or confusing. But sometimes these tables may have more number of columns with numerical values. So to make better sense of the values, most of the customers prefer to have sorting at the column level. Initially the sorting may seem to be a complex process, but no need to worry, Web Dynpro has provided us a table handler to carry out the sorting functionality.

 

1. Create an attribute in the view.

In your view, which holds the table UI element, create an attribute of type IF_WD_TABLE_METHOD_HNDL.

 

2. Populate the instance of the table method handler.

In the WDDOMODIFY , of your view method .Populate the table method handler to the newly created view attribute.

****Code in WDDOMODIFY****************** 

data wd_table type ref to cl_wd_table.

check first_time = abap_true.

* Name of the table UI element to be provided

wd_table ?= view->get_element( 'TBL_AUTHOR' ).

wd_this->table_control ?= wd_table->_method_handler.

*Name of the key attribute of the context node to which the table binding is done to be  provided

wd_this->table_control->set_key_attribute_name( 'USER_ID' ).

 

3. Create an action for the onSort event of the table.

Now we need to create an action for the onSort event of the table UI element. Create a new action and call the apply_sorting method available in the table method handler attribute.

*****code in the onSort event********* 

wd_this->table_control->apply_sorting( ).

 

4.Activate your view and test.

Now you can activate your view and test the application. The new table header will look like follows.

Now on click of the sort icon

The sorting functionality will be available to all the columns of the table.

Mohammed Anzy S Working as a Development Specialist in SAP Labs.

This content is reposted from the SAP Developer Network.
Copyright 2007, SAP Developer Network


SAP Developer Network (SDN) is an active online community where ABAP, Java, .NET, and other cutting-edge technologies converge to form a resource and collaboration channel for SAP developers, consultants, integrators, and business analysts. SDN hosts a technical library, expert blogs, exclusive downloads and code samples, an extensive eLearning catalog, and active, moderated discussion forums. SDN membership is free.

Want to read more from this author? Click here to read Mohammed Anzy's Weblog. Click here to read more about ABAP on the SDN.



Rate this Tip
To rate tips, you must be a member of SearchSAP.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
ABAP/Java developer tips
Fixing a common OPEN_FORM and START_FORM error in SAPscript
Select Text fields: Case-insensitive
Finding BADIs you can use
Is this the quickest way to find a BADI?
ABAP Objects in SAP Workflow to provide improved performance
Easily debug error messages in SAP processes
Accessing private attributes in ABAP Objects
Find a BADI in a minute
Top 10 SAP tips of 2007
How to transport an SAP query in R/3 4.6x

SAP ABAP
The difference between an SAP system and a non-SAP system
Is C, C++ and Java knowledge required when learning SAP?
Getting started with a NetWeaver career
How to be a self-taught NetWeaver and ABAP expert
Is SAP BI knowledge advantageous to an ABAP user?
An ABAP user wants to learn XI
Select Text fields: Case-insensitive
Finding BADIs you can use
Is ABAP knowledge necessary for SAP BI?
SAP ABAP development quiz
SAP ABAP Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
ABAP  (SearchSAP.com)
ABAP Objects  (SearchSAP.com)
ABAP Workbench  (SearchSAP.com)
BAPI  (SearchSAP.com)
CATT  (SearchSAP.com)
R/3 Repository  (SearchSAP.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



NetWeaver SAP White Papers
HomeNewsTopicsBlogsTipsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts