Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Getting null reference when i declare element?

HI,

When i am declaring node and its element i am not getting proper reference. so when i use that element to access any method , it give null pointer error.

like,

my context got through service call , is like:

ZBAPI_FORWARD_WOR_1->node

IMPORTING_1 ->node

PERNR -> attribute

CHANGING_1 ->node

TT_WWID ->node

wi_id -> attribute

TT_WWID is table in bapi having cardianality 0..N

when i declare in code:

DATA:

NODE_ZBAPI_FORWARD_WOR_1 TYPE REF TO IF_WD_CONTEXT_NODE,

NODE_CHANGING_1 TYPE REF TO IF_WD_CONTEXT_NODE,

NODE_TT_WIID TYPE REF TO IF_WD_CONTEXT_NODE,

ELEM_TT_WIID TYPE REF TO IF_WD_CONTEXT_ELEMENT,

STRU_TT_WIID TYPE IF_MAIN=>ELEMENT_TT_WIID .

NODE_ZBAPI_FORWARD_WOR_1 =

WD_CONTEXT->GET_CHILD_NODE( NAME = IF_MAIN=>WDCTX_ZBAPI_FORWARD_WOR_1 ).

NODE_CHANGING_1 =

NODE_ZBAPI_FORWARD_WOR_1->GET_CHILD_NODE( NAME = IF_MAIN=>WDCTX_CHANGING_1 ).

NODE_TT_WIID =

NODE_CHANGING_1-GET_CHILD_NODE( NAME = IF_MAIN=>WDCTX_TT_WIID ).

ELEM_TT_WIID = NODE_TT_WIID->GET_ELEMENT( ).

CALL METHOD ELEM_TT_WIID->SET_ATTRIBUTE

EXPORTING

VALUE = ITEM_WI_ID

NAME = 'WI_ID'.

I am not getting any refrence in elem_tt_wiid.....so i am getting error when access method set_attribute......

any idea?

thanks,

saurin shah.

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question