cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynpro ABAP select options method SET_VALUE_OF_PARAMETER_FIELD

krishna_maram
Participant
0 Kudos

Hi,

I am using this method to set some defualt value to selection screen paramter in WebDynpro ABAP but it doesnt work , parameter comes up with a blank value.

wd_this->m_handler->SET_VALUE_OF_PARAMETER_FIELD( EXPORTING

I_ID = 'P_MXHITS'

I_VALUE = lv_mhits ).

This is coded in view's method WDDOINIT.

Thanks,

Krishna.

Accepted Solutions (1)

Accepted Solutions (1)

Madhu2004
Active Contributor
0 Kudos

Hi,

Please use the below code to set the default value in the parameter field:

DATA : lr_value TYPE REF TO data.
  FIELD-SYMBOLS : <fs_value> TYPE sflight-carrid.
  CREATE DATA lr_value TYPE sflight-carrid.
  ASSIGN lr_value->* TO <fs_value>.

  <fs_value> = 'AA'.
  CALL METHOD wd_this->lo_select->add_parameter_field
    EXPORTING
      i_id                         = 'CARRID'
    i_value                      = lr_value
     .

Regars,

MAdhu

Edited by: madhu reddy on Aug 17, 2010 6:22 PM

krishna_maram
Participant
0 Kudos

Hi Mahdu

I have already tried the code you suggested, but it was throwing this dump.

Runtime Errors ASSERTION_FAILED

I found a few OSS notes that resolves this problem, so I implemented them and retried with code that you suggested and now it works perfectly.

0001136905

0001137802

0001138096

0001139403

0001173687

0001176342

Thanks,

krishna

Answers (2)

Answers (2)

Sharathmg
Active Contributor
0 Kudos

The method being used is right.

Please check for the ID used in the method with the ID used in the method add_parameter_field.

Also, set a breakpoint and check the value of the variable 'lv_mhits', just pior to set_parameter method.

Regards,

Sharath

krishna_maram
Participant
0 Kudos

Hi Chinnaiya & Sharath,

DATA lv_50 TYPE i VALUE 50.

data : lv_mhits type ref to data.

create data lv_mhits type I .

append initial line to lt_params assigning <fs_params>.

<fs_params>-m_id = 'P_MXHITS'.

<fs_params>-m_WITHIN_BLOCK = 'B1'.

<fs_params>-m_value = lv_mhits.

<fs_params>-m_description = lv_text207.

*add to the selection screen.

wd_this->m_handler->ADD_PARAMETER_FIELDS( EXPORTING IT_FIELDS = lt_params )

get reference of lv_50 into lv_mhits. "this has value '50'.

*set default value

wd_this->m_handler->SET_VALUE_OF_PARAMETER_FIELD( EXPORTING

I_ID = 'P_MXHITS'

I_VALUE = lv_mhits ).

That is the code I wrote. Do you see any issues with it?

Thanks,

krishna.

Former Member
0 Kudos

HI Krishna Prasad ,

Go through the below sample code and make a try , hope it will work properly

def_value(2) type c   value 'AA',     " default value 
  lr_value            type ref to sflight-carrid .
  field-symbols: <value> type any .

* assigning default valu to the field symbol 
  ASSIGN def_value to <value>.
  data d_value type REF TO data .

*assigning FS to the variable of type  ref to data 
 CREATE DATA d_value type string .
 get REFERENCE OF <value> INTO d_value. :d_valu will hold the defalt value now 

 wd_this->m_handler->add_parameter_field(       "M_HANDLER  type IF_WD_SELECT_OPTIONS
      i_description     = 'text'
      i_id              = 'PREDEF_PARAMVALUE'
      i_value           = lr_value ).


    wd_this->m_handler->set_value_of_parameter_field(
       i_id = 'PREDEF_PARAMVALUE'
       i_value = d_value ).

Regards

Chinnaiya P