Web Dynpro – Testing a Dynamic Table

Home / SAP / ABAP Coding / Web Dynpro – Testing a Dynamic Table

Now, since I always learn things the hard way, and if you’ve been reading my posts for any length of time, you’ll know that I can be a bonehead when it comes to things…  but I’m too stubborn to give up (hence why I’m writing this post.  ha ha ha).  Anyway, my latest discovery was in the testing of my new dynamic table.  I really needed a table with some editable fields, but in the creation of my table, the context node was empty.  So the table was being created, but there were no lines in the table.  Well, maybe it was the lack of sleep, but my brain was moving a little slow, so I didn’t grasp that the dynamic table was empty…  thus, impossible to see if there were any fields editable.

So, short story, you need to populate at least one row in the table, even if it’s empty.  Here’s an example:

* navigate from <CONTEXT> to <NOT_ITEM> via lead selection
lo_nd = wd_context->get_child_node( name = wd_this->wdctx_item ).
lo_nd->get_static_attributes_table( importing table = lt ).
IF lt IS INITIAL.
APPEND wa to lt.
lo_nd->bind_table( new_items = lt set_initial_elements = abap_true ).
ENDIF.

this simple addition, and suddenly I could see my editable fields in my dynamic table.  Probably obvious to a lot of folks, but yet another lesson learned in my never ending journey.

Thanks for reading.

 

As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,
Mike

Leave a Reply

Your email address will not be published. Required fields are marked *