cancel
Showing results for 
Search instead for 
Did you mean: 

How to the field dynmaically in UI

Former Member
0 Kudos

Hi Gurus,

I got a requirement where in which ,when the user chooses the particular leave type......

Say Half day sickness......Duration of the leave should be half of the work schedule which is allocated for the particular employee..(This information has to get from backend using Adaptive RFC model) using bapi.

Once the user choose half day sickness (leave option from the drop down)Duration From ....To....... (field) has to be hide from UI .....

and It has to freeze the value of Duration is (half of the work schedule which is allocated for the particular employee in the backend R/3)..........

Can anyone pls tell me how to hide the Duration From.... To.....Field dynamically once the user chooses the Half Day Sickness leave option..........

Please give me step by step approach to acheive this solution........

Higher points will be rewarded for the useful inputs.....

Thanks in Advance,

Dharani

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Can anyone pls tell me how to hide the Duration From.... To.....Field dynamically once the user chooses the Half Day Sickness leave option..........

To acheive the above

Create a context attribute lets say durationVisibility of type com.sap.ide.webdynpro.uielementdefinitions.Visibility

bind this attribute to the "visible" property of your Duration From.. To fields.

Initially set this to visible


public void wdDoInit()
  {
    //@@begin wdDoInit()
	  wdContext.currentContextElement().setLeaveVisibility(WDVisibility.VISIBLE);
  //@@end
  }

In the action handler of the halfday sickness do the following



wdContext.currentContextElement().setLeaveVisibility(WDVisibility.NONE);

Regards

Ayyapparaj

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Create In context => Value attribute => Say Visibility

Go to its properties

Select com.sap.ide.webdynpro.uielementdefinitions.Visibility

In View Layout

Select UI Element Set Visible property to this context variable Visibility.

In wdDoModifyView() You can set this property to false

wdContext.currentContextElement().setVisibility(false);

Regards,

Kiran

Edited by: Kiran Yadav on Feb 22, 2008 11:29 AM

Former Member
0 Kudos

Hi All,

Thanks for the input......

Can you guys tell me where to create the value attribute........

In the view context or in the component context...........

and field that am talking about is assign to the container you want me to assign this value attribute property to all the fields which is two input box(from and To) and the lable of the box........

Kindly clarify me........

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi,

You can create this attribute in the view context.

"and field that am talking about is assign to the container you want me to assign this value attribute property to all the fields which is two input box(from and To) and the lable of the box........"

If you wan all this things to be made visible and vice versa, you have to bind to all of this.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Aiyapparaj,

As per your guidelines I have created the value attribute in View context (which has the field..... which needs to be hide)inside the value node say FieldVisibility.......and attribute name OldTimeDuration......and I set this value with uidefeneitions Visibility .......

and I bind this vaule with the field property visible(Time.......To..........)which I need to hide...........

Now in the view implementation tab ..........I have coded in the doinit method(since my requirement to hide the field from the layout in all cases).........

wdContext.currentFieldVisibilityElement().setOldTimeDuration(WDVisibility.NONE);

But if I deploy the application and see still am getting the same field dispalying in the screen.........

I even tried putting this code in wdmodifyview method.........same results........

Kindly tell me how to hide the field permenantly from the screen............(without any conditions.)

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi,

Kindly tell me how to hide the field permenantly from the screen............(without any conditions.)

Go the properties of the UIElement

set the property "visibile" to NONE.

Was their any problems with the deployment??

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj,

I have done that....still the field Time......To....... is getting displayed in the layout........

No clue yaar....Please help me to find the root cause of this problem...........

Is there anyother way to hide this field.......

Looking forward to hear from you soon........

Thanks in Advance,

Dharani