Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Webdynpro code

Dear Expertise

I have created a login page  in webdynpro.

here's the screenshots as-

Main

View

after clicking new user from main window, i should go to view window and fill the details , then that data should be save in Z-table.

Can anyone help me with this?

Regards

varun

Former Member
replied

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

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question