cancel
Showing results for 
Search instead for 
Did you mean: 

Node has empty element

Former Member
0 Kudos

Hi All,

Name Cardinality 0 .. n

-- FirstName

I have bind this FirstName to UI Element TextView .

Now if this node Name has no elements my application is giving runtime error.

My requirement is that sometimes this Name does not have any element and in that scenario

I want to show the screen with empty value for UI Element.

Please guide me for this issue.

Regards,

Ravi.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

in coding while getting the values specify

if lo_node is not initial.Then call the method

get_attribute or get_static_attributes

endif.

Former Member
0 Kudos

Hi Vishal ,

Thanks for this info but if there is no element then it will

bypass the if loop and at the runtime it will throw the error that node has no elements.

Former Member
0 Kudos

Hi

The runtime error occur when u try to execute get_attribute or get_static_attribute method on empty element reference variable

example: I have a node called workflow data which has 1 attribute binded with text view.

*Read the context node

DATA:

node_workflowdata TYPE REF TO if_wd_context_node,

elem_workflowdata TYPE REF TO if_wd_context_element,

stru_workflowdata TYPE if_main=>element_workflowdata .

*get child node

node_workflowdata = wd_context->get_child_node( name = if_main=>wdctx_workflowdata ).

*if u do not have enything to display the method below ( get_element ) will not return anything and our reference variable , elem_workflowdata will remain initial.

  • get element via lead selection

elem_workflowdata = node_workflowdata->get_element( ).

*Now before setting or getting attribute just check that this reference should not be blank. If blank then text view will not display anything otherwise will show u the value binded.

if elem_workflowdata is not initial.

  • get single attribute

elem_workflowdata->get_attribute(

EXPORTING

name = `WI_ID`

IMPORTING

value = item_wi_id ).

endif.

Former Member
0 Kudos

Hi

Get the value from the node if element is not initial.

if node name is value then:

if elem_value is not initial.

elem_value->get_static_attributes.

endif.

thanks

vishal kapoor