cancel
Showing results for 
Search instead for 
Did you mean: 

code for capturing the values from select option from date and to date field

Former Member
0 Kudos

Hi All

Can you share the code how to captuer the values from select option fields.

Here I am using From date To to date .

This Date I have desgined in the layout by using Standard component wdr_select_option .

 

* create the used component

 

DATA LO_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.

LO_CMP_USAGE = WD_THIS->WD_CPUSE_SELECT_OPTIONS( ).

IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.

LO_CMP_USAGE->CREATE_COMPONENT( ).

ENDIF.

DATA LO_INTERFACE TYPE REF TO IWCI_WDR_SELECT_OPTIONS.

LO_INTERFACE = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).

 

DATA: LT_RANGE_TABLE TYPE REF TO DATA,

LT_RANGE_TABLE2 TYPE REF TO DATA,

RT_RANGE_TABLE TYPE REF TO DATA,

READ_ONLY TYPE ABAP_BOOL,

TYPENAME TYPE STRING.

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 = 'DATUM' ).

 

* add a new field to the selection

 

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

  • IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).

This Code I had written in WDDOINT method of view .

But now my requirement is I need to captuer the data values from date range UI element into button and perform the following action.

Depending on the date Range it need to display Managers subbordinates  in the table .

Thanks & Regards

Deepika

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Deepika

    If u got an answer then make this thread is answered and close the same.

Regards,

Venkat

Answers (3)

Answers (3)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

As suggested, here are the steps. You need to place in the suitable place where you want to track the details.

Step1:

As menioned in your code

DATA LO_INTERFACE_CO TYPE REF TO IWCI_WDR_SELECT_OPTIONS.

LO_INTERFACE_CO = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).

 

Step2:

Declare range and initiliaze selection screen.

DATA: LT_RANGE TYPE REF TO DATA,

LO_HELPER TYPE REF TO IF_WD_SELECT_OPTIONS.

LO_HELPER = LO_INTERFACE_CO->INIT_SELECTION_SCREEN().

Step3:

Call method for getting data.

CALL METHOD LO_HELPER->GET_RANGE_OF_SEL_FIELD

EXPORING

I_ID = 'DATUM'

RECEIVING

RT_RANGE_TABLE = LT_RANGE.

Step4:

Assign it to field-symbol.

FIELD_SYMBOLS <FS> TYPE TABLE.

ASSIGN <LT_RANGE> TO <FS>.

Former Member
0 Kudos

yes

Former Member
0 Kudos

Hi Deepika,

Create one button and create one action method. and write below code.

data :

  lt_date TYPE REF TO data,

  ls_date LIKE LINE OF lr_date,

  lv_beg_date    TYPE datum,
  lv_end_date    TYPE datum.

   FIELD-SYMBOLS<fs_date>.

  lt_date = wd_this->m_handler1->get_range_table_of_sel_field( i_id = 'DATUM' ).

   ASSIGN lt_date->* TO <fs_date>.

    READ TABLE <fs_date> INTO ls_date INDEX 1.
  lv_beg_date = ls_date-low.
  lv_end_date = ls_date-high.

U will get two dates in these two variables and

in selection statement use   'IN'  with field symbol <fs_date>.

Regards,

Venkat.

Former Member
0 Kudos

Hi Venkat

when I am trying to use the above code it is giving follow error

field "LT_DATE " is unknow .It is neither in one of the specified tables nor defined by  a "data " statement .

Regards

Deepika

Former Member
0 Kudos

Hi Deepika ,

Declare like below..

   DATA: lt_date              TYPE REF TO data,
             lr_range             TYPE RANGE OF begda,
            ls_range             LIKE LINE OF lr_range,
            lv_beg_date          TYPE datum,
            lv_end_date          TYPE datum,

Regards,

Venkat

Former Member
0 Kudos

Hi Deepika

    If u got answer them make this thread is answered and close the same.

Regards,

Venkat

chengalarayulu
Active Contributor
0 Kudos

Hi Deepika,

can you try with the below.

   DATA: rt_carrid     TYPE REF TO data.
  DATA: rt_connid     TYPE REF TO data.

  FIELD-SYMBOLS: <fs_carrid> TYPE table,
                 <fs_connid> TYPE table.

* Retrieve the data from the select option
  rt_carrid = wd_this->m_handler->get_range_table_of_sel_field(
    i_id = 'DATUM').

* Assign it to a field symbol
  ASSIGN rt_carrid->* TO <fs_carrid>.