How to read the data from a filtered table in SAP Web Dynpro ABAP
Hi welcome !!!
I would like to share the code/logic of method GET_TABLE_DATA of interface IF_WD_TABLE_METHOD_HNDL which helps to read the data from a filtered Table in Web Dynpro ABAP.
I have come across few SCN threads where in the requirement for reading filtered table data is left unanswered, as the method GET_TABLE_DATA( ) is not available in interface IF_WD_TABLE_METHOD_HNDL in their systems. I think the method GET_TABLE_DATA is available from SAP_ABA 731.
So, it might be useful if the logic to read the data from a filtered table is available for all.
Pre-requisite:
Basic knowledge of Webdynpro ABAP,& OO ABAP
Create below method.
GET_TABLE_DATA( ) |
---|
Parameters: IO_TBL Importing type ref to CL_WD_TABLE METHOD get_table_data .
ENDMETHOD. |
Let us say, we have created the above method GET_TABLE_DATA in component controller of WD component.
Please refer to the below steps to read data from a filtered table
Steps:
- Go to attributes tab of view and create an view attribute GO_TBL of type ref to CL_WD_TABLE
- Go to method WDDOMODIFYVIEW( ) and write the below logic to get the reference of table ui element “MY_TABLE“
METHOD wddomodifyview .
IF first_time = abap_true.
"Note: my_table is the ui name of table in view layout
wd_this->go_tbl ?= view->get_element( 'MY_TABLE' ).
ENDIF.
ENDMETHOD.
- Now, to read data from filtered table, use the below code
data lt_data type WDR_TABLE_ROW_DATA_TAB.
wd_comp_controller->get_table_data(
exporting
io_tbl = wd_this->go_tbl
receiving
rt_data = lt_data ).
Thank you for your time and hope content of this blog was helpful.
Your comments / Feedback / suggestions are highly appreciable & always welcome 🙂 🙂 🙂
Hi Ramakrishna,
Can u upload the screenshots for the same process.As I am new to WebDynpro,and my requirement seems similar to the same you posted which will be a great help for me.
Thanks In Advance.
wd_this->go_tbl ?= view->get_element( 'MY_TABLE' )
Hi,
Thanks for the update.
Regards,
Rama
thank you Ramakrishnappa,
it work very well.
bye
Domenico
Hi Domenico, thank you for visiting my blog.
Glad that helped you.
Regards.
Rama
Hi Ramakrishnappa, how can yo see the table content instead of ->{O:16195*\CLASS=CL_WDR_CONTEXT_ELEMENT?
Hi Marcel,
Use method GET_STATIC_ATTRIBUTE to extract the element line data into a structure.