cancel
Showing results for 
Search instead for 
Did you mean: 

select options default value and execute

Former Member
0 Kudos

Hello,

I managed to fill my select options default value. But what I also want is that the user does not have to press the execute button when the screen is shown at the first time. I would like to show the result screen for these default values at the same time the screen is shown first.

I tried in WDDOINIT:

data: l_ref_interfacecontroller type ref to iwci_wdr_select_options .

l_ref_interfacecontroller = wd_this->wd_cpifc_select_options( ).

l_ref_interfacecontroller->execute(

).

but this coding only works when the select-option screen was shown the first time.

Any ideas?

regards

stefan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Stefan.

The coding for the exceution is loacted in your current component isn't it? So why don't you just call this method directly after you initialized the select options in wddoinit?

Or do you have a different architecture?

Cheers,

Sascha

Former Member
0 Kudos

Hello Sascha,

yes the coding is in the same component. I tried to call it while raising the event execute.

Now I tried to call the method as you sugested directly after initializing the select options in wddonit. Unfortunetly I get a dump (Access via 'NULL' object reference not possible) at the following line:

*--- Retrieve the data from the select option

lr_user = wd_this->mr_selopt->get_range_table_of_sel_field(

i_id = 'UNAME' ).

If I press the execute button (which uses the same coding) everything works fine.

Do you have any idea?

regards

stefan

Former Member
0 Kudos

Hi Stefan.

Seems that mr_selopt is initial at this point. Did you set it in wddoiint before you called the method ditrectly?

Cheers,

Sascha

Former Member
0 Kudos

Hello Sascha,

I checked that WD_THIS->MR_SELOPT is filled.

My coding in WDDOINIT is:

*--- Instantiate select options component

lr_usage = wd_this->wd_cpuse_usage_so( ).

if lr_usage->has_active_component( ) is initial.

lr_usage->create_component( ).

endif.

*--- Initialize selection screen

lr_if_controller = wd_this->wd_cpifc_usage_so( ).

wd_this->mr_selopt = lr_if_controller->init_selection_screen( ).

*--- Configure layout options

wd_this->mr_selopt->set_global_options(

i_display_btn_cancel = abap_false

i_display_btn_check = abap_false

i_display_btn_reset = abap_true

i_display_btn_execute = abap_true ).

*--- Create range tables

lt_range = wd_this->mr_selopt->create_range_table(

i_typename = 'DATUM' ).

*Range vorbelegen

wa_dats = sy-datum - 30.

wa_range_datum-sign = 'I'.

wa_range_datum-option = 'BT'.

wa_range_datum-low = wa_dats.

wa_range_datum-high = sy-datum.

assign lt_range->* to <fs_rangetable>.

create data r_headerline like line of <fs_rangetable>.

assign r_headerline->* to <fs_range>.

move-corresponding wa_range_datum to <fs_range>.

append <fs_range> to <fs_rangetable>.

wd_this->mr_selopt->add_selection_field( i_id = 'DATUM'

it_result = lt_range ).

lt_range = wd_this->mr_selopt->create_range_table( i_typename = 'UZEIT' ).

wd_this->mr_selopt->add_selection_field( i_id = 'UZEIT'

it_result = lt_range ).

lt_range = wd_this->mr_selopt->create_range_table( i_typename = 'UNAME' ).

wd_this->mr_selopt->add_selection_field( i_id = 'UNAME'

it_result = lt_range

i_no_intervals = 'X'

i_no_extension = 'X' ).

data: event type ref to cl_wd_custom_event.

create object event

exporting

name = 'EXECUTE'

  • parameters =

.

wd_this->search_sel_opt(

wdevent = event " Ref to cl_Wd_Custom_Event

).

Maybe you can see my mistake?

regards

stefan

Former Member
0 Kudos

Please provide the code of

wd_this->search_sel_opt(

wdevent = event " Ref to cl_Wd_Custom_Event

).

Cheers,

Sascha

Former Member
0 Kudos

Hello Sascha,

here it is:

DATA lt_snap_beg TYPE STANDARD TABLE OF snap_beg.

DATA lr_node TYPE REF TO if_wd_context_node.

DATA lr_user TYPE REF TO data.

DATA lr_date TYPE REF TO data.

DATA lr_time TYPE REF TO data.

DATA lv_strlen TYPE i.

DATA ls_snap_beg TYPE snap_beg.

FIELD-SYMBOLS <lt_user> TYPE table.

FIELD-SYMBOLS <lt_date> TYPE table.

FIELD-SYMBOLS <lt_time> TYPE table.

*--- Retrieve the data from the select option

lr_user = wd_this->mr_selopt->get_range_table_of_sel_field(

i_id = 'UNAME' ).

ASSIGN lr_user->* TO <lt_user>.

lr_date = wd_this->mr_selopt->get_range_table_of_sel_field(

i_id = 'DATUM' ).

ASSIGN lr_date->* TO <lt_date>.

lr_time = wd_this->mr_selopt->get_range_table_of_sel_field(

i_id = 'UZEIT' ).

ASSIGN lr_time->* TO <lt_time>.

*--- Read dump table

SELECT * FROM snap_beg INTO ls_snap_beg WHERE seqno = '000'

AND datum IN <lt_date>

AND uzeit IN <lt_time>

AND uname IN <lt_user>

ORDER BY datum DESCENDING uzeit DESCENDING.

*--- Extract runtime error name

lv_strlen = ls_snap_beg-flist+2(3).

IF lv_strlen < 1 OR lv_strlen > 30.

EXIT.

ELSE.

ls_snap_beg-flist = ls_snap_beg-flist+5(lv_strlen).

ENDIF.

APPEND ls_snap_beg TO lt_snap_beg.

ENDSELECT.

*--- Fill context node

lr_node = wd_context->get_child_node( name = `DUMPS` ).

lr_node->bind_elements( lt_snap_beg ).

I get the dump at the following line:

*--- Retrieve the data from the select option

lr_user = wd_this->mr_selopt->get_range_table_of_sel_field(

i_id = 'UNAME' ).

What I dont understand is that it works when i press the execute button, but not at this time.

thanks,

stefan

Former Member
0 Kudos

Hi Stefan.

So this seems not to work. The view must be visible.

In the view of the select option in method wddomodify the method init is called

whichsets the context root node. This node is used in the get_range_table mthod. So no initialization no range table.

You should consider another way.

You could write the method that performs the selection. In wddoinit you call this method with the default values directly.

In the event hanlder of the execute button you read the tables and transfer the values to the method.

Hope this helps,

Sascha

Former Member
0 Kudos

Hello Sascha,

to bad its not working that easily.

Thanks for you suggestion for the other way.

regards

stefan