cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic context and table

Former Member
0 Kudos

Hello,

I created a dynamic context and a dynamic table that use this dynamic context. I have the following error:* * The following error text was processed in the system XAP : Could not find attribute AMOUNT2009**

  • The error occurred on the application server sat190_XAP_00 and in the work process 0 .

  • The termination type was: RABAX_STATE

  • The ABAP call stack was:

Method: IF_WD_CONTEXT_NODE_INFO~GET_ATTRIBUTE of program CL_WDR_CONTEXT_NODE_INFO======CP

Method: GET_ATTRIBUTE_INFO of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============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

AMOUNT2009 is a new attribute that add to my context, i made the next code, can you review and say me where i have the error? I start with the second year is for this reason that i use a count.

  • Reading FINCATYGROUP

DATA lo_nd_fincatygroup TYPE REF TO if_wd_context_node.

DATA lo_el_fincatygroup TYPE REF TO if_wd_context_element.

DATA ls_fincatygroup TYPE wd_this->element_fincatygroup.

DATA : lv_year type STRING,

ls_attribute type wdr_context_attribute_info, "To create dynamic node in the context

lr_container TYPE REF TO CL_WD_UIELEMENT_CONTAINER,

lr_table TYPE REF TO CL_WD_TABLE,

lr_input_field TYPE REF TO CL_WD_INPUT_FIELD,

lr_cell_editor TYPE REF TO if_wd_table_cell_editor,

lr_column TYPE REF TO CL_WD_TABLE_COLUMN,

lr_column_header TYPE REF TO CL_WD_CAPTION,

lv_headerColumn TYPE STRING,

lv_id_input_field TYPE STRING,

lv_name TYPE STRING,

lv_id_table_column TYPE STRING.

DATA: lr_node_info TYPE REF TO if_wd_context_node_info, "To get node info

lr_table_type TYPE REF TO cl_abap_tabledescr, "To get table and stuct descriptor

lr_line_type TYPE REF TO cl_abap_structdescr,

lt_components TYPE cl_abap_structdescr=>component_table, "To get component table

ls_components_line LIKE LINE OF lt_components, "One line of component table

lr_elem_type TYPE REF TO cl_abap_elemdescr.

LOOP AT lv_periods_tt INTO lv_periods_ts.

  • get all declared attributes

lv_periods_ts->get_static_attributes(

IMPORTING

static_attributes = ls_wa_period ).

  • navigate from <CONTEXT> to <FINCATYGROUP> via lead selection

lo_nd_fincatygroup = wd_context->get_child_node( name = wd_this->wdctx_fincatygroup ).

IF lv_cont = 1 OR lv_cont = 2.

lv_cont = lv_cont + 1.

ELSE.

  • Create dynamic context and dynamic view

  • get node_info

lr_rootnodeinfo = lo_nd_fincatygroup->get_node_info( ).

lv_year = ls_wa_period-zyear.

SHIFT lv_year BY 15 PLACES LEFT.

CONCATENATE 'AMOUNT' lv_year INTO lv_name.

  • put attributes of add_attrbute node

CONCATENATE 'Y' lv_year INTO ls_attribute-name.

ls_attribute-name = lv_name.

ls_attribute-type_name = '\TYPE=/RPM/TV_CURR_AMOUNT'.

lr_rootnodeinfo->add_attribute( "Add attribute for amount of year

EXPORTING

attribute_info = ls_attribute ).

  • ********************* table *******************************************************

  • Get ROOTUIELEMENTCONTAINER

lr_container ?= view1->get_element( 'ROOTUIELEMENTCONTAINER ' ).

  • Get TABLEFCG

lr_table ?= view1->get_element( 'TABLEFCG' ).

  • Create cell_editor

CONCATENATE 'TABLEFCGIF_Y' lv_year '_EDITOR' INTO lv_id_input_field.

lr_input_field = cl_wd_input_field=>new_input_field(

id = lv_id_input_field bind_value = ls_attribute-name ).

CONCATENATE 'TABLEFCG_Y' lv_year '_EDITOR' INTO lv_headerColumn.

lr_column_header = cl_wd_caption=>new_caption( id = lv_headerColumn ).

lr_column_header->set_text( ls_attribute-name ).

  • Create table column

CONCATENATE 'TABLEFCG_' lv_year 'COLUMN' INTO lv_id_table_column.

lr_column = cl_wd_table_column=>new_table_column( id = lv_id_table_column ).

lr_column->set_table_cell_editor( lr_input_field ).

lr_column->set_header( lr_column_header ).

lr_table->add_grouped_column( lr_column ).

  • ********************* end table *******************************************************

ENDIF.

ENDLOOP.

Thanx.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi, Paulina!

The problem seems to be the value "AMOUNT2009**" in lv_year, which you manipulate after reading from lv_periods_ts.

What exactly does the variable ls_wa_period-zyear contain before assigning the value to lv_year? What' s the value in lv_year after shift? What attribute-name do try to you read from when the exception occurs?

Regard,

Thomas