Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Select Options

Hi all,

I have this problem. I have a select options (ZLOEVM) in my view and for retrieve the information from this select options I use this code:

data zloevm type ref to DATA.

FIELD-SYMBOLS: <ZLOEVM> TYPE TABLE.

data ls_select_options type ZPS_TT_SELECT_OPTIONS.

WD_THIS->M_WD_SELECT_OPTIONS = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).

  • init the select screen

WD_THIS->M_HANDLER = WD_THIS->M_WD_SELECT_OPTIONS->INIT_SELECTION_SCREEN( ).

ZLOEVM = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'LOEVM' ).

ASSIGN ZLOEVM->* TO <ZLOEVM>.

LS_SELECT_OPTIONS = <ZLOEVM>.

My structure ZPS_TT_SELECT_OPTIONS has this fields:

FIELDNAME (type string), SIGN, OPTION, LOW (string) and HIGH (string).

I have a dump when I run this code: LS_SELECT_OPTIONS = <ZLOEVM>.

The error is "Two internal tables are neither compatible nor convertible".

Can you help me?

TKS

Former Member
Former Member replied

Hi,

Try the below coding.

In the initialization,

METHOD WDDOINIT .

DATA: LT_RANGE_TABLE TYPE REF TO DATA,

RT_RANGE_TABLE TYPE REF TO DATA,

READ_ONLY TYPE ABAP_BOOL,

TYPENAME TYPE STRING.

DATA: LR_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER,

L_REF_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.

  • create the used component

L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_SELECT_OPTIONS( ).

IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.

L_REF_CMP_USAGE->CREATE_COMPONENT( ).

ENDIF.

WD_THIS->M_WD_SELECT_OPTIONS = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).

  • init the select screen

WD_THIS->M_HANDLER = WD_THIS->M_WD_SELECT_OPTIONS->INIT_SELECTION_SCREEN( ).

WD_THIS->M_HANDLER->SET_GLOBAL_OPTIONS(

I_DISPLAY_BTN_CANCEL = ABAP_FALSE

I_DISPLAY_BTN_CHECK = ABAP_FALSE

I_DISPLAY_BTN_RESET = ABAP_FALSE

I_DISPLAY_BTN_EXECUTE = ABAP_FALSE ).

  • create a range table that consists of this new data element

LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( I_TYPENAME = 'S_CARR_ID' ).

  • add a new field to the selection

WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'S_CARR_ID'

IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).

ENDMETHOD.

In the Button Action write the following code

METHOD ONACTIONSEARCH .

DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.

DATA: RT_CARRID TYPE REF TO DATA.

DATA: ISFLIGHT TYPE TABLE OF SFLIGHT.

DATA: WSFLIGHT TYPE SFLIGHT.

FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE.

  • Retrieve the data from the select option

RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_CARR_ID' ).

  • Assign it to a field symbol

ASSIGN RT_CARRID->* TO <FS_CARRID>.

CLEAR ISFLIGHT. REFRESH ISFLIGHT.

SELECT * INTO CORRESPONDING FIELDS OF TABLE ISFLIGHT FROM SFLIGHT

WHERE CARRID IN <FS_CARRID>.

NODE_FLIGHTS = WD_CONTEXT->GET_CHILD_NODE( NAME = `FLIGHTS` ).

NODE_FLIGHTS->BIND_ELEMENTS( ISFLIGHT ).

ENDMETHOD.

Regards,

Balaji.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question