cancel
Showing results for 
Search instead for 
Did you mean: 

Table error - Context Path Cannot Be Resolved (Last Node Is Empty)

former_member194198
Active Participant
0 Kudos

Hi All,

I am dynamically building up a context node called PoList which is used to hold the contents of a table.

My BAPI is called and a routine transfers the contents of the BAPI context node across into the POList context node. This is rendered correctly on the screen. There is a routine which filters the results based on a vendor. The code works fine when some records are found but when no records are found, I get the error "Context Path POLIST.EBELN Cannot Be Resolved (Last Node Is Empty) ".

The cardinality of the PoList node is 0..N. This should mean that 0 records is valid.

The ABAP which fills the context is pasted below :

data:

Node_Z_Bapi_Po_Combined type ref to If_Wd_Context_Node,

Node_Changing_Po type ref to If_Wd_Context_Node,

Node_T_Header type ref to If_Wd_Context_Node,

Elem_T_Header type ref to If_Wd_Context_Element,

itab_C_T_Header type If_Componentcontroller=>Elements_Polist,

stru_C_T_Header like line of itab_C_T_Header,

Stru_T_Header type If_Componentcontroller=>Element_T_Header .

data:

Node_Polist type ref to If_Wd_Context_Node,

Elem_Polist type ref to If_Wd_Context_Element,

Stru_Polist type If_Componentcontroller=>Element_Polist.

data:

lri_Element type ref to if_Wd_Context_Element,

loa_Elements type Wdr_Context_Element_Set.

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

Node_Z_Bapi_Po_Combined = wd_Context->get_Child_Node( Name = IF_COMPONENTCONTROLLER=>wdctx_Z_Bapi_Po_Combined ).

  • navigate from <Z_BAPI_PO_COMBINED> to <CHANGING_PO> via lead selection

Node_Changing_Po = Node_Z_Bapi_Po_Combined->get_Child_Node( Name = IF_COMPONENTCONTROLLER=>wdctx_Changing_Po ).

  • navigate from <CHANGING_PO> to <T_HEADER> via lead selection

Node_T_Header = Node_Changing_Po->get_Child_Node( Name = IF_COMPONENTCONTROLLER=>wdctx_T_Header ).

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

Node_Polist = wd_Context->get_Child_Node( Name = IF_COMPONENTCONTROLLER=>wdctx_Polist ).

loa_Elements = node_T_Header->get_Elements( ).

loop at loa_Elements[] into lri_Element.

lri_Element->get_Static_Attributes(

importing Static_Attributes = stru_C_T_Header ).

  • Get the vendor number

if i_lifnr is initial.

insert stru_C_T_Header into table itab_C_T_Header[].

elseif i_lifnr = stru_c_t_header-lifnr.

insert stru_C_T_Header into table itab_C_T_Header[].

endif.

endloop.

data : W_LINES TYPE I.

describe table itab_c_t_header lines w_lines.

if w_lines eq 0.

node_Polist->set_lead_selection_index( 0 ).

CALL METHOD NODE_POLIST->INVALIDATE.

else.

node_Polist->bind_Table( itab_C_T_Header ).

clear itab_C_T_Header[].

endif.

I would have though that invalidating the node would blank the context node and mean that the table is empty but instead I get an error.

Please help.

Richard

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Richard.

What selection Mode do you use for the table and what is the Selection attribute of the context node? You have consider empty table here.

Cheers,

Sascha

former_member194198
Active Participant
0 Kudos

SelectionMode is Auto on the table.

Selection is 0..1 on the context node

This should mean it doesn't have to be a selection?

Former Member
0 Kudos

Hi Richard,

please refer my last post ..

Regards,

Anoop

former_member194198
Active Participant
0 Kudos

I have set the Initialize Lead Selection attribute on the POList context node to false.

I have then set the lead selection to 1 where there is data and 0 when there isn't.

I've saved, activated and still get the same message

I still get the same message "Context Path POLIST.EBELN Cannot Be Resolved (Last Node Is Empty) ".

Sorry - its not right yet. I had already tried this with no success .

Former Member
0 Kudos

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

But when you are invalidating the node you dont uncheck, set initializeLeadSelect to abap_false, .. right ??

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

I tested the above mentioned statement but i am afraid to say tht i was wrong .. and yes now i must agree with what Regina has suggested here .. infact even i have never used a UI element which expects a mandatory entry 😮

Thanks again for the piece of info Regina..

Regards,

Anoop

Cross checked what i had suggested based on Reginas' response

Message was edited by:

Anoop Singh Saini

former_member215843
Active Participant
0 Kudos

Hi Richard,

The problem here is that some UI element tries to bind against a node where the parent node is empty. You have to make sure that the last but one node has at least 1 element, otherwise you should hide the UI element (visibility = NONE).

If the lead selection were empty, the corresponding error message would tell you this, but it explicitely says: "Last Node is Empty", and you can trust it.

One possibility to have at least one element in the node is to change the cardinality to 1..n. If you have a supply function for this node, you have to make sure that there is at least 1 element (bind empty structure to the node), otherwise the framework creates the first element for you.

Ciao, Regina

former_member194198
Active Participant
0 Kudos

Hi Regina,

Your posting made me realise that the problem was not with the table but the detail fields next to the table which are mapped to the lead selection of the node. Once I have hidden them as per your suggestion. The problem is fixed.

Thanks for the help.

Rich

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Richard,

I guess you have set the "InitializeLeadSelect" to abap_true and hence this expects you to have record all the time .. so the moment you invalidate your node you lose all your content and the framework is not able to initialize the lead.

Solution: set the "InitializeLeadSelect" to abap_false

Regards,

Anoop