cancel
Showing results for 
Search instead for 
Did you mean: 

How to empty displayed table content in WebDynpro correctly

Former Member
0 Kudos

Hello Web Dynpro experts,

Could you kindly help me to show a table with empty content.

I am showing content of an internal table in WebDynpro and in case this internal table is initial I am getting an exception.

What is the correct way to handle such situation. In other words in case the internal table to be shown is empty-> what is the correct way to show empty table and avoid exception?

Thank you in advance and best regards

Andrey

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

If internal table has no data empty tablw will display.I think you are not binding the internal table properly.

check this code.

DATA:
    node_flights TYPE REF TO if_wd_context_node,
    it_flights type table of sflight.

* navigate from <CONTEXT> to <FLIGHTS> via lead selection
  node_flights = wd_context->get_child_node( name = 'FLIGHTS' ).


* Get Flights data
  select * from sflight into table it_flights up to 20 rows.

* Now Bind Internal table to Context.
  node_flights->bind_table(
      new_items            = it_flights
      SET_INITIAL_ELEMENTS = ABAP_TRUE
         ).

Thanks

Suman

Former Member
0 Kudos

It seems the cardinality of node with which you are binding is 1..N. Make it 0..N and then Check

baskaran00
Active Participant
0 Kudos

Hi Andrey,

In most case, when you try to set lead selection when there is no record - exception will raise.

One way to avoid is always check for

if not <element> is initial.

<ur code>

endif.

I hope u r getting null object reference exception.

If so above soultion will resolve ur problem.

If not send the error details.

Thanks...