cancel
Showing results for 
Search instead for 
Did you mean: 

IS_ATTRIBUTE_NULL usage

Former Member
0 Kudos

Hi,

I am using method IS_ATTRIBUTE_NULL to check whether my attribute is null or not as follows:

data flage type abap_bool.

WD_CONTEXT->IS_ATTRIBUTE_NULL(

exporting

NAME = 'LTA_YO2'

returning

FLAG = flag.

).

but i am getting error as FLAG is not expected. Can any one please help.

Regards,

Tushar

Accepted Solutions (1)

Accepted Solutions (1)

former_member40425
Contributor
0 Kudos

Hi,

data flag type abap_bool.
WD_CONTEXT->IS_ATTRIBUTE_NULL(
exporting
NAME = 'LTA_YO2'
  receiving " Use  receiving here, you are getting error because you are using returning
FLAG = flag.
).

I hope it helps.

Regards,

Rohit

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

data flage type abap_bool.

WD_CONTEXT->IS_ATTRIBUTE_NULL(

exporting

NAME = 'LTA_YO2'

returning

FLAG = flag. "Is this flage or flag. Typo error.

).

flage is a typo error. the returning parameter is FLAG & if you ahve declared is also FLAG then..........

Try using other variable names.

Check the dataype this method is returning.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

I used the following code and it works fine.

data: lv_flag type abap_bool.

CALL METHOD WD_CONTEXT->IS_ATTRIBUTE_NULL

EXPORTING

NAME = 'NAME'

RECEIVING

FLAG = lv_flag.

There are two points to be checked:

- The attribute you are checking e.g. "NAME" here is a standalone attribute directly under the hierarchy of the root node, since you are using "wd_context" to access it.

- Declare a local variable and then use it.

Hope this helps.

Best Regards,

Ashish.

Former Member
0 Kudos

Hi Ashish,

Thanks for answering. Actually in my case LTA_YO2 is the node and under that node i have an attribute named VALUE.

CONTEXT

- LTA_YO2

- VALUE

I have to check whether VALUE is null or not and based on that i will read this value. I have checked using name. Could you please help me with correct usage in this scenario.

CLEAR lv_flag.

wd_context->is_attribute_null(

EXPORTING

name = 'LTA_YO2'

returning

flag = lv_flag

).

IF lv_flag <> 'X'.

DATA lo_nd_lta_yo2 TYPE REF TO if_wd_context_node.

DATA lo_el_lta_yo2 TYPE REF TO if_wd_context_element.

DATA ls_lta_yo2 TYPE wd_this->element_lta_yo2.

DATA flag TYPE abap_bool.

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

lo_nd_lta_yo2 = wd_context->get_child_node( name = wd_this->wdctx_lta_yo2 ).

  • get element via lead selection

lo_el_lta_yo2 = lo_nd_lta_yo2->get_element( ).

  • get all declared attributes

lo_el_lta_yo2->get_static_attributes(

IMPORTING

static_attributes = ls_lta_yo2 ).

IF sy-subrc = 0.

lw_zreq_hrs-lta_yo2 = ls_lta_yo2-value.

ENDIF.

ENDIF.

Edited by: tushar mehta on Jun 1, 2009 8:39 AM