cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the Focus?

Former Member
0 Kudos

Hi Friends,

In my Application i have some error messages.

Like when i click that error message the focus should be on the Cell where it has been pointed to.

These messages are coming from R/3.(Backend)

I am able to get the focus for error messages without R/3.

So my requirement is such that i need to get the focus coming from R/3.

Can anyone help me out in this regard.

Thanks and regards,

Chandrashekar.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi.

You need the AttributeInfo of the context attribute bound to the controller you want to focus.

Then you request focus on that context attribute.

http://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/progmodel/api/IWDViewController.h...

Like this:

IWDAttributeInfo attribute

= wdContext.nodeXYZ().getNodeInfo().getAttribute(

IPrivateMyView.IXYZElement.ABC);

wdThis.wdGetAPI().requestFocus(wdContext.currentXYZElement(), attribute);

/Mikael

Former Member
0 Kudos

Hi Mikael,

I have set the same as u suggested.But i am finding a bit difficult to identify the correct part being focussed.

So i have made an alteration such that i need to set the Cursor instead of the Focus,so that it can be identified easily.

Please do let me know how this can be done.

Thanks and regards,

Chandrashekar.

Former Member
0 Kudos

This is the only way to control where the cursor is placed inside webdynpro.

I understand you have trubble desciding what node attribute to focus on when you get a error from backend?

Either you have some kind of logic for error messages. For instance an error code starting with 100 might reffer to one type of inputfield and 200 for an other inputfield.

Usually you would request focus and report exceptions on specific attributes based on more simple datavalidations. I.e. the user eters characters in a numeric field etc.

This kinds of errors could be checked before sending any data to backend. Either use calculated node attributes to determine what attribute is being altered, or do validations in your actions before sending data to backend.

There is no api in webdynpro for placing the cursor in specific inputfields or controls. Somhow you would have to specify what node attribute you want focus on.

/Mikael

Former Member
0 Kudos

Hi,

Generally we can observe in a few Applications wherein we have the Cursor located onstart of the application at the first place where we need to enter the application.

Is it possible to set the same at the start of the application in my first screen in WebDynpro.

Is it also possible for setting the focus on the first field at start of the application.

Please do let me know for the same.

Thanks and regards,

Chandrashekar.

Former Member
0 Kudos

Hi.

You can do this by getting a reference to the context attribute bounded to your first control in the view and request focus for that attribute.

Like this:

IWDAttributeInfo attribute

= wdContext.nodeXYZ().getNodeInfo().getAttribute(

IPrivateMyView.IXYZElement.ABC);

wdThis.wdGetAPI().requestFocus(wdContext.currentXYZElement(), attribute);

There is no other way you could control the cursor in webdynpro.

/Mikael