cancel
Showing results for 
Search instead for 
Did you mean: 

Need to add input field on click of "+" button

Former Member
0 Kudos

Dear Experts.

Can any one let me know how to add new input field on click of "+" button and remove the same on click of "-" button.

1)Initially i've created view with one input field and one button icon"+" as shown below

2)And following is the code which has been written on "+"button action

METHOD onactionadd .
  DATA lo_nd_user_name TYPE REF TO if_wd_context_node.
  DATA lo_el_user_name  TYPE REF TO if_wd_context_element.
  DATA ls_user_name       TYPE wd_this->element_user_name.

*   navigate from <CONTEXT> to <USER_NAME> via lead selection
  lo_nd_user_name = wd_context->get_child_node( name = wd_this->wdctx_user_name ).

*   get element via lead selection
  lo_el_user_name = lo_nd_user_name->create_element( ).

*  ls_user_name-is_visible = 'X'.

  lo_el_user_name->set_attribute( EXPORTING name =  `USER_ID`  value = 'test' ).
  lo_el_user_name->set_attribute( EXPORTING name =  `IS_VISIBLE` value = 'X' ).

  CALL METHOD lo_nd_user_name->create_element( RECEIVING element = lo_el_user_name ).


  lo_nd_user_name->bind_element(
    EXPORTING
      new_item             = lo_el_user_name    " List of Elements or Model Data
      set_initial_elements = abap_false
          " If TRUE, Set Initial Elements Otherwise Add
*      index                =     " Index of Context Element
*    RECEIVING
*      element              =     " Web Dynpro: Interface for Context Nodes
  ).


ENDMETHOD.

3)Following is the output.On click of "+" button it does not add new input field.

Thanks

KH

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You could use the RowRepeater UI element to achieve this.

Regards,

Kiran

Former Member
0 Kudos

Hi Kiran,

Can you pls explain in detail with any example(if you dont mind).Here i've added lable,input field,button in RowRepeater UI element and noting happens instead it gives me dump on execution.

500 SAP Internal Server Error

ERROR: Dynamic type conflict during the assignment of references. (termination: RABAX_STATE)

Thanks

KH

former_member184578
Active Contributor
0 Kudos

Hi,

Create a Row Repeater UI element, then create a Transparent Container and place the UI elements you would like to repeat, then bind those to the Row Repeater Data source Node.

Regards,

Kiran

former_member197475
Active Contributor
0 Kudos

Hi Katrice,

Please check this Wiki. It will help you.

steps to create row repeater ui element - Web Dynpro ABAP - SCN Wiki

BR,

RAM.