cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding Standard SRM Webdynpro View UI elements InputField) at runtime

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

saravanan_narayanan
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hello Saravanan,

i did same, but still same output.

Thanks

Sandeep.

saravanan_narayanan
Active Contributor
0 Kudos

Hello Sandeep,

if you face the same problem even after removing the condition, then i think in the WdDoModifyview, the attribute properties are reset by the standard coding. Try moving your code to post-exit instead of pre-exit.

BR, Saravanan

Former Member
0 Kudos

code seems to correct. Make sure once again that you do not have first_time condition checked.

Further it is good practice to have the code ,using the defined constants.

CALL METHOD LO_ND_EMPLOYEE->SET_ATTRIBUTE_PROPERTY
  EXPORTING
    ATTRIBUTE_NAME = 'FIRSTNAME'
     PROPERTY       = IF_WD_CONTEXT_ELEMENT=>E_property-visible
    VALUE          =   abap_false .

    .
CALL METHOD LO_ND_EMPLOYEE->SET_ATTRIBUTE_PROPERTY
  EXPORTING
    ATTRIBUTE_NAME = 'LASTNAME'
     PROPERTY       =  IF_WD_CONTEXT_ELEMENT=>E_property-visible
     VALUE          = abap_false .

Former Member
0 Kudos

Hi Saravanan,

Even i tried same like moving code from Pre-exit to Post-exit, but there is no change in output.

Thanks

Sandeep.

Former Member
0 Kudos

Hi Baskaran,

i checked once again First_time condition, i removed that condition. even i changed code as per your guidelines.. but still same output.

Thanks

Sandeep.

gill367
Active Contributor
0 Kudos

it should be beacause of this condition only.

check it properly and activate the comp again.

if first_time = ' '

also could you please provide the name of the Standard comp u r working on.

Thanks

sarbjeet singh

Former Member
0 Kudos

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.