cancel
Showing results for 
Search instead for 
Did you mean: 

WD4A with ALV, populating the header with values from the table

Former Member
0 Kudos

I have WDA application that list schedule agreement headers in one ALV and when you select one the line items show in the second ALV2 below. We show quantity and net value in 13 monthly buckets beginning with the validity data. The function returns the month text in columns I want to change the header based on the months returned. So instead of QNTY1, QNTY2 it would be 01/2008, 01/2008 etc. But ALV2 is initialized when the page is built and if I change the ALV2 settings after the line item function call they are not updated. On the page. Is there anyway I can do this???

It tried put the code in the EXECUTE function method, and I tried WDMODIFYVIEW but the ALV is not refreshed.

Thanks

David

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I got it working, I believe it is a bug, if I add the code to hide a column the ALV is refreshed, and my new column headers are displayed. At least I know I am not crazy.

Former Member
0 Kudos

Hi David,

This should be possible in your EXECUTE method also, even though you have already initialized your ALV previously.

Make sure you get the reference to the same ALV2 object that you initialized previously. Get the reference from the component usage, do a get_model( ) using the returned reference to make your changes.

In a debugging session, make sure that the changes are actually taking place. Cross check if you have got the reference to the same ALV2 object.

Hope this helps,

Regards

Wenonah

Former Member
0 Kudos

Hi David,

I assume that you have defined 2 separate component usages for the 2 ALVs. Do not use the same component usage for both the ALVs.

Regards,

Wenonah

Former Member
0 Kudos

For testing I used the below code to initialize the column to 'your text' which works fine if I take the same run it again after I run the execute_z_www_exp_ppp. It still says 'your text'. Doees it work differently if it is already initialized? In this test program I only have the one ALV and hard coded text for simplicity.

method ONACTIONGETDETAIL .

wd_comp_controller->execute_z_www_exp_ppp( ).

DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.

lo_interfacecontroller = wd_this->wd_cpifc_alv( ).

DATA lo_value TYPE REF TO cl_salv_wd_config_table.

lo_value = lo_interfacecontroller->get_model( ).

DATA lr_column_settings TYPE REF TO if_salv_wd_column_settings.

DATA lr_column TYPE REF TO cl_salv_wd_column.

DATA lr_column_header TYPE REF TO cl_salv_wd_column_header.

lr_column_settings ?= lo_value.

lr_column = lr_column_settings->get_column( 'VBTYP' ).

lr_column->delete_header( ).

lr_column_header = lr_column->create_header( ).

lr_column_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none ).

lr_column_header->set_text( 'your text2' ).

endmethod.

Former Member
0 Kudos

Hi David,

The behaviour should not be different. Make sure that the new value is not being overwritten somewhere by the old one. Try debugging and see what's happening.

Regards,

Wenonah

Former Member
0 Kudos

Thanks for your help, I know I am probably doing something dumb but it is driving me crazy.

I have debugged I can see the text change in the debugger but it doesn't show up on the screen. I removed the code from from the WDDOINIT. So am doing everything in the ONACTIONGETDETAIL to ensure that it is not being overwritten. I can change the 'number of lines', remove print button, change a field to an icon etc, but the column header doesn't change. If I put the same code in the WDDOINIT the column header does change. Everything else works in both places.

*First ALV config

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.

DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.

lo_interfacecontroller = wd_this->wd_cpifc_alv( ).

DATA lo_value TYPE REF TO cl_salv_wd_config_table.

lo_value = lo_interfacecontroller->get_model( ).

*activate extended functions of the alv.

cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(

r_model = lo_value ).

lo_value->if_salv_wd_table_settings~set_visible_row_count( '10' ).

lo_value->if_salv_wd_table_settings~set_selection_mode( '06' ).

lo_value->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).

DATA lr_column_settings TYPE REF TO if_salv_wd_column_settings.

DATA lr_column TYPE REF TO cl_salv_wd_column.

DATA lr_column_header TYPE REF TO cl_salv_wd_column_header.

lr_column_settings ?= lo_value.

lr_column = lr_column_settings->get_column( 'VBTYP' ).

lr_column->delete_header( ).

lr_column_header = lr_column->create_header( ).

lr_column_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none ).

lr_column_header->set_text( '200708' ).

*change column to icon

lr_column = lo_value->if_salv_wd_column_settings~get_column( 'AUART_DESC' ).

CREATE OBJECT lr_image.

lr_image->set_source_fieldname( 'AUART_DESC' ).

lr_column->set_cell_editor( lr_image ). "Display images in column

Thanks again.

David