cancel
Showing results for 
Search instead for 
Did you mean: 

Webdynpro enhancement: how to hide fields?

paul_bakker2
Active Contributor
0 Kudos

Hi,

I only have limited experience with ABAP Webdynpro enhancements - mostly adding fields and changing their values.

Question: is it possible, using Webdynpro enhancements, to 'hide' standard fields in a view or to make them 'read only'?

I checked the particular fields I want to change, but the 'visible' and 'enabled' attributes are not bound to a context element.

So it seems unlikely, but has someone perhaps found a clever way of doing it?

thanks in advance

Paul Bakker

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

The simple way is using Personalization. Check this document for reference which suits your requirement: http://scn.sap.com/docs/DOC-49108

Esle,

You have to enhance the WDA view and remove the UI element and create a new UI elements and bind the read only property.

Hope this helps u,

Regards,

Kiran

paul_bakker2
Active Contributor
0 Kudos

Thanks for your reply and that link.

I don't think Personalization is the answer - doesn't that just allow end users to change their screens?

I see now that you can use Component Configuration to hide fields or deactivate them, but I actually want to do this programatically (ie turn the field on in some cases, off in others).

So I guess I need to use Enhancements. But how exactly do you delete/hide/deactivate a field using WebDynpro enhancements? With most SAP enhancement concepts you can only add items.

cheers

Paul

ramakrishnappa
Active Contributor
0 Kudos

Hi Paul,

You can do the property settings of view ui elements in POST EXIT of method WDDOMODIFYIVEW( ).

Please refer the below code:

Scenario: to hide the standard view fields  SECONDTITLE_LBL & SECONDTITLE_DDLB which are inside the transparent container PERSONALDATA.

  IF first_time = abap_true.

    DATA container TYPE REF TO cl_wd_uielement_container.

    DATA children TYPE cl_wd_uielement=>tt_uielement.

    DATA element TYPE REF TO cl_wd_uielement.


" get the container reference in which ui elements are embedded

    container ?= view->get_element( 'PERSONALDATA' ).

" Get the children of that container

    children = container->get_children( ).

"Loop over elements

    LOOP AT children INTO element.

      DATA id TYPE string.

     " get ui elment id

      id = element->get_id( ).

      IF id = `SECONDTITLE_LBL` or id = 'SECONDTITLE_DDLB'.

        element->set_visible( `01` ).                                           " set the property visibility of ui element

      ENDIF.

    ENDLOOP.

ENDIF.

-------------------

Similarly use the method SET_READ_ONLY, to set the property READONLY

Hope this helps you.

Regards,

Rama

paul_bakker2
Active Contributor
0 Kudos

Thanks for the detailed example! I will try it out.

cheers

Paul

Answers (3)

Answers (3)

former_member210804
Active Participant
0 Kudos

Hi Paul,

Question: is it possible, using Webdynpro enhancements, to 'hide' standard fields in a view or to make them 'read only'?

Ans: Yes , we can hide or read-only the standard fields. Follow the below thread,

http://scn.sap.com/thread/3456883

Former Member
0 Kudos

Hi Paul,

In Post exit of WDDOMODIFYVIEW use this code

data enable type ref to cl_wd_input_field.

  enable ?= view->get_element( 'INPUT_FIELD_ID' ).

enable->set_enabled( abap_false ).

former_member219762
Contributor
0 Kudos

Hi Paul,

In Post exit of WDDOMODIFYVIEW get ui element and change the value as you like.

Regards,

Sreenivas.