cancel
Showing results for 
Search instead for 
Did you mean: 

clearing attribute value

Former Member
0 Kudos

Hi,

How to clear the attribute value?

I have a attribute att1, after executing i want to clear the value that is stored in the attribute.

I have tried clear wd_this->lm_att1.

It is not getting cleared.

help me..

Regards...

Arun.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

To clear a context attribute, you need to do a set_attribute and pass ' ' to it. Then it will get cleared.

regards

nithya

S-H
Active Participant
0 Kudos

Hi Arun,

Are you tring to clear the attribute bound to the UI element? if then set the initial value or blank value to the attribute by using set_attribute() of element.

Best regards,

Suresh

Former Member
0 Kudos

Hi Arun.

If you have defined an attribute in the attributes tab of a view or comp controller

clear would do the job.

Are you sure you do not set this attribute in other steps right after clearing it (other method).

In debugging mode, afer you call clear the attribute is empty, rite?

Cheers,

Sascha

Former Member
0 Kudos

Hi sascha,

I am using that attribute in the another method in the same view.

I am using that attribute in onactionenter and wddomodifyview.

after getting the values in the table control, attribute value should be cleared.

but it is not getting cleared.

Whether there is any other alternate other than using clear command.(becoz it is not working).

Regards..

Arun.

Former Member
0 Kudos

if you clear it in onactionenter and fill it in onmodifyview it will be filled again cause wddomodifyview is called after the action.

Cheers,

Sascha

Former Member
0 Kudos

Hi ,

I think you are clearing the Attribute value which is int he Context of View, to Clear it you should actually clear it in the Component Controller Context

cheers

Former Member
0 Kudos

sascha,

can u suggest me what i can do in this scenario.

I will explain my situation.

I am entering a key value in the table control. That value fetches other values from the table and fill it in the table control. using modifyview i am filling the other values.

Now i want to clear the key value which i have entered.

Waiting for ur valuable reply.

Regards...

Arun.

Former Member
0 Kudos

I wonder why u store this key value as a view's attribute. I guess you also have some corresponding value in the context?

I have something similiar. I have a table with order positions. When user enters material number and amount and hits enter the material description and other stuff is loaded and displayed in the same row.

Is this similar to what you are doing?

In this case you do not need to do anything in wddomodifyview and do not store a value as view attribute.

Or is you process totally different? then explain in more detail why and where you use this view attribute.

PS: If you just want to clear the key value displayed in the table control you have to get the element of this row and call elemnt->set_attribute(

name = 'lm_att1'

value = ''

).

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

Former Member
0 Kudos

sascha,

my requirement is similar to ur one. I am getting the values from a different db table and getting displayed and i have to store it in a different table.

The same pressing of enter.

i have changed my coding and kept all the things in the onactionenter. At the end i am clearing the values but it is not getting cleared.

one constant value is coming all the time.

regards...

Arun

Former Member
0 Kudos

Hi arun.

Where is the value stored that is coming 'all the time'?

Where is it displayed?

Where is it filled?

Cheers,

Sascha

Former Member
0 Kudos

sascha,

can u send me ur mail id. i can send my code.

Regards..

Arun.

Former Member
0 Kudos

Hi Arun.

I am sorry, I do not want to spread my Email ID. Furthermore this problem should completely solved in here so other people can benefit from this thread.

You can paste your coding here.

Cheers,

Sascha

Former Member
0 Kudos

ok sascha, I accept ur point.

this is my code.

Now my requirement is i want to validate that field lv_atnam.

if lv_atnam is not available in the table it should popup a messge.

for that i have used a select query. But it is not working properly.

Give me ur suggestion.

DATA lo_nd_zcabn1 TYPE REF TO if_wd_context_node.

DATA lo_el_zcabn1 TYPE REF TO if_wd_context_element.

DATA ls_zcabn1 TYPE wd_this->element_zcabn1.

DATA lt_zcabn1 TYPE if_characteristics=>elements_zcabn1.

DATA lv_atnam LIKE ls_zcabn1-atnam.

DATA l_zcabn1 TYPE zcabn1.

DATA wa_zcabn1 TYPE zklah.

  • data i_tab type table of zcabn1.

DATA count TYPE i.

lo_nd_zcabn1 = wd_context->get_child_node( name = wd_this->wdctx_zcabn1 ).

count = lo_nd_zcabn1->get_element_count( ).

lo_el_zcabn1 = lo_nd_zcabn1->get_element( index = count ).

lo_el_zcabn1->get_attribute( EXPORTING name = `ATNAM` IMPORTING value = lv_atnam ).

IF lv_atnam IS NOT INITIAL.

CALL FUNCTION 'Z_CHAR'

EXPORTING

atnam = lv_atnam

TABLES

itab = lt_zcabn1.

LOOP AT lt_zcabn1 INTO ls_zcabn1 .

lo_el_zcabn1->set_static_attributes(

static_attributes = ls_zcabn1 ).

ENDLOOP.

ENDIF.

Regards...

Arun.

Former Member
0 Kudos

Hi Arun.

In you code you loop over all returned entries of the FM and set the static attributes in the element which means you overwrite them all the time and only the last entry of lt_zcabn1will be set in the element.

And you always do that for the last element in the table.

Ok .. so what are you expecting as correct behaviour?

Cheers,

Sascha

Former Member
0 Kudos

Hi Sascha,

Sorry for this late reply.

Instead of loop, i have changed my code.

lo_nd_zcabn1->bind_table( LT_ZCABN1 ).

but the problem only one value is filled in the table and when i am trying to fill the second row, the first row is replaced by the second row. That's y i used the loop.

if u have any other suggestions just pass on to me.

My actual problem is solved. The problem occured becoz of lead selection.

It is always pointing to the initial element.

Thanx a lot.

Regards...

Arun.

Former Member
0 Kudos

Hi Arun.

Good to hear.

Cheers,

Sascha

Former Member
0 Kudos

use:

 lo_nd_zcabn1->bin_table( 
 new_items = lt_zcabn1
 set_initial_elements = abap_false
).

set_initial_elements indicates if you want to keep old elements in the node or not.

If you do not set it to abap_false you always overwrite the old elements. With set to false your new elements will be appended to teh end.

Cheers,

Sascha