cancel
Showing results for 
Search instead for 
Did you mean: 

WD4A: Drop Down By Key : How to Handle Runtime Exception.

Former Member
0 Kudos

WebDynpro ABAP Application

I have a DDK in WebDynpro ABAP that is dynamically set the Value Set , during the components initialization. It so happens that during reuse & because of Old Data , at time i am trying to assign VALUE that is NOT in the Value Set , resulting in a DUMP.

Whats the WAY to avoid or prevent DUMP. Any good pointer would attract point.

Regards

Prashant

Accepted Solutions (1)

Accepted Solutions (1)

alejandro_bindi
Active Contributor
0 Kudos

I thought you would be able to catch cx_wdr_adapter_exception around the node->set_attribute call but you can't, even catching cx_root has no effect.

So my advice would be to keep the latest table you're using to populate the DDK dynamically somewhere (e.g. as a controller or assistance object attribute) and when the time comes to set the attribute value, first check that a READ TABLE...TRANSPORTING NO FIELDS with that key over the backed up table returns SY-SUBRC = 0.

Something like this:


      READ TABLE wd_this->latest_tab WITH KEY ddk = new_value
                     TRANSPORTING NO FIELDS.
      IF sy-subrc = 0.
        wd_context->set_attribute(
            value  = new_value
            name   = 'DDK'
        ).
      ELSE.
        " Invalid key, would lead to dump
      ENDIF.

Hope this helps.

Regards

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks. Well here is the solution. Before we bind the table with ValueSet we need to check if the new incomming entry

is part of this ValueSet . If not Append the new value to this table of ValueSet. Then bind this value set to the DDK attribute.

data:
   lt_valueset type table of wdr_context_attr_value,
   ls_valueset type wdr_context_attr_value,
   lr_node type ref to if_wd_context_node,
   lr_nodeinfo type ref to if_wd_context_node_info.


"check if incomming value not in the Value set table in my case  lt_main_approver 
 read table lt_main_approver assigning <wa_iv> with key ivno = lv_existing_approver.
  if sy-subrc ne 0.
    la_value-key    = lv_existing_approver.
    la_value-value  = lv_existing_approver.
    append la_value to lt_value_set.
  endif.


"bind this table
lr_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_main_approver  ).
lr_nodeinfo = lr_node->get_node_info( ).
lr_nodeinfo->set_attribute_value_set( name = 'Main_Approver'   value_set = lt_value_set ).

Former Member
0 Kudos

Hi,

wd_context->set_attribute(

EXPORTING

name = 'REPORT'

).

use similar code, dont pass anything to the value parameter.

and also clear the table before this from where you are getting the dropdown list.

Thanks,

Sree.