cancel
Showing results for 
Search instead for 
Did you mean: 

visibility

Former Member
0 Kudos

Hi ,

I am using the following code for visibility of a container , have done with binding. Its comming up with an error saying as below :

*****************************************************

The following error text was processed in the system RDU : Access via 'NULL' object reference not possible.

The error occurred on the application server HCCR3DEV2_RDU_00 and in the work process 0 .

The termination type was: RABAX_STATE

DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->element_context.

DATA lv_visible LIKE ls_context-visibility_1.

if lv_budg_mang_check_box = ' '. "Based on some condition

lv_visible = '02'.

lo_el_context->set_attribute(

EXPORTING

name = 'VISIBILITY_1'

value = lv_visible ).

endif.

Please let me know if there are any corrections to the above code

Thanks,

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

former_member262988
Active Contributor
0 Kudos

Hi,

In your code the reference for lo_el_context is missing........

lo_el_context = wd_context->get_child_node( wd_this->element_context ).

This wil solve your problem..

Thanks,

Shailaja Ainala.

Answers (2)

Answers (2)

arjun_thakur
Active Contributor
0 Kudos

Hi Kumar,

Simply use the code wizard to set the value to an attribute. Don't remove any code (for the generated code) because it could lead to dump. Just press ctrl + F7 and select the attribute name and simply pass the value. It'll work.

Regards

Arjun

Former Member
0 Kudos

Hi ,

The code has run with out any problem, But when the condition is 'X' it should display the view which its not doing in for both conditions . Could you please let me know where i am going wrong ?

DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->element_context.

DATA lv_visibility_1 LIKE ls_context-visibility_1.

if lv_budg_mang_check_box = ' '. "Based on some condition

lv_visibility_1 = '01'.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • get single attribute

lo_el_context->get_attribute(

EXPORTING

name = `VISIBILITY_1`

IMPORTING

value = lv_visibility_1 ).

else.

lv_visibility_1 = '02'.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • get single attribute

lo_el_context->get_attribute(

EXPORTING

name = `VISIBILITY_1`

IMPORTING

value = lv_visibility_1 ).

endif.

Thanks,

Kumar.

Former Member
0 Kudos

Hi

use modify your code like this.


DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visibility_1 LIKE ls_context-visibility_1.

if lv_budg_mang_check_box = ' X'. "Based on some condition

lv_visibility_1 = '02'.

* get element via lead selection
lo_el_context = wd_context->get_element( ).

* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `VISIBILITY_1`
IMPORTING
value = lv_visibility_1 ).

else.

lv_visibility_1 = '01'.

* get element via lead selection
lo_el_context = wd_context->get_element( ).

* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `VISIBILITY_1`
IMPORTING
value = lv_visibility_1 ).


endif.

It will help You.

Regards,

Rohit

arjun_thakur
Active Contributor
0 Kudos

Hi Kumar,

The code which you have written, in that you are using get_attribute, instead you need to use set_attribute method.

The code should be like:


DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visibility_1 LIKE ls_context-visibility_1.

if lv_budg_mang_check_box = ' '. "Based on some condition

* get element via lead selection
lo_el_context = wd_context->get_element( ).

lo_el_context->set_attribute(
EXPORTING
name = `VISIBILITY_1`
value = cl_wd_uielement=>e_visible-none ).

else.

* get element via lead selection
lo_el_context = wd_context->get_element( ).

lo_el_context->set_attribute(
EXPORTING
name = `VISIBILITY_1`
value = cl_wd_uielement=>e_visible-visible). "values like 01 or 02 should not be hard coded.

endif.

I hope it helps.

Regards

Arjun

saket_abhyankar
Active Participant
0 Kudos

Hi Kumar,

Where exactly r u getting dump?

Try to create an atribute of type char1 in the context to map with property 'visible'.

then apply following logic to make it visible

if lv_budg_mang_check_box = ' '. "make it visible

lv_visible = 'X'.

else " make it invisible

lv_visible = ' '. "space

endif.

lo_el_context->set_attribute(

EXPORTING

name = 'VISIBILITY_1'

value = lv_visible ).