cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of type "g" to type "h" not supported.

Former Member
0 Kudos

Hi friends,

In select-options component, while assigning the Range table Value of the select-options field( PERNR ),

to exporting parameter VALUE of the SET_ATTRIBUTE method,I am getting the error as

Conversion of type "g" to type "h" not supported.,

kindly, provide me some inputs, in solving this Issue.

Regards,

Xavier.P

Accepted Solutions (1)

Accepted Solutions (1)

yesrajkumar
Active Participant
0 Kudos

Hi,

Try giving the Range table value as 'PERNR_D' instead of 'PERNR'. I faced the same problem before and it got resolved because of the below changes.

example:

wd_this->m_handler->create_range_table(

i_typename = 'PERNR_D' ).

  • add a new field to the selection

wd_this->m_handler->add_selection_field(

i_id = 'PERNR_D'

it_result = lt_range_table

i_read_only = read_only ).

Thanks,

Rajkumar.S

Former Member
0 Kudos

Hi Raj,

Below is my Code, Before pernr, I am able to set the value of Begda to set_attribute, but when I am trying to set the Pernr values to set_attibute method, the above Error occurs.

field-symbols : <FS1> type any,

<FS2> TYPE DATA.

LOOP AT WD_THIS->IMPORT_PARAMETERS INTO L_IMPORT.

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.

L_DREF = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = L_SEARCHPARAMETER-NAME ).

IF L_DREF IS BOUND.

ASSIGN L_DREF->* TO <TABLE>.

TRY.

CALL TRANSFORMATION (`ID`)

SOURCE TABLEXML = <TABLE>

RESULT XML L_XML_STRING.

L_STRING = L_XML_STRING.

CATCH CX_ST_ERROR.

CATCH CX_ROOT.

ENDTRY.

ELSE.

IF L_IMPORT-OPTIONAL IS INITIAL.

RETURN.

ELSE.

CLEAR L_STRING.

ENDIF.

ENDIF.

ELSE.

L_DREF = WD_THIS->M_HANDLER->GET_VALUE_OF_PARAMETER_FIELD( I_ID = L_SEARCHPARAMETER-NAME ).

IF L_DREF IS BOUND.

ASSIGN L_DREF->* TO <FS>.

L_STRING = <FS>.

ELSE.

IF L_IMPORT-OPTIONAL IS INITIAL.

RETURN.

ELSE.

CLEAR L_STRING.

ENDIF.

ENDIF.

ENDIF.

L_SEARCHPARAMETER-VALUE = L_STRING.

ASSIGN L_SEARCHPARAMETER-NAME TO <FS1>.

ASSIGN L_SEARCHPARAMETER-VALUE TO <FS2>.

*<FS1> = L_SEARCHPARAMETER-NAME.

IMPORTING_NODE->set_attribute(

exporting

name = <FS1>

value = <FS2> ).

  • APPEND L_SEARCHPARAMETER TO LT_SEARCHPARAMETERS.

endloop.

Regards,

Xavier.P

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I think you might have a type ref to data that you are trying to pass into the interface parameter, but it is difficult to tell from your code fragement because not all the data declarations are there. What is the data type of L_SEARCHPARAMETER-VALUE?

Former Member
0 Kudos

Hi Thomas,

L_SEARCHPARAMETER is of type IHTTPNVP.

Complete code,once again I have given Below.

DATA: L_SEARCHPARAMETER TYPE IHTTPNVP.

******************************creating attributes to the importing node based on importing*****

******************************parameters of function module*****************************

  • Get the signature of the FM

WD_ASSIST->BUILD_SIGNATURE(

EXPORTING

FUNCTION_NAME = WD_THIS->APP_INFO-FUNCNAME

IMPORTING

DOKUMENTATION = WD_THIS->DOKUMENTATION

EXCEPTION_LIST = WD_THIS->EXCEPTION_LIST

EXPORT_PARAMETERS = WD_THIS->EXPORT_PARAMETERS

IMPORT_PARAMETERS = WD_THIS->IMPORT_PARAMETERS

CHANGING_PARAMETERS = WD_THIS->CHANGING_PARAMETERS

TABLES_PARAMETERS = WD_THIS->TABLES_PARAMETERS

FM_TEXT = WD_THIS->FMTEXT ).

  • Create import node attributes

WD_ASSIST->CREATE_IMPORT_ATTRIBUTES(

EXPORTING

PARENT_INFO = WD_THIS->IMPORTINGNODEINFO

IMPORT_PARAMETERS = WD_THIS->IMPORT_PARAMETERS

IS_MULTIPLE = ABAP_TRUE

IMPORTING

IMPORT_ATTRIBUTES = WD_THIS->IMPORTATTRIBUTES ).

