Friday, November 23, 2012

Drop down in Table Web Dynpro




method wddoinit .

  data lo_nd_status_drop type ref to if_wd_context_node.
 data lt_status_drop type wd_this->elements_status_drop.
 data ls_status_drop type wd_this->element_status_drop.

 ls_status_drop-status_value = 'Resubmit All'.
 append ls_status_drop to lt_status_drop.

 ls_status_drop-status_value = 'Reject All'.
 append ls_status_drop to lt_status_drop.

 ls_status_drop-status_value = 'Approve All'.
 append ls_status_drop to lt_status_drop.

 data lo_nd_approval_mng type ref to if_wd_context_node.
 data lo_element type ref to if_wd_context_element.
 data lt_approval_mng type wd_this->elements_approval_mng.
 data ls_approval_mng type wd_this->element_approval_mng.
 data lv_status_value type wd_this->element_status_drop-status_value.
 data lo_el_status_drop type ref to if_wd_context_element.
* navigate from <CONTEXT> to <APPROVAL_MNG> via lead selection
 lo_nd_approval_mng = wd_context->get_child_node( name = wd_this->wdctx_approval_mng ).
* import the details of the table
 lo_nd_approval_mng->get_static_attributes_table( importing table = lt_approval_mng ).
 loop at lt_approval_mng into ls_approval_mng. " binding the drop down
   lo_element = lo_nd_approval_mng->get_element( sy-tabix ).
   lo_nd_status_drop = lo_element->get_child_node( 'STATUS_DROP' ).
   lo_nd_status_drop->bind_table( new_items = lt_status_drop set_initial_elements = abap_true ).
 endloop.

** set your values to the drop down

 data lv_index type sytabix.
 loop at lt_approval_mng into ls_approval_mng where status is not initial.
   lv_index = sy-tabix.
   lo_element = lo_nd_approval_mng->get_element( sy-tabix ).
   lo_nd_status_drop = lo_element->get_child_node( 'STATUS_DROP' ).
   lo_el_status_drop = lo_nd_status_drop->get_element( ).
     case ls_approval_mng-status.
       when 'KEEP'.
         lv_status_value = 'Resubmit All'.
       when 'REJ'.
         lv_status_value = 'Reject All'.
       when 'APPR'.
         lv_status_value = 'Approve All'.
     endcase.
*     * set single attribute
     lo_el_status_drop->set_attribute(
       name =  `STATUS_VALUE`
       value = lv_status_value ).
     modify lt_approval_mng from ls_approval_mng index lv_index
     transporting status.
 endloop.

endmethod.


Monday, November 19, 2012

Hide the Fields in the Adobe form

Source filed, based on this we need to hide or display fields
















//Select value from list
var raw = data.resolveNode("data.#subform[0].ISR_DDL_NoSelected").rawValue;
if(raw == 11)
{
data.resolveNode("data.#subform[0].#subform[3].#field[16]").presence = "visible";
data.resolveNode("data.#subform[0].#subform[3].#field[17]").presence = "visible";
}
else
{
data.resolveNode("data.#subform[0].#subform[3].#field[16]").presence = "hidden";
data.resolveNode("data.#subform[0].#subform[3].#field[17]").presence = "hidden";
}

add code there.(in events with scripts)


Target fields


Add also add the same code in FORMREADY of source field



Useful code in Adobe forms:
read values

var value = data.resolveNode("data.#subform[0].I0962_RSREA").rawValue;
check with message box.. for the values exists or not
xfa.host.messageBox(value);