on 09-16-2014 7:56 AM
Hello,
If I understand it correctly, you need the steps how to do that:
For the button 'New user' create a action. In this action you need to 'fire to a plug'(call the view). In this view you got the input fields that are connected to a node in the context.
After the user fill up the data in the input fields, for the button 'Submit' create a new action in which you read the context node to get the data from the view , and this data you will update your database table.
Have fun,
Hancila
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
DATA lo_el_node1 TYPE REF TO if_wd_context_element.
DATA ls_node1 TYPE wd_this->Element_node1.
DATA lv_user_id TYPE wd_this->Element_node1-user_id.
* navigate from <CONTEXT> to <NODE1> via lead selection
lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
* @TODO handle non existant child
* IF lo_nd_node1 IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_node1 = lo_nd_node1->get_element( ).
* alternative access via index
* lo_el_node1 = lo_nd_node1->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_node1 IS INITIAL.
ENDIF.
* get single attribute
lo_el_node1->get_attribute(
EXPORTING
name = `USER_ID`
IMPORTING
value = lv_user_id ).
DATA lo_nd_login TYPE REF TO if_wd_context_node.
DATA lo_el_login TYPE REF TO if_wd_context_element.
DATA ls_login TYPE wd_this->Element_login.
DATA lv_name TYPE wd_this->Element_login-name.
* navigate from <CONTEXT> to <LOGIN> via lead selection
lo_nd_login = wd_context->get_child_node( name = wd_this->wdctx_login).
* @TODO handle non existant child
* IF lo_nd_login IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_login = lo_nd_login->get_element( ).
* alternative access via index
* lo_el_login = lo_nd_login->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_login IS INITIAL.
ENDIF.
* get single attribute
lo_el_login->get_attribute(
EXPORTING
name = `NAME`
IMPORTING
value = lv_name ).
DATA lo_nd_passwd TYPE REF TO if_wd_context_node.
DATA lo_el_passwd TYPE REF TO if_wd_context_element.
DATA ls_passwd TYPE wd_this->Element_passwd.
DATA lv_passwd TYPE wd_this->Element_passwd-passwd.
* navigate from <CONTEXT> to <PASSWD> via lead selection
lo_nd_passwd = wd_context->get_child_node( name = wd_this->wdctx_passwd ).
* @TODO handle non existant child
* IF lo_nd_passwd IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_passwd = lo_nd_passwd->get_element( ).
* alternative access via index
* lo_el_passwd = lo_nd_passwd->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_passwd IS INITIAL.
ENDIF.
* get single attribute
lo_el_passwd->get_attribute(
EXPORTING
name = `PASSWD`
IMPORTING
value = lv_passwd ).
Data wa type z-table.
wa-userid = lv_userid.
wa-paswd = lv_passwd.
wa-name - lv_name.
update z-table from wa.
commit work.
check the modified code just change the name of ztable to the table u want to update.
cheers
Hello
i have created a node which has 3 attributes.
i have use code wizard and my code is as-
method ONACTIONSAVE .
DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
DATA lo_el_node1 TYPE REF TO if_wd_context_element.
DATA ls_node1 TYPE wd_this->Element_node1.
* navigate from <CONTEXT> to <NODE1> via lead selection
lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
* @TODO handle non existant child
* IF lo_nd_node1 IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_node1 = lo_nd_node1->get_element( ).
* alternative access via index
* lo_el_node1 = lo_nd_node1->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_node1 IS INITIAL.
ENDIF.
* get all declared attributes
lo_el_node1->get_static_attributes(
IMPORTING
static_attributes = ls_node1 ).
Data wa type z-table.
wa-userid = lv_userid.
wa-paswd = lv_passwd.
wa-name - lv_name.
update z-table from wa.
commit work.
ENDMETHOD.
Can you check what should be next to update or save the values in Z-table
Regards
varun
Hi
What is a neccessary set when user is valid?
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varun,
I don't see is it a good idea to have to store user credentials in a z-table, which can be accessed by anyone, and can login , if you need to store passwords, are you considering the encryption?
What are you trying to achieve from this?
...................
Regarding your approach of development
...................
Why are you creating separate context nodes for each fields viz, user id, password?
data lo_node type ref to if_wd_context_node.
data ls_user_reg type wd_this->element_REG_USER
lo_node->GET_STATIC_ATTRIBUTES( receiving static_attributes = ls_user_reg )
data ls_zdata type z_user_data.
move-corresponding ls_user_reg to ls_zdata.
modify Z_USER_DATA from ls_zdata.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
i have created a node which has 3 attributes.
i have use code wizard and my code is as-
method ONACTIONSAVE .
DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
DATA lo_el_node1 TYPE REF TO if_wd_context_element.
DATA ls_node1 TYPE wd_this->Element_node1.
* navigate from <CONTEXT> to <NODE1> via lead selection
lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
* @TODO handle non existant child
* IF lo_nd_node1 IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_node1 = lo_nd_node1->get_element( ).
* alternative access via index
* lo_el_node1 = lo_nd_node1->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_node1 IS INITIAL.
ENDIF.
* get all declared attributes
lo_el_node1->get_static_attributes(
IMPORTING
static_attributes = ls_node1 ).
Data wa type z-table.
wa-userid = lv_userid.
wa-paswd = lv_passwd.
wa-name - lv_name.
update z-table from wa.
commit work.
ENDMETHOD.
Can you check what should be next to update or save the values in Z-table
Regards
varun
Here's the code as-
method ONACTIONSAVE .
DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
DATA lo_el_node1 TYPE REF TO if_wd_context_element.
DATA ls_node1 TYPE wd_this->Element_node1.
* navigate from <CONTEXT> to <NODE1> via lead selection
lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
* @TODO handle non existant child
* IF lo_nd_node1 IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_node1 = lo_nd_node1->get_element( ).
* alternative access via index
* lo_el_node1 = lo_nd_node1->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_node1 IS INITIAL.
ENDIF.
* get all declared attributes
lo_el_node1->get_static_attributes(
IMPORTING
static_attributes = ls_node1 ).
Data wa type zentry.
wa-userid = lv_user_id.
wa-password = lv_password.
wa-name = lv_name.
MOVE-CORRESPONDING ls_node1 to wa.
modify zentry from wa.
*update zentry from wa.
commit work.
ENDMETHOD.
Actually i have changed the design as well.
Created one node and in that created 3 attributes and finally read the values from code wizard.
Regards
varun
Hi Varun,
I think i already replied to you in previous thread which due to some reasons is not there anymore
what did you do with previous thread?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
Yeah i understand
I am pasting a screenshot of my code as-
method ONACTIONSAVE .
DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
DATA lo_el_node1 TYPE REF TO if_wd_context_element.
DATA ls_node1 TYPE wd_this->Element_node1.
DATA lv_user_id TYPE wd_this->Element_node1-user_id.
* navigate from <CONTEXT> to <NODE1> via lead selection
lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
* @TODO handle non existant child
* IF lo_nd_node1 IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_node1 = lo_nd_node1->get_element( ).
* alternative access via index
* lo_el_node1 = lo_nd_node1->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_node1 IS INITIAL.
ENDIF.
* get single attribute
lo_el_node1->get_attribute(
EXPORTING
name = `USER_ID`
IMPORTING
value = lv_user_id ).
DATA lo_nd_login TYPE REF TO if_wd_context_node.
DATA lo_el_login TYPE REF TO if_wd_context_element.
DATA ls_login TYPE wd_this->Element_login.
DATA lv_name TYPE wd_this->Element_login-name.
* navigate from <CONTEXT> to <LOGIN> via lead selection
lo_nd_login = wd_context->get_child_node( name = wd_this->wdctx_login ).
* @TODO handle non existant child
* IF lo_nd_login IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_login = lo_nd_login->get_element( ).
* alternative access via index
* lo_el_login = lo_nd_login->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_login IS INITIAL.
ENDIF.
* get single attribute
lo_el_login->get_attribute(
EXPORTING
name = `NAME`
IMPORTING
value = lv_name ).
DATA lo_nd_passwd TYPE REF TO if_wd_context_node.
DATA lo_el_passwd TYPE REF TO if_wd_context_element.
DATA ls_passwd TYPE wd_this->Element_passwd.
DATA lv_passwd TYPE wd_this->Element_passwd-passwd.
* navigate from <CONTEXT> to <PASSWD> via lead selection
lo_nd_passwd = wd_context->get_child_node( name = wd_this->wdctx_passwd ).
* @TODO handle non existant child
* IF lo_nd_passwd IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_passwd = lo_nd_passwd->get_element( ).
* alternative access via index
* lo_el_passwd = lo_nd_passwd->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_passwd IS INITIAL.
ENDIF.
* get single attribute
lo_el_passwd->get_attribute(
EXPORTING
name = `PASSWD`
IMPORTING
value = lv_passwd ).
ENDMETHOD.
Can you help by looking the code
Regards
varun
hi,
create on action even for submit button.u can check subit button properties and give the action name(event name).inside submit action method write the code(use the code wizard to read the values from the input field) and update the ztable.
Best regards,
Noufal P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varun,
Are these two windows or views ?
If they are views, what you can do is create the nodes accordingly in component controller and read them in both the view.
For navigating between views you can make use of inbound and outbound plugs.
Regards,
Aakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.