on 09-06-2011 3:06 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 .
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.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.