cancel
Showing results for 
Search instead for 
Did you mean: 

switch between bind_value

Former Member
0 Kudos

Hello Experts,

this dynamic created input field has a as binding value

l_binding_string per default. Sometimes in order to show

other values in special cases depending which button

any user klicks I need another binding value. How can I switch

between them in this case.

For your help thx in advance

method WDDOMODIFYVIEW .

  data lo_tc type ref to cl_wd_transparent_container.
  data lo_inputfield type ref to cl_wd_input_field.
  data lo_nd_info type ref to if_wd_context_node_info.
  DATA lo_nd TYPE REF TO if_wd_context_node.
  lo_nd = wd_context->get_child_node( name = wd_this->wdctx_calculator ).
  lo_nd_info = lo_nd->get_node_info( ).

  if first_time = abap_true.
*Transparent Container  
    lo_tc ?= view->get_element( 'TC_INPUTFIELD' ). 

    data l_binding_string type string.

    CONCATENATE `CALCULATOR.` WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name
      into l_binding_string.

    lo_inputfield = cl_wd_input_field=>new_input_field(
         bind_value             = l_binding_string
         enabled                = abap_true
         id                     = 'VH_INPUT'
         length                 = '40'
         read_only              = abap_true
         view                   = view
*        visible                = E_VISIBLE-VISIBLE
*        width                  = width
    ).
endmethod

Accepted Solutions (1)

Accepted Solutions (1)

former_member230839
Participant
0 Kudos

Hi Ertas,

You can access the input field from any of the methods in the view by simply creating a view level attribute INP_FLD of type ref to CL_WD_INPUT_FIELD and assign this input field reference directly when you are creating in WDDODMOFIDYVIEW and after that you can access that variable INP_FLD directly from any of the methods in the view by like the following

WD_THIS->INP_FLD

and you can call the method BIND_VALUE like this

WD_THIS->INP_FLD->BIND_VALUE( ).....

Regards,

Anil kumar G

Answers (2)

Answers (2)

Former Member
0 Kudos

lo_input_field

is defined in wdDomodify. How can I access to this variable

from another method e.g. onactionpressbutton

Regards

ertas

former_member40425
Contributor
0 Kudos

Hi,

You want to change the value on some condition then you can change that value before binding only.

suppose at run time you want to bind_value = 'Rohit' then set your l_binding_string as

l_binding_string = 'Rohit'

If you want it bind_value = 'Irhan' then set l_binding_string as

l_binding_string = 'Irhan'.

to Achieve this You can use if..else or case statements.

Ex:

if condition 1.
l_binding_string = 'Rohit'
else
l_binding_string = 'Irhan'.

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

hi Rohit

is this l_binding_string an element of a node ? What is ment there the name of the attribute

or what else ?

If so, is it mandotary relate one of those attributes in order to set a value.

Beacause I am trying to display a special value in this dynamic created input field.

Or do you know another way how can I display character '+' in this text input field.

Please note later I must set the bind value to l_binding_string again.

lo_inputfield = cl_wd_input_field=>new_input_field(
         bind_value             = l_binding_string
         enabled                = abap_true
         id                     = 'VH_INPUT'
         length                 = '40'
         read_only              = abap_true
         view                   = view
    ).

Former Member
0 Kudos

You can use the method BIND_VALUE from class CL_WD_INPUT_FIELD to change the bind value whenever required.

Former Member
0 Kudos

how can I relate to the above input field with this method.

This method has a paramter named path ? What has been ment with path ?

Former Member
0 Kudos

You have created the input field using the code below.

lo_inputfield = cl_wd_input_field=>new_input_field(

bind_value = l_binding_string

enabled = abap_true

id = 'VH_INPUT'

length = '40'

read_only = abap_true

view = view

  • visible = E_VISIBLE-VISIBLE

  • width = width

).

Since BIND_VALUE is an instance method u have to use instance lo_inputfield for calling it.

CALL METHOD lo_input_field->bind_value

EXPORTING

path = '<specify path here>'

path variable should contain the path to the context attribute you want to bind your input field to. For ex: in view 'MAIN' if your context attribute 'ATTR' is under node 'NODE1' the path would look like 'MAIN.NODE1.ATTR'

Basically path contains the string which appears in the text field when you manually bind it to context attribute.

.