Saturday, February 18, 2012
If domain is defined with Value Table, drop down list does not get populated with values automatically.
Steps to get the values in drop down list (DropDownByKey).
Steps to get the values in drop down list (DropDownByKey).
- Create Web Dynpro component and save as local object.
- Go to Context tab -> Create node and attribute inside the node.
- Go to Layout tab -> Place UI element DropDownByKey by using Create container form so that UI element is automatically bound to Context attribute.
- Go to method tab -> Write the below code in WDDOINIT method. Here we have to call SET_ATTRIBUTE_VALUE_SET of interface IF_WD_CONTEXT_NODE_INFO to set the fixed values for an attribute which is bound to DropDownByKey UI element.
method wddoinit . "Reference variables data: lo_nd_emp_det type ref to if_wd_context_node, lo_nd_emp_det_info type ref to if_wd_context_node_info, lo_el_emp_det type ref to if_wd_context_element. types: begin of ty_p0002, pernr type pa0002-pernr, nachn type pa0002-nachn, vorna type pa0002-vorna, end of ty_p0002, ty_value_set type wdr_context_attr_value. data: ls_p0002 type ty_p0002, ls_value_set type ty_value_set. data: lt_p0002 type standard table of ty_p0002, lt_value_set type standard table of ty_value_set. "Navigate from to via lead selection lo_nd_emp_det = wd_context->get_child_node( name = wd_this->wdctx_emp_det ). "Get node info lo_nd_emp_det_info = lo_nd_emp_det->get_node_info( ). "Select the all employee details select pernr nachn vorna from pa0002 into table lt_p0002 up to 100 rows. "Put Employee lines into value set loop at lt_p0002 into ls_p0002. ls_value_set-value = ls_p0002-pernr. concatenate ls_p0002-vorna ls_p0002-nachn into ls_value_set-text separated by space. append ls_value_set to lt_value_set. clear ls_value_set. endloop. " Assign value set call method lo_nd_emp_det_info->set_attribute_value_set exporting name = 'PERNR' value_set = lt_value_set. endmethod.
- Save and Activate Web Dynpro component.
- Create Web Dynpro Application ->Execute.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
Thanks for sharing this informative blog...
ReplyDeleteSAP Course in Chennai