cancel
Showing results for 
Search instead for 
Did you mean: 

display message

Former Member
0 Kudos

Gudday,

I have table with some entries in my WDA application.

When the table is empty n when i press edit button it is throwing dump..access via 'NULL' object reference not possible .....

Instead of that i want to display message.

Can anyone help me to proceed further.....

Awaiting your reply.

Thanks,

Deepthi.

Accepted Solutions (1)

Accepted Solutions (1)

former_member515618
Active Participant
0 Kudos

Hi Deepthi,

Probably you are trying to get the reference of the table element by using get_element method and now that the table is empty it is not instantiated.

Exit the code when the node or the element is initia.

Assume that the table is bound to node table then if the context node or the element is initial throw the message accordingly and exit the application.

  • navigate from <CONTEXT> to <table> via lead selection

node_table = wd_context->get_child_node( name = if_action_list=>wdctx_<table> ).

  • handle not set lead selection

IF ( node_table IS INITIAL ).

" Message

EXIT.

ENDIF.

  • get element via lead selection

elem_action_list = node_action_list->get_element( ).

  • handle not set lead selection

IF ( elem_table IS INITIAL ).

"message

EXIT.

ENDIF.

  • get all declared attributes

elem_table->get_static_attributes(

IMPORTING

static_attributes = stru_table ).

Hope this helps,

Regards,

Sravan Varagani

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

Inside theMethod for Edit,first check whether the Table is initial.

Eg.,

DATA lo_nd_table TYPE REF TO if_wd_context_node.
  DATA lo_el_table TYPE REF TO if_wd_context_element.
  DATA lt_table TYPE wd_this->elements_table.
  DATA ls_table TYPE wd_this->element_table.

  lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).

* get all declared attributes
  lo_nd_table->get_static_attributes_table(
    IMPORTING
      table = lt_project ).

if lt_project[] is initial.

* get message manager
data lo_api_controller     type ref to if_wd_controller.
data lo_message_manager    type ref to if_wd_message_manager.

lo_api_controller ?= wd_This->Wd_Get_Api( ).

CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
  RECEIVING
    MESSAGE_MANAGER = lo_message_manager
    .

* report message
CALL METHOD lo_message_manager->REPORT_ERROR_MESSAGE
  EXPORTING
    MESSAGE_TEXT             = 'The Table has no Values' .

endif.

Regards,

Padmam.