Skip to Content
0
Former Member
Mar 03, 2009 at 09:19 PM

Dynamic input fields in WDA

661 Views

Hi Folks,

Need to create dynamic input fields based on the [Add] Button click.

The attributes are getting created when I click [Add] button, but i don't see the field on the view screen.

Please let me know what needs to be done for this and what am I missing.

Below is the code that executes on the event of button clicked.

Do I need to write this code in WDDOMODIFYVIEW? if yes then how this will execute with click on the [Add] Button. Thanks.

DATA: lv_count(2) TYPE c.
  DATA: lr_asn_node         TYPE REF TO if_wd_context_node.
  DATA: lr_root_info TYPE REF TO if_wd_context_node_info,
             lr_child_info TYPE REF TO if_wd_context_node_info,
             attr_info TYPE wdr_context_attribute_info,
             le_ip TYPE REF TO cl_wd_input_field.
  DATA: lv_bind_value TYPE string.

  lr_asn_node   = wd_context->get_child_node( name = 'ASN_HDR' ).

  lr_asn_node->get_attribute( EXPORTING name  = 'ADD_COUNT'
                              IMPORTING value = lv_count ).

  lv_count = lv_count + 1.
  lr_asn_node->set_attribute( name  = 'ADD_COUNT'
                              value = lv_count ).

  CONDENSE lv_count.
*** Create Node attribute for PO number

  lr_root_info = wd_context->get_node_info( ).

  CALL METHOD lr_root_info->get_child_node
    EXPORTING
      name            = 'ASN_HDR'
    RECEIVING
      child_node = lr_child_info.

  CONCATENATE 'EBELN' lv_count INTO attr_info-name.
  attr_info-type_name = 'EBELN'.

*** Creates an attribute for the node 'ASN_HDR' of name EBELN concatenated with counter.
  CALL METHOD lr_child_info->add_attribute
    EXPORTING
      attribute_info = attr_info.


  CONCATENATE 'ASN_VIEW.ASN_HDR.' attr_info-name INTO lv_bind_value.

*** Create input field on view ASN_VIEW.  
  CALL METHOD cl_wd_input_field=>new_input_field
    EXPORTING
      bind_value = lv_bind_value
      id         = 'IP'
    RECEIVING
      control    = le_ip.