cancel
Showing results for 
Search instead for 
Did you mean: 

Default Values for Select-options In Webdynpro-ABAP

Former Member
0 Kudos

Hi Freinds,

Kindly,Help me in setting the Default values for the Select-options in Webdynpro ABAP.

Here the Node and the Attributes are Created Dynamically, and then Displayed Select-options Component View.

Regards,

Xavier.P

Accepted Solutions (1)

Accepted Solutions (1)

former_member188831
Contributor
0 Kudos

Yes Xavier as explained by other colleauges you have to use set_attribute method...

once you created your objects then you call the method..

with the help of node/element instance..

set_Attribute(

exporting

Name = ' '

Value = ' ').

call this once you crated the elements dynamically...

Thanks,

mahesh.gattu

Former Member
0 Kudos

Hi Mahesh,

it is not possible using set_attribute method, because it is a select-options component and the selection screen fileds are added by ADD_SELECTION_SCREEN_FIELD and ADD_PARAMETER_FIELD methods of IF_WD_SELECT_OPTIONS.

I have done by accessing the range table of the selection fileds.

cheeeers.

Regards,

xavier.p

former_member188831
Contributor
0 Kudos

okay good congrats xavier,

better udpated your thread as answered

Regards,

mahesh

thomas_jung
Developer Advocate
Developer Advocate

Xavier Reddy Penta sent me this question via email and I answered it directly yesterday. Here is the solution that I provided to him, so that it is stored with the original question:

I believe your problem is that you are not setting the value into the range correctly. You are setting it directly into the field symbol of the range like such:

<FS> = L_STRING2.

But ranges are deep objects. They have four fields: Sign, Option, High, and Low. This is from the online help:

1. sign of type c and length 1. The content of sign determines for every row whether the result of the condition formulated in the column is included or excluded in the entire resulting set for all rows. Evaluable values are "I" for include and "E" for exclude.

2. option of type c and length 2. option contains the selection option for the condition of the row in form of logical operators. Analyzable operators are "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP" if column high is initial, and "BT", "NB" if column high is not initial. With the options "CP" and "NP", the data type of the columns low and high must be of the data type c, and special rules apply for entries on the selection screen.

3. low of the data type defined after FOR. This column is designated for the comparison value or the lower interval limitation.

4. high of the data type defined after FOR. This column is designated for the upper interval limitation.

So when you are moving the value into the field symbol you are setting it into the sign column.

Here is an example of how you can access the components of the range:

* create a range table that consists of this new data element
    lt_range_table =
      wd_this->lv_sel_handler->create_range_table(
           i_typename = l_typename ).

    IF l_fieldname = 'CARRID'.
      FIELD-SYMBOLS: <tab>         TYPE INDEX TABLE,
                         <struct>      TYPE ANY,
                         <wa>          TYPE ANY,
                         <option>      TYPE char2,
                         <sign>        TYPE char1,
                         <high>        TYPE ANY,
                         <low>         TYPE ANY,
                         <wa_values>   TYPE ANY.
      ASSIGN lt_range_table->* TO <tab>.
      APPEND INITIAL LINE TO <tab> ASSIGNING <wa>.
      ASSIGN COMPONENT 'OPTION' OF STRUCTURE <wa> TO <option>.
      ASSIGN COMPONENT 'HIGH' OF STRUCTURE <wa> TO <high>.
      ASSIGN COMPONENT 'LOW' OF STRUCTURE <wa> TO <low>.
      ASSIGN COMPONENT 'SIGN' OF STRUCTURE <wa> TO <sign>.

      <sign> = 'I'.
      <option> =  'EQ'.
      <low> = 'AA'.
    ENDIF.

Answers (2)

Answers (2)

former_member226203
Active Contributor
0 Kudos

If you have a node and an attribute, then you can use the

set_Attribute(

exporting

Name = ' '

Value = ' ').

or Jus use the code wizard to get the code.

Hope this is hepful.

Regards,

Kalyan.

Former Member
0 Kudos

Hi Reddy,

Di you try to use set attribute functionality after creating the node and attribute dynamically.

I think after creating the node and attribute (be it static or dynamic) , you can use set attribute functionality to have default or initial values into that.

Please try it and let me know, whether that worked or not.

regards

PG