cancel
Showing results for 
Search instead for 
Did you mean: 

Setting context value problem

Former Member
0 Kudos

I am new to WDA and trying to create an application that launches from UWL when user clicks on the task. I am importing the workflowID as WI_ID. Whenever the application lauches I am trying to set the context attribute 'WI_ID' to the value of my import parameter. I have the code in the 'HANDLEDEFAULT' method of the window.


  CALL METHOD wd_context->get_child_node
    EXPORTING
      NAME     = 'WORKFLOWRAWDATA'
    RECEIVING
      CHILD_NODE  = l_node.

  l_node->set_attribute( value = wi_id name = 'WI_ID' ).
  l_wi_id = wi_id.

Context setup is:

CONTEXT

--WORKFLOWRAWDATA (NODE, Cardinality-0..n )

---WI_ID (ATTRIBUTE)

I have tried different cardinality settings as mentioned in some other posts but I still can't get this to work.

The application dumps at l_node->set-attribute... with the following:

Node COMPONENTCONTROLLER.1.WORKFLOWRAWDATA does not contain any elements

The ABAP call hierarchy was:

Method: RAISEELEMENT_NOT_FOUND of program CL_WDR_CONTEXT_NODE===========CP

Method: IF_WD_CONTEXT_NODE~SET_ATTRIBUTE of program CL_WDR_CONTEXT_NODE_VAL=======CP

Method: IF_WD_CONTEXT_NODE~SET_ATTRIBUTE of program CL_WDR_CONTEXT_NODE_MAP=======CP

Method: HANDLEDEFAULT of program /1BCWDY/A68C49BUPRHX3IHWDY9U==CP

Method: HANDLEDEFAULT of program /1BCWDY/A68C49BUPRHX3IHWDY9U==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/A68C49BUPRHX3IHWDY9U==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_IF_VIEW=====CP

Method: DISPLAY_TOPLEVEL_COMPONENT of program CL_WDR_CLIENT_COMPONENT=======CP

Method: INIT of program CL_WDR_CLIENT_APPLICATION=====CP

Method: IF_WDR_RUNTIME~CREATE of program CL_WDR_MAIN_TASK==============CP

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Justin,

There are 2 problems here.

1. You get the node and try to set the attribute with out getting the current node element.

2. Since you have 0..n node it is possible that when you come first time there are no elements available.

I would do something like this as you do not need 0..n cardinality , i change to 1..1

and the code like this

DATA:
      lo_nd_workflowrawdata            TYPE REF TO if_wd_context_node,
      lo_el_workflowrawdata            TYPE REF TO if_wd_context_element,
      ls_workflowrawdata               TYPE wd_this->element_workflowrawdata,
      lv_wi_id                         TYPE wd_this->element_workflowrawdata-wi_id.

    lo_nd_workflowrawdata = wd_context->get_child_node( name = wd_this->wdctx_workflowrawdata ).
    lo_el_workflowrawdata = lo_nd_workflowrawdata->get_element( ).

    lo_el_workflowrawdata->set_attribute(
      name =  `WI_ID`
      value = lv_wi_id ).

Answers (1)

Answers (1)

Former Member
0 Kudos

Thank you very much. I have been trying to figure this out for several hours now. I also needed to make sure the 'Initialization Lead Selection' was checked for the node.