on 12-04-2007 10:01 AM
Hi experts,
I'm using the following code in a views WDDOMODIFY.
sel_opt_uielem = cl_wd_view_container_uielement=>new_view_container_uielement(
id = lv_elem_id
).
lr_form_cont->add_child( sel_opt_uielem ).
cl_wd_matrix_head_data=>new_matrix_head_data( element = sel_opt_uielem ).
This should add a view_container_uielement to a view.
But this results the following error.
Note
The following error text was processed in the system G41 : Access via 'NULL' object reference not possible.
The error occurred on the application server DEMCHENG41_G41_00 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: GET_CONTENT_VIEW of program CL_WDR_VE_ADAPTER_DIRTY_STATE=CP
Method: IF_WDR_DIRTY_STATE~RESET_DIRTY of program CL_WDR_VE_ADAPTER_DIRTY_STATE=CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
The interesting thing is, that I did not make any changes to the coding since the last days, and it allready worked correctly.
The coding is the same as in <a href="http://help.sap.com/saphelp_erp2005/helpdata/en/4c/60154219fce12ce10000000a1550b0/content.htm">here</a>
Best regards, Matthias
Hi Matthias,
Try switching your two lines of code so that it looks like this:
cl_wd_matrix_head_data=>new_matrix_head_data( element = sel_opt_uielem ).
lr_form_cont->add_child( sel_opt_uielem ).
Good luck!
Jos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Matthias,
Please check that your ROOTUIELEMENTCONTAINER has Layout set to "MatrixLayout".
Regards,
Jos
Hmmmmmm I tested it myself meanwhile and it works just fine! (took the code example from your link)
Is there any other element already embedded on the view?
Could you perhaps add some more details about the settings of the ROOTUIELEMENTCONTAINER (when this is the container you are adding your element to.)
Hi Jos,
the view is completly empty ... everything is set in WDDOMODIFY:
here is the complete code:
METHOD wddomodifyview .
TYPES:
BEGIN OF ty_multishlp,
shlpname TYPE shlpname,
shlptext TYPE ddtext,
END OF ty_multishlp.
DATA:
lr_ui_root TYPE REF TO if_wd_view_element,
lr_container TYPE REF TO cl_wd_uielement_container,
lr_node TYPE REF TO if_wd_context_node,
lr_elem TYPE REF TO if_wd_context_element,
lr_sel_ref TYPE REF TO if_wd_context_element,
lr_element TYPE REF TO if_wd_context_element,
lr_dyntab TYPE REF TO cl_wd_table,
lr_tabstrip TYPE REF TO cl_wd_tabstrip,
lr_tab TYPE REF TO cl_wd_tab,
lr_caption TYPE REF TO cl_wd_caption,
lr_matrix_data TYPE REF TO cl_wd_matrix_head_data,
lr_button TYPE REF TO cl_wd_button,
lt_multiselect TYPE TABLE OF ty_multishlp,
ls_multiselect TYPE ty_multishlp,
lv_shlptxt TYPE string,
lv_hlp TYPE string,
lv_strlen TYPE i,
lv_current_node_name TYPE string,
lv_elem_id TYPE string,
lv_elem_embedd TYPE string.
DATA lr_cont TYPE REF TO cl_wd_transparent_container.
DATA lr_allg_cont TYPE REF TO cl_wd_transparent_container.
DATA lr_form_cont TYPE REF TO cl_wd_transparent_container.
DATA sel_opt_uielem TYPE REF TO cl_wd_view_container_uielement.
DATA cust_event TYPE REF TO cl_wd_custom_event.
IF first_time = abap_true.
lr_ui_root = view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_container ?= lr_ui_root.
* Layoutmanager für den Container setzen
cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
* Tabstrip anlegen
lr_tabstrip = cl_wd_tabstrip=>new_tabstrip( ).
* Layoutmanager für Tabstrip setzen
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_tabstrip ).
lr_container->add_child( lr_tabstrip ).
lr_node = wd_context->get_child_node( name = wd_this->wdctx_multiselections ).
lr_node->get_static_attributes_table(
IMPORTING
table = lt_multiselect
).
lr_node = wd_context->get_child_node( name = wd_this->wdctx_shlp_fields ).
lr_elem = lr_node->get_element( ).
LOOP AT lt_multiselect INTO ls_multiselect.
CLEAR: lr_tab, lr_caption.
lv_hlp = sy-tabix.
lv_strlen = STRLEN( lv_hlp ) - 1.
lv_hlp = lv_hlp(lv_strlen).
* lv_currentloop = sy-tabix.
CONCATENATE 'SHLP' lv_hlp INTO lv_current_node_name.
lr_node = lr_elem->get_child_node( lv_current_node_name ).
lv_shlptxt = ls_multiselect-shlptext.
* Überschrift für neuen Tab setzen
lr_caption = cl_wd_caption=>new_caption( text = lv_shlptxt ).
* neuen Tab einfügen
lr_tab = cl_wd_tab=>new_tab( enabled = abap_true visible = abap_true ).
lr_tab->set_header( the_header = lr_caption ).
* Tab zum Tabstrip hinzufuegen
lr_tabstrip->add_tab( the_tab = lr_tab ).
CONCATENATE 'CNT_ALLG_' lv_current_node_name INTO lv_elem_id.
* Allgemeinen Container dem Tab hinzufügen
lr_allg_cont = cl_wd_transparent_container=>new_transparent_container(
id = lv_elem_id
height = '100%'
enabled = abap_true
is_layout_container = abap_true
width = '100%'
).
cl_wd_matrix_layout=>new_matrix_layout( container = lr_allg_cont ).
lr_tab->set_content( the_content = lr_allg_cont ).
* Button zum Ein-/Aus- blenden der Suchkriterien
lr_button = cl_wd_button=>new_button(
text = 'Suchkriterien einblenden'
on_action = 'SET_SEARCH_VISIBILIT'
).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_button ).
lr_allg_cont->add_child( lr_button ).
CONCATENATE 'CNT_FORM_' lv_current_node_name INTO lv_elem_id.
* Container für Suche dem Tab hinzufügen
lr_form_cont = cl_wd_transparent_container=>new_transparent_container(
id = lv_elem_id
bind_visible = 'LAYOUTELEMENTS.SEARCH_CONTAINER.VISIBILITY'
enabled = abap_true
is_layout_container = abap_true
width = '100%'
).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_form_cont ).
cl_wd_matrix_layout=>new_matrix_layout( container = lr_form_cont ).
lr_allg_cont->add_child( lr_form_cont ).
CONCATENATE 'SHLPSELOPT' lv_hlp INTO lv_elem_id.
CONCATENATE 'GEN_SHLP_VIEW/SHLP_SEL_OPT' lv_hlp
INTO lv_elem_embedd.
sel_opt_uielem = cl_wd_view_container_uielement=>new_view_container_uielement(
id = lv_elem_id
).
cl_wd_matrix_head_data=>new_matrix_head_data( element = sel_opt_uielem ).
lr_form_cont->add_child( sel_opt_uielem ).
CONCATENATE 'START_SEARCH_' lv_current_node_name INTO lv_elem_id.
* Button zum Starten der Suche
lr_button = cl_wd_button=>new_button(
id = lv_elem_id
text = 'Suche starten'
design = '01' ).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_button ).
lr_form_cont->add_child( lr_button ).
CONCATENATE 'CNT_TABLE_' lv_current_node_name INTO lv_elem_id.
* Container für Treffer-Tabelle dem Tab hinzufügen
lr_cont = cl_wd_transparent_container=>new_transparent_container(
id = lv_elem_id
bind_visible = 'LAYOUTELEMENTS.CNT_TABLE_CONTAINER.VISIBILITY'
enabled = abap_true
is_layout_container = abap_true
width = '100%'
).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_cont ).
cl_wd_matrix_layout=>new_matrix_layout( container = lr_cont ).
lr_allg_cont->add_child( lr_cont ).
* Die gererierte Tabelle dem Container zufügen
lr_dyntab = cl_wd_dynamic_tool=>create_table_from_node(
ui_parent = lr_cont
table_id = lv_current_node_name
node = lr_node
* on_lead_select =
).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_dyntab ).
lr_dyntab->set_visible_row_count( value = 10 ).
ENDLOOP.
* Uebernehmen Button erzeugen und LayoutDaten setzen
lr_button = cl_wd_button=>new_button(
text = 'Übernehmen'
on_action = 'DO_COPY' ).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_button ).
* dem Screen den Tabstrip und den Button hinzufügen
* lr_container->add_child( lr_tabstrip ).
lr_container->add_child( lr_button ).
* END------ IF first_time = abap_true.
ENDIF.
ENDMETHOD.
Hi Matthias,
I created a WD and added your code into it.
I also created the following context-nodes:
SHLP_FIELDS
-SHLP1
--SHLPNAME
--SHLPTEXT
-SHLP2
--SHLPNAME
--SHLPTEXT
MULTISELECTIONS
-SHLPNAME
-SHLPTEXT
LAYOUTELEMENTS
-SEARCH_CONTAINER
--VISIBILITY
-CNT_TABLE_CONTAINER
--VISIBILITY
I also created a supply function to fill the context node MULITSELECTIONS:
DATA lt_multiselections TYPE wd_this->Elements_multiselections.
DATA ls_multiselections LIKE LINE OF lt_multiselections.
@TODO compute values
e.g. call a data providing FuBa
*
ls_multiselections-shlpname = 'SHLP1'.
ls_multiselections-shlptext = 'Search help 1'.
APPEND ls_multiselections TO lt_multiselections.
ls_multiselections-shlpname = 'SHLP2'.
ls_multiselections-shlptext = 'Search help 2'.
APPEND ls_multiselections TO lt_multiselections.
bind all the elements
node->bind_table(
new_items = lt_multiselections
set_initial_elements = abap_true ).
I also deleted the following lines of code because those weren't needed.
lr_elem = lr_node->get_element( ).
lr_node = lr_elem->get_child_node( lv_current_node_name ).
lr_node isn't used anymore after this last statement, that's why.
It works fine.
The other nodes are empty at the moment.
Is this the same you have done?
Regards,
Jos
Hi Matthias,
That's curious. I tried the same and it worked fine.
Not that i saw much more than a tabstrip and some buttons, but at least no dump occurred.
I've got no clue why this view_container_uielement should give a dump.
As i sead it works fine here.
The only thing I can think of is that some content of your context-nodes messes the whole thing up.
Have you tried changing anything within the contents of your context nodes?
Regards,
Jos
Hi Jos,
thanks for your help.
I tried it in a new WD Applikation and there it worked, too.
Maybe the error comes from somewhere else, but only affects when view_container_uielement is used.
I'll donate you the Points anyways. If I get the error, I'll post it here to give the solution
Best regards, Matthias
hi matthias.....
check whether youare passing the view id correctly.
---regards,
alex b justin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.