cancel
Showing results for 
Search instead for 
Did you mean: 

set initialization for inputfild.

Former Member
0 Kudos

Hi ,every one,

I am a new to web dynpro for abap.

and I have one question need your help.

I have one inputfield , and I bind it to a Dictionary value ,such as "showView.InfoFrom.Get",This bind is important to me.

but I want to set initialization value of this inputfield.

such as : "please select value"

where Can I do this , can you tell me the code or the step?

thanks very much.

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Elisa,

You can do it as follows if your input field accepts character/string input.

1) Go to the context node definition of your component. Then go to the attribute which you are using for binding to your input field. You can there maintain the "default value" property with the text you want to be displayed like, "please select value".

2) Or else you can go to the WDDOINIT method of your view and within this method use the SET_ATTRIBUTE method of IF_WD_CONTEXT_NODE to maintain the default text that you want to be displayed in the input field. Get the reference of your context node and then set the desired value for the attribute.

Regards,

Uday

Former Member
0 Kudos

hi Uday,

I am very happy to see your reply.

but There is not a "default value" in inputfield.

and can you give me the code in wddoinit.because I dont know how to write.

I learn web dynpro abap only one week.

my InputField's ID is CITY.

Thanks so much.

Former Member
0 Kudos

Hi you can generate this code for your variable.

DATA lo_nd_flighttab TYPE REF TO if_wd_context_node.

DATA lo_el_flighttab TYPE REF TO if_wd_context_element.

DATA ls_flighttab TYPE wd_this->Element_flighttab.

DATA lv_seatsmax TYPE wd_this->Element_flighttab-seatsmax.

  • navigate from <CONTEXT> to <FLIGHTTAB> via lead selection

lo_nd_flighttab = wd_context->get_child_node( name = wd_this->wdctx_flighttab ).

  • @TODO handle non existant child

  • IF lo_nd_flighttab IS INITIAL.

  • ENDIF.

  • get element via lead selection

lo_el_flighttab = lo_nd_flighttab->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_flighttab IS INITIAL.

ENDIF.

  • @TODO fill attribute

  • lv_seatsmax = 1.

  • set single attribute

lo_el_flighttab->set_attribute(

name = `SEATSMAX`

value = lv_seatsmax ).

in the value give the default value which ever you want.

Best regards,

Rohit

Former Member
0 Kudos

hi Rohit,

your answer is right ,

I need these code to dynamic set value of inputfield when I first enter this View.

and do you have some tutorials for beginner to write code in WD4A.

thanks so much.

Answers (2)

Answers (2)

uday_gubbala2
Active Contributor
0 Kudos

Hi Elisa,

Welcome to WDA! You said that your input field has the binding as:

showView.InfoFrom.Get

This means that you have a view by name SHOWVIEW & within this view you have a context node by name INFOFROM & under this node you have an attribute GET.

The value of the input field depends on this attribute GET. Go to the CONTEXT tab of your component and navigate to the node INFOFROM. Expand the node & double click on the attribute GET.

Now here you can see the corresponding properties of this particular attribute. You would have 1 property "Default Value" where you can specify the default value for this attribute (input field). Hope this helps.

Regards,

Uday

former_member226203
Active Contributor
0 Kudos

hi,

u hve binded the inputbox to one of the attributes..right..if u go to the context tab and click on the node and then click on the attribute(the attribute that u hve binded the input box and this is the one for which u need to set the message).. u will see the properties of the attributes. under these properties u will have an option of DEFAULT VALUE.

u need to enter ur text here.