Skip to Content
author's profile photo Former Member
Former Member

How to hide input field dynamically

Hi Expert,

I am trying to hide some input field from the view under certain conditions. Here is my code.

data: lr_input type ref to cl_wd_input_field.

if not stru_prod1-objek1 is initial.

lr_input ?= view->get_element( 'DESC1_1' ).

lr_input->set_visible( visibility = 'visible' ).

endif.

Here is the error message:

Formal parameter "VISIBILITY" does not exist. exist.

Can anyone tell me what wrong with my code?

Thanks,

ATANG

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Nov 18, 2007 at 01:18 AM

    Welcome to SDN.

    You can hide with below code:

    lr_input->set_visible( CL_WD_UIELEMENT=>e_visible-NONE ).

    Raja T

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 19, 2007 at 04:33 AM

    Hi Andy,

    Another way of doing this is the following:

    Define a context attribute (or node of cardinality 0..1 with a context attribute) say INPUT_VIS. In the layout, for the property of the UI element visible, bind the context attribute INPUT_VIS.

    Now based on your condition, set INPUT_VIS = 'X' (to view) or INPUT_VIS = ' '(to hide) as a value to the context attribute.

    Hope this helps,

    Regards,

    Wenonah

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 19, 2007 at 07:22 AM

    Hi Andy,

    Make use of This example which is used to hide an input field

    DATA:

    name_ip TYPE REF TO cl_wd_input_field.

    name_ip ?= view->get_element( 'NAME').

    " NAME is the name of input field in my view

    CALL METHOD name_ip->set_visible

    EXPORTING

    value = abap_false

    .

    Regards

    Sarath

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sarath,

      Here is the error message when call method is used in my abap code.

      "ABAP-FALSE" is not type-compatible with formal parameter "VALUE".

      Here is my code:

      data: lr_dropdown type ref to cl_wd_dropdown_by_key.

      lr_dropdown ?= view->get_element( 'OBJEK1' ).

      CALL METHOD lr_dropdown->set_visible

      EXPORTING

      value = abap_false.

      Thanks

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.