******************************creating attributes to the importing node based on importing*****

******************************parameters of function module*********************************

  • create and fill node

DATA: STRU_TAB TYPE REF TO DATA.

FIELD-SYMBOLS: <TAB> TYPE TABLE.

FIELD-SYMBOLS: <STRU> TYPE DATA.

DATA: ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA: L_ATTRIBUTE TYPE WDR_CONTEXT_ATTRIBUTE_INFO.

DATA: L_PARAMS TYPE WDR_NAME_VALUE.

DATA: NAME TYPE STRING.

DATA: ROOT_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: FUNC_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: IMPORTING_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: TABLES_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: TABLE_TMP_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: TABLE_NAME TYPE STRING.

DATA: L_NODE TYPE ZWDAPI_NODES.

DATA: L_NAME TYPE STRING.

DATA: IMPORTING_NAME TYPE STRING.

DATA: EMBEDDING_POSITION TYPE STRING.

DATA: TABLES_NAME TYPE STRING.

DATA: FUNC_NAME TYPE STRING.

DATA: LT_SEARCHPARAMETERS TYPE TIHTTPNVP.

DATA: L_SEARCHPARAMETER TYPE IHTTPNVP.

DATA: SUBRC TYPE SYSUBRC.

DATA: L_OUT TYPE ZWD_STRUC_TABLE.

DATA: TABLES_OUT TYPE ZWD_TAB_TABLE.

DATA: RETURN TYPE BAPIRETURN1.

DATA: LO_VIEW_CONTROLLER TYPE REF TO IF_WD_VIEW_CONTROLLER.

DATA: L_MESSAGE_MANAGER TYPE REF TO IF_WD_MESSAGE_MANAGER.

DATA: L_MESSAGE TYPE ZWD_MESSAGE_STRUC.

DATA: MESSAGES TYPE ZWD_MESSAGE_TAB.

DATA L_IMPORT TYPE RSIMP.

DATA: L_TEXT TYPE STRING.

FIELD-SYMBOLS: <FS> TYPE ANY.

DATA DREF TYPE REF TO DATA.

DATA: LR_API_COMP_CONTROLLER TYPE REF TO IF_WD_COMPONENT.

DATA: LR_WINDOW_MANAGER TYPE REF TO IF_WD_WINDOW_MANAGER.

DATA: E_POPUP TYPE REF TO IF_WD_WINDOW.

DATA: LO_API_CONTROLLER TYPE REF TO IF_WD_VIEW_CONTROLLER.

DATA: L_XML_STRING TYPE XSTRING.

FIELD-SYMBOLS: <TABLE> TYPE TABLE.

DATA: L_TYPE TYPE STRING,

L_KIND TYPE DD40L-TTYPKIND,

RANGE_TABLE TYPE ABAP_BOOL,

L_STRING TYPE string,

L_OBLIGATORY TYPE ABAP_BOOL,

L_DREF TYPE REF TO DATA .

LO_VIEW_CONTROLLER = WD_THIS->WD_GET_API( ).

L_MESSAGE_MANAGER = LO_VIEW_CONTROLLER->GET_MESSAGE_MANAGER( ).

  • default selection screen attribute context values from url parameters

IMPORTING_NAME = WD_THIS->IMPORTINGNODEINFO->GET_NAME( ).

FUNC_NAME = WD_THIS->FUNCNODEINFO->GET_NAME( ).

ROOT_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = 'ROOT1' ).

FUNC_NODE = ROOT_NODE->GET_CHILD_NODE( NAME = FUNC_NAME ).

IMPORTING_NODE = FUNC_NODE->GET_CHILD_NODE( NAME = IMPORTING_NAME ).

field-symbols : <FS1> type any,

<FS2> TYPE string,

<FS3> TYPE string.

LOOP AT WD_THIS->IMPORT_PARAMETERS INTO L_IMPORT.

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.

L_DREF = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = L_SEARCHPARAMETER-NAME ).

field-SYMBOLS : <ft> type ANY TABLE,

<fsW> type any,

<f_sign> type CHAR1,

<f_option> type CHAR2,

<f_low> type any,

<f_high> type any,

<v_low_high> type any.

*----->>

IF L_DREF IS BOUND.

  • ASSIGN L_DREF->* TO <TABLE>.

assign l_dref->* to <ft>.

