cancel
Showing results for 
Search instead for 
Did you mean: 

Domain fixed value need to set as default in UI

former_member314998
Participant
0 Kudos
1,633

Hi Experts ,

   I am facing an issue where  domain having two fixed values ...

      INITIAL   VALUE    TEXT

                         X           Yes

         =             ' '             No

In webdynpro when I bind the data element of this domain three dropdown text  is coming ...

1 .  Space

2 . Yes

3.  No

I am trying to set this field in ui with default value = NO.

In the coding part when I set the field value = abap_true then  Yes   is set in UI as default but when value = abap_false it's picking only initial value means Space  is set as default ..

I need to set it as NO.

Please help me to solve out this issue.

Thanks in advance.

Samrat

Accepted Solutions (0)

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Samrat,

It seems that you have 3 rows set in VALUE range of domain.  Please remove the blank line from domain. Also make sure that nothing is set for 'No' i.e. it should be having space value.

If the issue still persists, please share the snap shot of your domain values.

Regards,

Rama

former_member314998
Participant
0 Kudos

Hi Rama,

  I only have two rows in domain fixed value but I am getting dropdown for three.

   INITIAL   VALUE    TEXT

                         X           Yes

       =                ' '            No

Thanks ,

Samrat

ramakrishnappa
Active Contributor
0 Kudos

Please share the snap shot your domain.

Try to delete all the values of domain and now, again create only 2 records ( YES, NO ) and check again.

Try to use the data element : BKK_YESNO and check if the issue persists

Regards,

Rama

former_member314998
Participant
0 Kudos

Hi Rama ,

  I have checked with function module DD_DOMA_GET , but it returns only two values which I have already mentioned. I do not have option to change the domain fixed value .

My question is asrise that why in the dropdown three values is coming ?

Please share suitable way to solve the issue .

Thanks ,

SAMRAT

ramakrishnappa
Active Contributor
0 Kudos

Hi Samrat,

Please check out the below SAP note related to your issue.

The below note is valid to NW 701 - 711.

1402444 - WD ABAP: Superfluous blank entry in DropDowns


Apply the above note if its valid to your system release.


Hope this resolves your issue.


Regards,

Rama

former_member314998
Participant
0 Kudos

Hi Rama ,

    My requirement is to set the default value as 'NO', I  have already checked that if I make that  element as mandatory then no space will come as dropdown

Thanks,

SAMRAT

former_member193460
Contributor
0 Kudos

Hi Samrat,

     The blank value in the dropdown indicates " No Selection".

i tried your example(system 7.3), it worked fine and "No" was selected by default.

It will be best if you can paste the screen shot of domain fixed values.

Regards,

Tashi

ramakrishnappa
Active Contributor
0 Kudos

Hi Samrat,

Is blank line is not appearing when you make the field as mandatory ? if so, have you tried setting "space" to dropdown value?

Please share your data element and its values ( screen shot ).

Regards,

Rama

former_member314998
Participant
0 Kudos

Hi Tashi,

     The field which I am using having following domain value -

INITIAL   VALUE    TEXT

                    X           Yes

  =                ' '            No

when I am trying to set default value 'YES' in the UI by field = abap_true it's working fine but when field = abap_false  for 'NO' then it's not working and set sapce in the UI.

Thanks,

SAMRAT

former_member193460
Contributor
0 Kudos

Hi Samrat,

    

     Is your domain fixed values set up as below.

Atrribute property:

former_member314998
Participant
0 Kudos

yes

ramakrishnappa
Active Contributor
0 Kudos

Hi Samrat,

Please try to implement the note as suggested and check.


1402444 - WD ABAP: Superfluous blank entry in DropDowns


Regards,

Rama

Former Member
0 Kudos

Hi Samrat,

The other workaround would be like this as you dont want to create new data element.

1)As soon as you launch the screen, you set the dropdown value as ' ' (which is No as per your requirement).

2)Build the attribute's set and bind it to your drop down as shown below.

In WDDOINIT( ) of your controller , write the below code

METHOD wddoinit .

*==========================================================================*

*Set the value to No

*==========================================================================*

  DATA lo_nd_ddbk TYPE REF TO if_wd_context_node.

  DATA lo_el_ddbk TYPE REF TO if_wd_context_element.

  DATA ls_ddbk TYPE wd_this->element_ddbk.

  DATA lv_ddbk_test TYPE wd_this->element_ddbk-ddbk_test.



  lo_nd_ddbk = wd_context->get_child_node( name = wd_this->wdctx_ddbk ).

  lo_el_ddbk = lo_nd_ddbk->get_element( ).



  lv_ddbk_test = 'No'.



*   set single attribute

  lo_el_ddbk->set_attributename `DDBK_TEST`  value = lv_ddbk_test ).

*==========================================================================*

*Populating dropdown values

*==========================================================================*

  DATA value_set                     TYPE wdr_context_attr_value_list.

  DATA entry                         TYPE wdr_context_attr_value.

  DATA symbol                        TYPE string.

  DATA wd_node_info                  TYPE REF TO if_wd_context_node_info.



  CONCATENATE 'No' space INTO symbol.                       "#EC NOTEXT

  entry-value = ''.

  entry-text  = symbol.

  INSERT entry INTO TABLE value_set.

  wd_node_info lo_nd_ddbk->get_node_info( ).

  wd_node_info->set_attribute_value_set( name = 'DDBK_TEST' value_set = value_set ).



   CONCATENATE 'Yes' space INTO symbol.                       "#EC NOTEXT

  entry-value = 'X'.

  entry-text  = symbol.

  INSERT entry INTO TABLE value_set.

  wd_node_info lo_nd_ddbk->get_node_info( ).

  wd_node_info->set_attribute_value_set( name = 'DDBK_TEST' value_set = value_set ).


ENDMETHOD.

The output is as follows :

Hope this workaround would help you.

Thanks

KH

Former Member
0 Kudos

Hi Samrat,

Try to change the domain fixed values as shown below and hope you're using dropdown by key(DDBK)

Now, i've created DDBK in my test WDP component as shown below

1) Created attribute with default value

2) Created DDBK as shown below

3)When i run the appl'n , following is the output

Hope this helps you.

Thanks

KH

former_member314998
Participant
0 Kudos

Hi Katrice,

Thanks for your reply .

I can not change the domain value because it will impact other process. Without changing this I need to set it as NO as default value in UI.

Thanks ,

Samrat

Former Member
0 Kudos

Then as replied my rama, there might be 3 rows set in your domain.

I've created a domain as shown below having only two values X=Yes and ' ' = No.

and my default value in DDBK is ' ' i.e No

And when i run the appl'n, DDBK is set to NO as shown below

and it shows only 2 values in my DDBK .

And when i read my domain values with FM : DD_DOMA_GET, it results into only 2 values as shown below

PS : Use FM : DD_DOMA_GET and pass you domain value and see the result once.

Hope this helps you.

Thanks

KH