cancel
Showing results for 
Search instead for 
Did you mean: 

Webdynpro

Former Member
0 Kudos

Hi,

In my webdynpro,i hav developed a layout in that i have some input fields and labels..i am getting the data from database table to this input fields...i have given same id for the input field.for eg input8 is the id name for first input id. but its giving dump Access via 'NULL' object reference not possible.

this is the code what i have given in my program...

lr_input ?= view1->get_element( 'INPUT8' ).

lr_input->set_visible( VALUE = 01 ).

lbl ?= view1->get_element( 'L24' ).

lbl->set_visible( VALUE = 01 ).

lr_input ?= view1->get_element( 'SCRIPTIDS' ).

lr_input->set_visible( VALUE = 02 ).

lbl ?= view1->get_element( 'LBL_SCRIPTIDS' ).

lbl->set_visible( VALUE = 02 ).

lr_input ?= view1->get_element( 'MESSAGE' ).

lr_input->set_visible( VALUE = 01 ).

plz help me to solve the problem..i wil give u the points...

thanx.

regards,

dhaya.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

hi,

U cannot use view1 like that way.view object can be used on in wddomodify method.

If u want to implement visibility of ui element then u can create an attribute in context of type wdui_visibility and bind that attribute to visibility property of UI element.

then on certain action give:

WD_CONTEXT->SET_ATTRIBUTE(

EXPORTING

NAME = 'attr1'

VALUE = '02' ).

Reward points if useful,

Regards,

Anusha.

Former Member
0 Kudos

Hi,

refer to

WDR_TEST_DYNAMIC VIEW IS V1 AND METHOD IS WDDOMODIFYVIEW()

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The solutions you have so far sound correct - that your reference to view1 is not correct. However I would like to bring up an entirely different topic:

lr_input ?= view1->get_element( 'INPUT8' ).
lr_input->set_visible( VALUE = 01 ).

Why are you setting the visibility via code directly to the UI element? This functionality is strongly suggested against doing. You only use the programtic interface to UI elements as an absolute last resort when doing very dynamic UIs.

For just setting the visibility of UI elements, you should really data bind the visible property of the fields to context node. That way you have clearer separation between the layers of your UI logic and you application is more extensible. If you have different "variants" so to speak of display options, consider even doing the setting of visible for different combinations of application customization.

[http://help.sap.com/saphelp_nw70/helpdata/EN/83/61a042f036c46ae10000000a155106/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/83/61a042f036c46ae10000000a155106/frameset.htm]

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

can i know what is view1 in the statement

lr_input ?= view1->get_element( 'INPUT8' ).

Abhi

Former Member
0 Kudos

Where do you initialize view1? In which method do you have this code?

Former Member
0 Kudos

Hi,

data : view1 type ref to if_wd_view.

here iam refering this interface if_wd_view and GET_ELEMENT is the method in the interface.....

thanx.

regards,

dhaya..

Former Member
0 Kudos

You need to use the parameter "view" in the wddomodifyview method. If you code view->get_element( ), it will work. Or else, you need to declare view1 as a view controller attribute. To initialize this, again in the modifyview method, you should code:

wd_this->view1 = view.

Then, view1 will not be null, and it can be accessed as wd_this->view1. Simply declaring it in a method will not initialize the object reference and you will get the dump.

Regards,

Nithya

Former Member
0 Kudos

Seems one of your reference nodes is not initialized....

debug and check what is the value of 'view1' in your code....probably it has a value

this error comes up when you try to access a method of an un-initialized reference variable (node).

you can know this in the source code extract of the dump as well...