Loop at <ft> ASSIGNING <fsW>.

*u201Cline of table goes to field symbol of structure

*transfer components to individual field symbols for sign, option, low and high

assign component : 'SIGN' of STRUCTURE <fsW> to <f_sign>,

'OPTION' of structure <fsW> to <f_option>,

'LOW' of STRUCTURE <fsW> to <f_low>,

'HIGH' of STRUCTURE <fsW> to <f_high>.

endloop.

data v_low_high type string.

concatenate <f_low> <f_high> into v_low_high." separated by ' '.

ASSIGN v_low_high TO <FS3>.

L_SEARCHPARAMETER-VALUE = <FS3> .

L_STRING = L_SEARCHPARAMETER-VALUE.

  • TRY.

  • CALL TRANSFORMATION (`ID`)

  • SOURCE TABLEXML = <TABLE>

  • RESULT XML L_XML_STRING.

  • L_STRING = L_XML_STRING.

  • CATCH CX_ST_ERROR.

  • CATCH CX_ROOT.

  • ENDTRY.

ELSE.

IF L_IMPORT-OPTIONAL IS INITIAL.

RETURN.

ELSE.

CLEAR L_STRING.

ENDIF.

ENDIF.

ELSE.

L_DREF = WD_THIS->M_HANDLER->GET_VALUE_OF_PARAMETER_FIELD( I_ID = L_SEARCHPARAMETER-NAME ).

IF L_DREF IS BOUND.

ASSIGN L_DREF->* TO <FS>.

L_STRING = <FS>.

ELSE.

IF L_IMPORT-OPTIONAL IS INITIAL.

RETURN.

ELSE.

CLEAR L_STRING.

ENDIF.

ENDIF.

ENDIF.

L_SEARCHPARAMETER-VALUE = L_STRING.

ASSIGN L_SEARCHPARAMETER-NAME TO <FS1>.

ASSIGN L_SEARCHPARAMETER-VALUE TO <FS2>.

*<FS1> = L_SEARCHPARAMETER-NAME.

IMPORTING_NODE->set_attribute(

exporting

name = <FS1>

value = <FS2> ).

  • APPEND L_SEARCHPARAMETER TO LT_SEARCHPARAMETERS.

endloop.

Former Member
0 Kudos

Hi Xavier,

I'm not sure wether this will work for you. I applied the same to avoid the error.

Please give it a try.

Regarding fieldsymbols assignment and moving it to another variable.

field-symbols: <fs> type data.
data lt_final type standard table of WDR_CONTEXT_CHANGE.
data ls_final type WDR_CONTEXT_CHANGE.
data ls_flights type ref to wd_this->element_flights.
data lv_var type string.

 read table lt_final into ls_final index 1.

case ls_final-ATTRIBUTE_NAME.
when 'CARRID'.
        assign ls_final-new_value->* to <fs>.
          lv_var = cl_wdr_conversion_utils=>to_string( value = <fs> ).
       ls_flights-carrid = lv_var.

when...

Endcase.

Try to understand this piece of code and apply the same where ever neccessary.

I think cl_wdr_conversion_utils=>to_string( value = <fs>) is the statement required to avoid conversion errors which you got.

I think you are directly assigning the fieldsymbol to the variable. This would be the possible cause of the error.

L_SEARCHPARAMETER-VALUE = L_STRING. 

ASSIGN L_SEARCHPARAMETER-NAME TO <FS1>.
ASSIGN L_SEARCHPARAMETER-VALUE TO <FS2>.
*<FS1> = L_SEARCHPARAMETER-NAME.
IMPORTING_NODE->set_attribute(
exporting
name = <FS1>
value = <FS2> ).

Try to move the <FS1> to other variable of type string then move it to the name ans value attibutes of the methods.

Have a look at the usage of this class cl_wdr_conversion_utils.

Regards,

Lekha.

Former Member
0 Kudos

Hi Lekha,

What is the Method that is used for converting field-symnbol data to DATA format?

Becuase in set_attribute method parameter 'value' is of type DATA.

Regards,

Xavier

Former Member
0 Kudos

Hi Xavier,

Please try to use the conversion class as specified above because in some cases we cannot directly move the fieldsymols to variables. We need to convert them to the target variable type then we can move to the actual variable. Please try to understand my code snippet in earlier post.

Regards,

Lekha.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Xavier,

Please check out with the fieldsymbols you are using to populate the range table.

Check the structure of the Range table you are trying to populate.

I think the VALUE is of DATA type, it means a fieldsymbol.

Regards,

Lekha.