on 11-17-2014 4:00 PM
Hi,
I have a wd-abap form with saved values (of select options) in a custom table like personalization, but self programmed.
Below form is a personalized SALV_WD_TABLE table.
When a variant (in the from) is choosen, my customer wants the program to associate name of "his" variant with the personalization view of table. If one is available with the same name, than I have to call this view in the alv (like manually changed dropDownBox for personalization).
I am using the very good hint http://scn.sap.com/thread/1986147 .
1. When I am using
lo_pers->load_config_by_key "<-- this doesn't work: Unfortunately the view is not loaded.
lo_pers->set_default_variant "<- this line works
My presettings of the alv are:
lv_value->if_salv_wd_table_settings~set_implicit_p13n_enabled( abap_true ).
lv_value->if_salv_wd_std_functions~set_dialog_settings_allowed( abap_true ).
lv_value->if_salv_wd_std_functions~set_view_list_allowed( abap_true ).
lv_value->if_salv_wd_std_functions~set_view_quick_save_allowed( abap_true ).
2. Is there a standard solution in webdynpro abap to save selct options fields of a form?
Thanks a lot in pevious for help!
Hi.
We do an update (my method) after initializing alv in the controller component
METHOD post_init_alv.
TYPES:
BEGIN OF ty_s_column,
id TYPE salv_wd_s_column-id,
fixed_position TYPE salv_wd_s_column-fixed_position,
visible TYPE salv_wd_s_column-visible,
hierarchy_column TYPE salv_wd_s_column-hierarchy_column,
position TYPE salv_wd_s_column-position,
width TYPE salv_wd_s_column-width,
END OF ty_s_column.
DATA:
lo_alv_controller TYPE REF TO iwci_salv_wd_table,
lo_alv_config TYPE REF TO cl_salv_wd_config_table,
lo_component TYPE REF TO cl_wdr_component,
lo_custom_component TYPE REF TO cl_wdr_delegating_custom,
lo_alv_usage TYPE REF TO if_wd_component_usage,
lo_node TYPE REF TO if_wd_context_node,
lt_column TYPE TABLE OF ty_s_column.
wd_this->wd_get_api( )->get_personalization_manager( )->delete_new( wd_this->wd_get_api( )->get_configuration_key( ) ).
lo_alv_usage = wd_this->wd_cpuse_alv_table( ).
IF lo_alv_usage->has_active_component( ) IS INITIAL.
lo_alv_usage->create_component( ).
ENDIF.
lo_alv_controller = wd_this->wd_cpifc_alv_table( ).
lo_alv_config = lo_alv_controller->get_model( ).
lo_component ?= lo_alv_controller->wd_get_api( ).
lo_custom_component ?= lo_component->controllers[ name = 'SALV_WD_MODEL_CTLR' ]-controller.
lo_node = lo_custom_component->get_context( )->root_node->get_child_node( 'SALV_WD_CONFIG_TABLE' ).
lo_node = lo_node->get_child_node( 'COLUMN_SETTINGS' ).
lo_node = lo_node->get_child_node( 'COLUMN' ).
LOOP AT lo_alv_config->if_salv_wd_column_settings~get_columns( ) ASSIGNING FIELD-SYMBOL(<ls_o_column>).
APPEND INITIAL LINE TO lt_column ASSIGNING FIELD-SYMBOL(<ls_column>).
<ls_column>-id = <ls_o_column>-id.
<ls_column>-fixed_position = <ls_o_column>-r_column->fixed_position.
<ls_column>-visible = <ls_o_column>-r_column->visible.
<ls_column>-hierarchy_column = <ls_o_column>-r_column->if_salv_wd_column_hierarchy~hierarchy_column.
<ls_column>-position = <ls_o_column>-r_column->position.
<ls_column>-width = <ls_o_column>-r_column->width.
ENDLOOP.
lo_node->bind_table( lt_column ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the hint, but I cannot see how it can help me, because I do not use "on_std_function_afte". My event is a simple change of a DropDownListBox. And I succeed already - as described - to set default view of the personalization, and also the function
lo_pers->load_config_by_key is called without an error, but unfortunately the personalization table view of the ALV is not loaded. Perhaps I need start somewhere a refresh of the view or the ALV???
Here is the coding:
DATA:
lo_cmp_usage TYPE REF TO if_wd_component_usage,
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table ,
lo_api_interfacecontroller TYPE REF TO if_wd_controller,
lo_pers TYPE REF TO if_wd_personalization,
lv_value TYPE REF TO cl_salv_wd_config_table,
lt_var TYPE wdr_pers_variants,
wa_var TYPE wdr_pers_variant,
ls_config_key TYPE wdy_config_key.
CHECK iv_variant_name IS NOT INITIAL.
* Instantiate ALV
lo_cmp_usage = wd_this->wd_cpuse_qresult( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
* Get the interface controller of the component usage
lo_interfacecontroller = wd_this->wd_cpifc_qresult( ).
* Get the model object of ALV
IF lo_interfacecontroller IS NOT INITIAL.
lv_value = lo_interfacecontroller->get_model( ).
* Get the API reference
lo_api_interfacecontroller = lo_interfacecontroller->wd_get_api( ).
ENDIF.
* Get personalization obect
IF lo_api_interfacecontroller IS NOT INITIAL.
lo_pers = lo_api_interfacecontroller->get_personalization_manager( ).
ENDIF.
* Get variants
IF lo_pers IS NOT INITIAL.
lt_var = lo_pers->get_variants( ).
ENDIF.
* Set the default variant
* Required variant is read
* READ statement can be modified as per the requirement.
* As this application holds only one user variant, first record is read.
* read the respective records based on your condition
IF lt_var IS NOT INITIAL.
LOOP AT lt_var INTO wa_var WHERE DESCRIPTION = iv_variant_name.
ls_config_key-config_id = wa_var-config_id .
ls_config_key-config_type = wa_var-config_type.
ls_config_key-config_var = wa_var-config_var.
ENDLOOP.
TRY.
CALL METHOD lo_pers->set_default_variant
EXPORTING
config_key = ls_config_key
set = abap_true.
CATCH cx_wd_personalization .
ENDTRY.
* Get the variant information based on variant id
* Load the variant/ Set the default variant
CALL METHOD lo_pers->load_config_by_key
EXPORTING
config_key = ls_config_key
* fetch_default_variant = abap_false
.
ENDIF.
Hi Rama,
thanks for the hint with UI Element TimedTrigger.
But I do not understand why and how it could help in my case:
I have an action in my view1. It is not the first randering. It can be to any time. It's a simple "listbox has Changed" action, which has been done by user. Hence user see all the elements, the listbox and the alv. And both looks good at that time.
The alv is a personalized alv with a lot of views. And as i have above alv a form for search with dynamic generated select-options, the demand was to save also the input fields of all search fields above the alv. Have done this by own solution.
Now the user selects a "self programmed variant" for all search fields and expects the program to be smart enough to call also the view with the same name of the alv view=variant.
As discussed, i found the appropirate method "if_wd_personalization-> load_config_by_key", but it doesn't show effect. I try now to check what kind of problem i have:
- method doesn't work OR
- alv settings OR
- refresh problem with
- alv OR
- view
I guess it's a refresh problem, because some other methods of the same class are definitely working, but they do not effect the appearance immediately: IF_WD_PERSONALIZATION->set_default_variant, IF_WD_PERSONALIZATION->DELETE_NEW.
Perhaps it can also depend on my alv settings, but i do not see problems here:
DATA: lr_cmp_usage TYPE REF TO if_wd_component_usage,
lrt_qi_settings TYPE REF TO if_salv_wd_table_settings.
lrt_qi_settings ?= it_quot_conf_tab.
it_quot_conf_tab->if_salv_wd_table_settings~set_implicit_p13n_enabled( abap_true ).
it_quot_conf_tab->if_salv_wd_std_functions~set_dialog_settings_allowed( abap_true ).
it_quot_conf_tab->if_salv_wd_std_functions~set_view_list_allowed( abap_true ).
it_quot_conf_tab->if_salv_wd_std_functions~set_view_quick_save_allowed( abap_true ).
it_quot_conf_tab->if_salv_wd_table_settings~set_selection_mode( cl_wd_table=>e_selection_mode-multi_no_lead ).
it_quot_conf_tab->if_salv_wd_table_settings~set_on_select_enabled( abap_true ).
* it_quot_conf_tab->if_salv_wd_table_settings~set_refresh_on_data_change( ) .
** Set column width
lrt_qi_settings->set_fixed_table_layout( abap_true ).
lrt_qi_settings->set_width( '100%' ).
lrt_qi_settings->set_visible_row_count( 1000 ).
lrt_qi_settings->set_display_empty_rows( abap_false ).
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.