Tuesday, 23 April 2013

WD4A - No direct access to context from Assistance Class!?

So in trying to tidy up my code, by segregating out the stuff in the Views Methods and putting it into the assistance class methods, I think to myself, "this is gonna be great! all that code that the wizard produces when accessing the context node, I can just hive that off into it's own method, my code will look loads neater!". 

I mean, for goodness sake, that wizard produces like 8 lines of code, just to read 1 variable. Seems a bit heavy handed. If only I could hide it.

So I tried something like this in my Assistance Class, expecting it to be able to see the Application's component controller:

data: lo_nd_qmel type ref to if_wd_context_node.

lo_nd_qmel = wd_context->get_child_node( name = wd_this->wdctx_qmel )

but it gives me an error saying that it didn't know what wd_context was.
So you've got to drag stuff out of the context, and put it into the Assistance Class variables.

Which may well end up with the comedy situation of having 8 lines to extract and set the data, then calling the assistance class (say... 4 lines to call it, and it contains 10 lines) . 

And then maybe another few for updating the variables back into the screen!

No comments:

Post a Comment