cancel
Showing results for 
Search instead for 
Did you mean: 

HAP_DOCUMENT_HEADER

Former Member
0 Kudos

Dear Experts.

In component WebDynpro HAP_DOCUMENT_HEADER have a View with several fields. One of this fields is: INPUT_APPRAISER.

I want that this field is as field Disable.

I created a enhancement in the POST-EXIT:

 
    DATA lo_nd_appraiser TYPE REF TO if_wd_context_node.
    DATA lo_el_appraiser TYPE REF TO if_wd_context_element.
    DATA ls_appraiser TYPE wd_this->Element_appraiser.
    DATA lv_visibility_input TYPE wd_this->Element_appraiser-visibility_input.

*   navigate from <CONTEXT> to <APPRAISER> via lead selection
    lo_nd_appraiser = wd_context->path_get_node( path = 'UI_VISIBILITY.APPRAISER' ).

*   get element via lead selection
    lo_el_appraiser = lo_nd_appraiser->get_element( ).

*   @TODO handle not set lead selection
    IF lo_el_appraiser IS INITIAL.
    ENDIF.

*   set single attribute
    lo_el_appraiser->set_attribute(
      name =  'VISIBILITY_INPUT'
      value = lv_visibility_input ).

But with this code the Button is hided, but my requierement is show this field but disabled.

I checked the Method set_attribute_property

CALL METHOD lo_el_appraiser->set_attribute_property

EXPORTING

attribute_name = 'VISIBILITY_INPUT'

property = 3

value = ' '.

But this not work fine.

How can solve my issue?

Thanks in advance,

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Are you wanting to change the state of a UI element on the view or an attribute? Not clear

Edited by: Mohammed Majaz Shaikh on Feb 22, 2011 5:54 AM

Edited by: Mohammed Majaz Shaikh on Feb 22, 2011 6:05 AM

Former Member
0 Kudos

I need change the state of a UI element on the view.

The Component WebDynpro is HAP_DOCUMENT_HEADER. The field is: INPUT_APPRAISER.

I want that this field is as field Disable.

[Image|http://www.freeimagehosting.net/uploads/f3caa4f0f9.jpg]

Regards.

Former Member
0 Kudos

HI ,

What kind of UI element are you working on?

In my previous post , I mentioned the code for button.

If it is a input field , use the class CL_WD_INPUT_FIELD.

Thanks,

Aditya.

Former Member
0 Kudos

Dear Aditya.

Yes. This is an Input Field with ID INPUT_APPRAISER . This field is in the View VW_HEADER_MAIN of the Component WebDynpro HAP_DOCUMENT_HEADER.

You suggestion is use the class CL_WD_INPUT_FIELD, but I have a doubt How can generate the code using the Wizard for disable this field.

Thanks in advance,

Regards.

Former Member
0 Kudos

HI ,

I looked at the componet HAP_DOCUMENT_HEADER and the view VW_HEADER_MAIN.

Found that , the enabled property of input field , INPUT_APPRAISER is not bound to any context attribute.

So I am not sure if you can create a new attribute in the enhancement implementation . Perhaps , it would be easier to perform some tweak in the post exit of WDDOMODIFY view.

As suggested , you can use the class CL_WD_INPUT_FIELD.

And also note the point that , the coding shown below cannot be generated from the wizard.

You could code as follows to disable the input field.

DATA lo_input_field TYPE REF TO cl_wd_input_field . "The reference to the input field.

lo_input_field ?= view->get_element(ID = 'INPUT_APPRAISER').
lo_input_field->set_enabled(abap_false).

Thanks,

Aditya.

Former Member
0 Kudos

Dear Aditya.

With this code I can disable the field.

For close this post, I have a last question:

In POO for What is used the symbol ?= in the instruction:

 lo_input_field ?= view->get_element(ID = 'INPUT_APPRAISER').

Thanks.

Former Member
0 Kudos

Hi ,

'?=' is the casting operator.

The method get_element() returns a reference of type IF_WD_VIEW_ELEMENT.

All the implementing classes of the UI elements (say CL_WD_INPUT_ELEMENT) inherit the interface IF_WD_VIEW_ELEMENT.

So , basically we are down casting the reference of 'IF_WD_VIEW_ELEMENT' to a more specific type like 'CL_WD_INPUT_ELEMENT'. Down casting is possible only if the target type either inherits or implements the source type .

Also , casting is possible only in case of object references and not ABAP types.

Defn of down cast: A down cast is an assignment between reference variables in which the typr static type of the target variable more specific than the static type of the source variable. A down cast is only possible in assignments with the casting operator .

Thanks,

Aditya.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi ,

The above code hides the button because , the context element whose value you are changing is bound to the visibility of the button .

So , to make the button disabled(not hide) , check if the enabled property of the button is bound to any context attribute in the view and set the value 'abap_false' to the attribute.

But , if the enabled property is not bound , then you will need to dynamically change the enabled property somthing like this ,

lo_button TYPE REF TO cl_wd_button.

lo_button ?= view->get_element('BUTTON_NAME_IN_VIEW').
lo_button->set_enabled(abap_false).

use this method only if the enabled property is not bound to any attribute.

Thanks,

Aditya.