cancel
Showing results for 
Search instead for 
Did you mean: 

Access data in WD ALV (SALV_WD_TABLE)

Former Member
0 Kudos

Is there an easy way to get the data in an WD ALV as internal table. I have checked the interface but failed in order to find some appropriate method.

Or is the only way to do it via the context binding. Basically I'd like to get the data as displayed in the ALV (sorted...)

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

I think It will be helpful for you.

lo_interfacecontroller->Get_Ui_Info( ) 's T_DISPLAYED_ELEMENTS

contains the index's of all the resultant data as displayed in the ALV

Former Member
0 Kudos

At least somebody who has the same request I am no longer alone...

harald_schmitz2
Discoverer
0 Kudos

I'am also very interested in this!

Former Member
0 Kudos

I have this same question, maybe some of our SAP experts can help us w/ this question? Thanks!

Former Member
0 Kudos

Word, in order to create mail merge functionality. Sorry for the delay due to XMAS.

Former Member
0 Kudos

Thanks a lot for your kind feedback. However, obviously I did not make my point clear.

What I would like to access is the data in the rows and columns as displayed (WYSIWYG) in the ALV. I do know how to sort an ALV.

The idea is to export the data as displayed in the ALV to a certain file format. Surely I can access the data via the context (providing the data for the ALV). But this retrieves me only the data as "raw" data, so not dates formated and no fixed values resolved. Also this does exclude filtering, the ALV configuration or sorting in the ALV.

So basically it would be fine to find a way to an itab representing the ALV values as string values perfectly as I do see it one the screen.

Edited by: Hork Tsue on Dec 18, 2008 7:41 PM

uday_gubbala2
Active Contributor
0 Kudos

Hi Hork,

Which particular file format do you want to save the ALV contents into? Just asking this coz as ALV does already provide the Export to excel functionality by default and this would help you get the data in your desired manner. It would even take into consideration the filtering & sorting done on the ALV by the user.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Hork,

You need to use the create_sort_rule method of if_salv_wd_sort for achieving this sorting functionality. Refer to the code snippet below which am using inside the WDDOINIT method to sort the SEATSOCC field by descending order.

Regards,

Uday

METHOD wddoinit .
* Create component usage for alv component
  DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

" Create instance of component usage
  l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
  ENDIF.

* Get config model
  DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

  DATA: l_value TYPE REF TO cl_salv_wd_config_table.

  l_value = l_ref_interfacecontroller->get_model( ).

* Sort rows by seatsocc descending
  DATA: lr_field  TYPE REF TO cl_salv_wd_field.

  lr_field = l_value->if_salv_wd_field_settings~get_field( 'SEATSOCC' ).
  lr_field->if_salv_wd_sort~create_sort_rule( sort_order =
  if_salv_wd_c_sort=>sort_order_descending ).
ENDMETHOD.

Or else you can do it the lame way of sorting the internal table by the desired field before you bind it to the context node. This way the ALV would display the data in sorted manner.

Regards,

Uday

Former Member
0 Kudos

in salv_wd_table....

we have method GET_MODEL---->Returns Standard Execution of ALV Configuration Model..

get_model consist of

table settings...

column settings etc...

use column settings u can sort the table ....

do coding in initialization(wd_init) method...