Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

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

Former Member
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question