Skip to Content
0
Former Member
May 06, 2010 at 02:34 PM

Context being displayed, but blank when pulled in code.

16 Views

Quick setup for my problem.<br><br>

I have two views, and a context node (USERINFO) along with an attribute (UNAME) underneath it. In the default inbound plug I have set to call a server cookie and retrieve a provided username from another page that created it. I set the UNAME context in here, and inside the view RESET an input field properly displays the context.<br><br>

Inside the RESET view I am calling a custom table with a SELECT statement while providing it the UNAME context. However, for some reason (debugged using break statements) I cannot seem to get the UNAME context to actually be pulled properly.<br><br>

I have used the default code wizard to "get" the attribute, but it continues to be blank during runtime even despite the fact that UNAME is merrily displayed in the text box on the page. Any ideas what this could be other than some failure of my code someplace?<br><br>

Note, the node is mapped to the component controller for the entire application and is properly mapped to both the window and view.<br>

EDIT: Also forgot to mention that if I hardcode the SELECT statement with a username, it works just fine for all my code purposes. It took me a bit to figure out it wasn't the SELECT statement at fault.

<br><br>

<b>Window: MAIN_VIEW<br>

Default inbound plug handle</b><br>

<br>

method HANDLEDEFAULT.<br>

DATA: lo_nd_userinfo TYPE REF TO if_wd_context_node,<br>

lo_el_userinfo TYPE REF TO if_wd_context_element,<br>

temp TYPE STRING.<br>

lo_nd_userinfo = wd_context->get_child_node( name = wd_this->wdctx_userinfo ).<br>

lo_el_userinfo = lo_nd_userinfo->get_element( ).<br>

<br>

*Get cookie<br>

CALL METHOD cl_bsp_server_side_cookie=>get_server_cookie<br>

EXPORTING<br>

name = 'temp'<br>

application_name = 'PSSWRDRESET'<br>

application_namespace = 'ZBC'<br>

username = 'anoyn'<br>

session_id = session_id<br>

data_name = 'temp'<br>

CHANGING<br>

data_value = temp.<br>

<br>

TRANSLATE temp TO UPPER CASE.<br>

<br>

lo_el_userinfo->set_attribute( EXPORTING name = `UNAME` value = temp ).<br>

endmethod.<br>

<br>

<b>View: RESET</b><br>

<br>

method WDDOINIT.<br>

**Get user name attribute<br>

DATA: lo_nd_userinfo TYPE REF TO if_wd_context_node,<br>

lo_el_userinfo TYPE REF TO if_wd_context_element,<br>

ls_userinfo TYPE wd_this->element_userinfo,<br>

username TYPE BAPINAME.<br>

lo_nd_userinfo = wd_context->get_child_node( name = wd_this->wdctx_userinfo ).<br>

lo_el_userinfo = lo_nd_userinfo->get_element( ).<br>

lo_el_userinfo->get_attribute( EXPORTING name = `UNAME` IMPORTING value = username ).<br>

<br>

**Get the visibility attribute loaded for modification<br>

DATA: lo_nd_sysid_chk_visible TYPE REF TO if_wd_context_node,<br>

lo_el_sysid_chk_visible TYPE REF TO if_wd_context_element.<br>

lo_nd_sysid_chk_visible = wd_context->get_child_node( name = wd_this->wdctx_sysid_chk_visible ).<br>

lo_el_sysid_chk_visible = lo_nd_sysid_chk_visible->get_element( ).<br>

<br>

***Grab the system table<br>

DATA: usersystems TYPE STANDARD TABLE OF ZBC_USERSYSTEMS,<br>

w_usersystems LIKE LINE OF usersystems.<br>

SELECT SINGLE * FROM ZBC_USERSYSTEMS<br>

INTO w_usersystems<br>

WHERE USERID = username.<br>

<br>

**Make the checkboxes visible if the user has access to that system<br>

IF w_usersystems-CP1 = 'X'.<br>

lo_el_sysid_chk_visible->set_attribute( EXPORTING name = 'CP1' value = '02' ).<br>

ENDIF.<br>

**~left out remainder, not important to question<br>

ENDMETHOD.