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

Hiding Standard SRM Webdynpro View UI elements InputField) at runtime

Hi Friends,

Here i am trying to hide View UI elements in SRM 7.0 standard application, for this i have written code in WDDOMODIFYVIEW under Pre-Exit . But once i run application, first time written code is not effecting( Fields are not hiding), but if i do some action on the screen, fields are hiding.

Can someone help me, how can i hide UI elements first time itself?

Below code i have written : Here i am hiding First name & Last name Input fields

  if first_time = ' '
 DATA lo_nd_employee TYPE REF TO if_wd_context_node.

  DATA lo_el_employee TYPE REF TO if_wd_context_element.
  DATA ls_employee TYPE wd_this->Element_employee.
  DATA lv_firstname TYPE wd_this->Element_employee-firstname.

* navigate from <CONTEXT> to <EMPLOYEE> via lead selection
  lo_nd_employee = wd_context->path_get_node( path = `DATA.EMPLOYEE` ).

* @TODO handle non existant child
 IF lo_nd_employee IS INITIAL.
 ENDIF.

* get element via lead selection
  lo_el_employee = lo_nd_employee->get_element( ).
* @TODO handle not set lead selection
  IF lo_el_employee IS INITIAL.
  ENDIF.

CALL METHOD LO_ND_EMPLOYEE->SET_ATTRIBUTE_PROPERTY
  EXPORTING
    ATTRIBUTE_NAME = 'FIRSTNAME'
     PROPERTY       = 1
    VALUE          = SPACE.
*    INDEX          = USE_LEAD_SELECTION
*    ALL_ELEMENTS   = ABAP_FALSE
    .
CALL METHOD LO_ND_EMPLOYEE->SET_ATTRIBUTE_PROPERTY
  EXPORTING
    ATTRIBUTE_NAME = 'LASTNAME'
     PROPERTY       = 1
     VALUE          = SPACE.
*    INDEX          = USE_LEAD_SELECTION
*    ALL_ELEMENTS   = ABAP_FALSE
end if.
    .

Thanks

Sandeep.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2011 at 02:40 PM

    Hello Sandeep,

    just remove the condition " if first_time = ' ' ". This condition wont be satisfied for the first time. thats the reason your logic works if you trigger the roundtip.

    BR, Saravanan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Sarbjeet Singh

      Hi Sarbjeet,

      i tried even same way as you mentioned in your reply, but result is still same.

      Sarbjeet: One more thing, how can i remove State = Required property for inputfield (Mandatory) at runtime dynamically.

      i am working Component name: /SAPSRM/WDC_MOFC_PERSON

      View Name : V_PERSON

      Thanks

      Sandeep.

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.