cancel
Showing results for 
Search instead for 
Did you mean: 

Node does not contain any elements

former_member199125
Active Contributor
0 Kudos

Hi guys,

i have some basic doubt.

In my screen, i have several input fields, it will contain employee personal information like PAN number, address..

Once employee access the application, he will get his information in display mode, there he can edit the value by clicking on edit button and can update it.

If employee dont have prior information, application throwing dump like

"Adapter error in &VIEW_ELEMENT_TYPE& "TC1_A_PANNO" of view "ZCOMP_EPI.VMAIN": Context binding of property VALUE cannot be resolved: Node VMAIN.1.N_PER5 does not contain any elements "

So how can we avoid dump, if employee dont have prior information?

FYI: i am displaying information in input fields in display mode ( readonly ), once he click on edit button, it will enable.

Regards

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

shahid
Product and Topic Expert
Product and Topic Expert
0 Kudos

IF LO_EL_N_PER5 IS not INITIAL.

LO_EL_N_PER5->SET_ATTRIBUTE(

EXPORTING

NAME = `PANNUM`

VALUE =lv_value ).

ENDIF

if element is intial and if you are trying to bind it, it will go for a dump.

if it is initial, you can create element and then bind with 'no value found'.

try this

former_member199125
Active Contributor
0 Kudos

Hi SSM,

Thank you very much for reminding me about create_element. My prblm solved now.

Regards

Srinivas

Answers (3)

Answers (3)

saravanan_narayanan
Active Contributor
0 Kudos

Hello Srinivas,

what I understood from the dump is that you are trying to bind the first element (VMAIN.1.N_PER5) attributes to the inputfields.

Since your node cardinality is 0..1, can you try bninding like VMAIN.N_PER5. I assume VMAIN is your parent node and not the Root Context.

BR, Saravanan

former_member199125
Active Contributor
0 Kudos

hi sarvanan,

Root node is vmain and input field is binded to attribute under N_Per5 node which is under VMAIN.

I want to display employee information.. if he dont have previous information.. that field should be blank.

any ideas?

Regards

Srinivas

Former Member
0 Kudos

Hi,

Have you used this method SET_ATTRIBUTE_NULL of if_wd_context_node..I mean if there is no value use this method to set as Null and test it. Ofcousre Input field expects some value...Still check this out..

Regards,

Lekha.

former_member199125
Active Contributor
0 Kudos

lekha,

set_attribute_null, didn't work for me. I just tried that, it is throwing dump like node does not contain any elements.

Regards

Srinivas

Former Member
0 Kudos

take a text view and siplay some message in it when the Input field value is Blank and also set the visibility for this Input field.

If you still want to show the Blank value to the Input field then need to check out....Which DE you are using...

Is it a string..

former_member199125
Active Contributor
0 Kudos

Lekha,

I replaced input field with TEXT view.

in wddoint method, I did like ...

If itab is not initial...

then i bind the itab to the node

else

manually I set the value for that attribute.

LO_EL_N_PER5->SET_ATTRIBUTE(

EXPORTING

NAME = `PANNUM`

VALUE = 'LV_PANNUM' ).

endif.

Now, it is throwing dump like "Access via 'NULL' object reference not possible. " I check in st22 , it showing error in

LO_EL_N_PER5->SET_ATTRIBU......... statement. I declared everything. i dont where it goes wrong.

Regards

Srinivas

Former Member
0 Kudos

You didnt check whether the element reference is initital or not...TEXT VIEW should be bound to some string attribute..

pass the value as 'NO VALUE FOUND' or any meesage..bind this attribute to TEXT_VIEW and set teh visibility as TRUE and for input field SET the VISIBILITy as false...and donot show.

former_member199125
Active Contributor
0 Kudos

Lekha,

IF LO_EL_N_PER5 IS INITIAL.

LO_EL_N_PER5->SET_ATTRIBUTE(

EXPORTING

NAME = `PANNUM`

VALUE = 'NO VALUE FOUND' ).

ENDIF.

Still showing the error in above set_attribute statement. Null object reference.

Former Member
0 Kudos
IF LO_EL_N_PER5 IS NOT INITIAL.
ENDIF.

Have you used the code wizard...have you decalred the new context attribute undre any node or directly under the root node..

Check the cardinality of the Node..

Can you paste the etnire code starting from the node being read..

If you find that element object (LO_EL..) is initial then you cannnot access the method...NULL OBJECT reference is thrown..

LO_EL = LR_NODE->get_element (). "What have you specified here...

former_member199125
Active Contributor
0 Kudos

For my simplification, I remove the input field and replace with TEXT view, binded with attribute which is available under node n_per5.

under this node only attribute is there.

DATA LO_ND_N_PER5 TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_N_PER5 TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_N_PER5 TYPE WD_THIS->ELEMENT_N_PER5.

  • navigate from <CONTEXT> to <N_PER1> via lead selection

LO_ND_N_PER5 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_N_PER5 ).

IF PTAB5 IS NOT INITIAL.

  • get element via lead selection

LO_ND_N_PER5->BIND_TABLE( PTAB5 ).

else.

  • @TODO handle not set lead selection

IF LO_ND_N_PER5 IS INITIAL.

ENDIF.

  • get element via lead selection

LO_EL_N_PER5 = LO_ND_N_PER5->GET_ELEMENT( ).

  • @TODO handle not set lead selection

IF LO_EL_N_PER5 IS INITIAL.

LO_EL_N_PER5->SET_ATTRIBUTE(

EXPORTING

NAME = `PANNUM`

VALUE = 'NO VALUE FOUND' ).

ENDIF.

ENDIF.

Now throwing null object error at set_sttribute statement found using ST22.

Thanks and Regards

Sriniva

Former Member
0 Kudos

what is the cardnaltiy fo this context node..I guess it must be 0:N or 1:N...As you are using a BIND_TABLE statement..

And you are checking that internal table is initial or not and biding the table to node..

But for some TEXT VIEW you can create a context attribute and bound this...Have you created some toher node or directly created in the same Node..If you ahve created it under the same node..then...your coding is incorrect.

One thing you do..create a context attribute under the root node...abnd bind this to TEXT_VIEw..and set the value...

TEXTVIEW always hold a single value...

Former Member
0 Kudos

Hi Srinivas,

Instead of dump if you want you can report your own messages. that part only you can do.

Like if element is initial - display some mesage.

Cheers,

Kris.

former_member199125
Active Contributor
0 Kudos

Hi Kris,

In the initial screen I am displaying information like address deatils, communication details, which i fetched from several info types.

My application is Employee should be able to see what all the info available right now, if he want to update he can update there.

In screen if only some fields dont have data, we cant throw message na...

Regards

Srinivas

shahid
Product and Topic Expert
Product and Topic Expert
0 Kudos

check whether the node has 0 to 1 cardinality.

in the code, while reading the prior information check whether it has successfully returned the value

former_member199125
Active Contributor
0 Kudos

yes cardinality is 0:1 and some employee dont have prior information. So how can we avoid dumbp?

Regards

Srinivas