cancel
Showing results for 
Search instead for 
Did you mean: 

Space between two fields

Former Member
0 Kudos

Hello All,

In dynpro how we can get the space between two elements and next line and align the fields in the center. Can we use HTML or like javascript in dynpro.

One more question in create a login page. If user press login buton then after checking from the database whether the username password is correct main view call and if the user press the new user button new userview is called. How to achieve this functionality.

Regards

Harpreet

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Again, you need to use the wd_this pointer. You cannot access web_class directly without using wd_this.

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

You have to refer it as "wd_this->web_class". The correct call would be:

call method wd_this->web_class->login.

Also, ensure that you have the create object statement only in the wdoninit method.

Regards,

ram

Former Member
0 Kudos

To see a complete tutorial of how to do a simple WebdynPro application, you can visit the following Link:

http://help.sap.com/saphelp_nw04s/helpdata/en/e6/2c4b29dc87c6409d6469ec390e8f3d/content.htm

This link will help you get all the basics. Once you read the introduction on this page, click on the "Lets Go!' link at the bottom to start knowing more. The links to the subsequent pages are available at the bottom of each page.

Hope this helps you in your learning.

Regards,

Ram

Former Member
0 Kudos

Thanks to all for your valuable suggestion.

Now the problem arise is I have define the global class and all my methods for checking the data base are in the global class.

if I use the method of class in the onclick of button action

data : web_class type ref to zcl_web_class.

create object web_class

call web_class-> check_login.

it works.

But I want to define the instanse of my class zcl_web_class in the whole view. For that i tried to define that class in the atttribute of the view, but it does not work,

Any suggestion will be appricieable.

Regards

Harpreet.

mohammed_anzys
Contributor
0 Kudos

hi

You can add an attribute of the type zcl_web_class , in your view attribute.But where are you going to create an instance and save it to that attribute .Unless and otherwise you populate the attribute with an instance value, it will not work.

so what i suggest is , in your domodifyview method .

if first_time = abap_true

create an instance of webclass and save the instance in the view attribute

endif.

it will work

Thanks

Anzy

Award points if this solves yoru problem

Former Member
0 Kudos

Hi,

Another place to place your 'create object..' statement would be the 'wdoninit' method. This method call happens only when the view is loaded for the first time.

Also, while creating the object in the attributes section, put a tick mark on the 'ref to' checkbox.

Regards,

Ram

Former Member
0 Kudos

Create an instance in the doinit and save it as a class attribute of your view. Or use static methods, makes the whole thing simpler.

Former Member
0 Kudos

Hello,

As per your suggestion I define the object in the attribute tab of the view with ref to mark as check as following

web_class type ref to ZCL_WEB_CLASS

after that I create the instance in the wdoinit and even try with modify as.

create object web_class

After defining all these when i call my method of class in the ONACTIONON_LOGIN_1 action as it says error web class not define.

CALL METHOD web_class->login

Regards

Harpreet

Former Member
0 Kudos

access the instance as wd_this->web_class. It should work.

mohammed_anzys
Contributor
0 Kudos

Hi

you should call like

wd_this->Web_class->login.

not directly the attribute.

Thanks

Anzy

Former Member
0 Kudos

All attributes defined in the view should be accessed with wd_this, and those defined in the component controller should be accessed with wd_comp_controller. Hope this helps you while creating further WD4A applications.

mohammed_anzys
Contributor
0 Kudos

Hi

Yes , whatever nithya said is perfectly correct. One more comment too, wd_this

is like this pointer is C language. It references the current object that we are in. if you are on a view , then wd_this will give you the view controller and if you are in the component controlelr it will give you the instance of the current component controller instance.

Thanks

Anzy

Former Member
0 Kudos

Hello All,

As per your suggetion I define the object in the attribute tab of the view and i call my method as

call method wd_this->web_class->login

But it does not allow to define the instance in the method WDDOINIT says web_class is unknown


method WDDOINIT .
create object web_class.
endmethod.

Regards

Harpreet

mohammed_anzys
Contributor
0 Kudos

iN DOINIT

Data: myclass is type your classs.

create object myclass.

wd_this->web_class = myclass.

this will solve your problem

Thanks

Anzy

Former Member
0 Kudos

Thanks Mohammed and Anzy for sharing your great knowledge,

I have directly define the instance as an it work perfectly.

create object wd_this->web_class

Even I want have assign the full points to both only 1 can get 10 points.

Thanks again

Regards

Harpreet

mohammed_anzys
Contributor
0 Kudos

Hi

1. Space can arranged only with teh correct lay out , if you choose grid layout there will be a space.

2. For achieving this you need to have three views

view1 = login page

view2 = Home page

view3 = new user page.

In the view1 you need to create two outbound plugs, one for view2 and other for view3

and in view2 and view3 you need to create inbound plugs from the view1.

Go to the window and embedd the views , then create the navigation links between the different plugs .

Now in your login button action write the following code.

if user exists in database.

Fire out bound plug for view1 - homepage

else.

Fire outbound plug for view2.

Thanks

Anzy

Reward points for useful answers.

mohammed_anzys
Contributor
0 Kudos

small correction

if user exists in database.

Fire out bound plug for view2 - homepage

else.

Fire outbound plug for view3 - New user page

endif.

Former Member
0 Kudos

Hi,

And for navigating to two different views, you can create two outbound plugs from your current view (one plug each to the two target views). Then, depending on the validation, you can fire the required outboud plug.

To fire the oubound plug, you can use the code wizard. Firing the outboud plug will automatically allow you to navigate to the next view.

Regards,

Ram

Former Member
0 Kudos

Hi Harpreet,

You can define spacing between elements in your layout. For example, if you specify the layout of your container (group/tray etc) as "Grid Layout", in the properties, you can specify the cell padding.

For your second requirement, create a context node "login" with username and password fields. Bind the attributes to your input fields. On click of the button, in the event handler, read the context attributes. Pass them to your API, say verify_details(username, password). and depending on the result, you either display an error message, or fire a navigation plug.

You need to define an outbound plug between your login view and user view. You can user the wizard to fire the outbound plug.

To display a message, you need to use the interface if_wd_message_manager.

Hope this helps.

regards

Nithya

Former Member
0 Kudos

Hi,

For spacing, you can specify the paddingleft, paddingright, paddingtop and paddingbottom properties of the element. This is available only if you use the grid layout.

Regards,

Ram