on 01-15-2009 8:22 AM
Hi Friends,
In my Select-options component, I have two buttons one save Variant and the other Get variant.
Using save variant button, I am able to save the variant successfully.
But while retrieving the Variant from INDX table I am getting an Error.
I have all my selection-screen-fields in WD_THIS->IMPORT_PARAMETERS ,based on the filed type like parameter/select-options i need to populate the data.
in my screen, first field is parameter, for this i am able to get the data sucessfully,but the next filed is Select-options.but for the Second-time when the cursor encounters the method create_range_table,
it gives me an erro as 'Dynamic type conflict when assigning references' .
Just loot at the Error Analysis which i got in ST22.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_MOVE_CAST_ERROR', was not
caught in
procedure "IF_WD_SELECT_OPTIONS~CREATE_RANGE_TABLE" "(METHOD)", nor was it
propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
It was tried to assign a reference to a rereference variable using the
'CAST' operation ('?=' or 'MOVE ?TO').
However, the current content of the source variable does not fit into
the target variable.
source type: "\CLASS=CL_ABAP_STRUCTDESCR"
target type: "\CLASS=CL_ABAP_ELEMDESCR"
Following is my Code.
data: wa_itab type ref to data.
field-symbols: <fs_range> type any,
<fs_rangetable> type table.
IF sy-subrc = 0.
IMPORT tab = it_contents FROM DATABASE indx(px) TO wa_indx ID l_id." CLIENT cl.
LOOP AT WD_THIS->IMPORT_PARAMETERS INTO L_IMPORT.
read table it_contents into wa_contents index sy-tabix.
CLEAR: RANGE_TABLE, L_TYPE, L_KIND, L_STRING.
CLEAR L_SEARCHPARAMETER.
L_SEARCHPARAMETER-NAME = L_IMPORT-PARAMETER.
IF L_IMPORT-OPTIONAL IS NOT INITIAL.
L_OBLIGATORY = ABAP_FALSE.
ELSE.
L_OBLIGATORY = ABAP_TRUE.
ENDIF.
IF L_IMPORT-DBFIELD IS INITIAL.
L_TYPE = L_IMPORT-TYP.
ELSE.
L_TYPE = L_IMPORT-DBFIELD.
ENDIF.
SELECT SINGLE TTYPKIND FROM DD40L INTO L_KIND WHERE TYPENAME = L_TYPE AND
AS4LOCAL = 'A'.
IF SY-SUBRC = 0 AND L_KIND = 'R'.
RANGE_TABLE = ABAP_TRUE.
ENDIF.
TRY.
CREATE DATA L_DREF TYPE (L_TYPE).
CATCH CX_SY_CREATE_DATA_ERROR.
ENDTRY.
IF RANGE_TABLE = ABAP_TRUE.
*create the range table.
call method wd_comp_controller->m_handler->create_range_table
exporting
i_typename = L_SEARCHPARAMETER-NAME
receiving
rt_range_table = l_dref.
assign l_dref->* to <fs_rangetable>.
create data wa_itab like line of <fs_rangetable>.
assign wa_itab->* to <fs_range>.
move-corresponding wa_contents to <fs_range>.
append <fs_range> to <fs_rangetable>.
call method wd_comp_controller->M_HANDLER->SET_RANGE_TABLE_OF_SEL_FIELD(
exporting
I_ID = L_SEARCHPARAMETER-NAME
IT_RANGE_TABLE = l_dref ).
clear : l_dref,wa_contents,L_SEARCHPARAMETER-NAME.
ELSE.
*create the range table.
call method wd_comp_controller->m_handler->create_range_table
exporting
i_typename = L_SEARCHPARAMETER-NAME
receiving
rt_range_table = l_dref.
*clear : <fs_rangetable>,<fs_range>,wa_itab.
assign l_dref->* to <fs_rangetable>.
create data wa_itab like line of <fs_rangetable>.
assign wa_itab->* to <fs_range>.
move-corresponding wa_contents to <fs_range>.
append <fs_range> to <fs_rangetable>.
call method wd_comp_controller->m_handler->SET_VALUE_OF_PARAMETER_FIELD(
exporting
i_id = l_searchparameter-name
I_VALUE = l_dref ).
clear : l_dref,wa_contents,L_SEARCHPARAMETER-NAME.
ENDIF.
ENDLOOP.
else.
exit.
endif.
Regards,
Xavier.P
this has been solved, bu using other methods alternative to Create_range_tables.
regards,
Xavier.P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the value in L_SEARCHPARAMETER-NAME at the time. It looks like it is a Data Dictionary structure and not an element - hence the incorrect casting of a sturcture descriptor instead of an element descriptor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Hi thomas,
>
> It is of type ihttpnvp.
>
> DATA: l_searchparameter TYPE ihttpnvp.
>
> it was working fine for the first loop i.e parameter.but when it comes to the next filed,select-options filed it gives me the error 'Dynamic type conflict when assigning references'
> .
>
> Regards,
>
> Xavier
I didn't ask what the data type of l_searchparameter was, but what is the value of name field that you are passing in. The value will contain the name of the data type that should be used to generate the range table. I can only assume that the value you are passing in is a structure and not a data element.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.