Below is the ABAP code to populate fields within a web Dynpro screen. The fields being populated are 'ANRED', 'NACHN' and 'VORNA' within context structure 'USER_DETAILS'. Also populates webDynpro fields within ABAP wdp context structure 'VISIBLE'. See here for how to create webdynpro context within your ABAP web dynpro application.
Data: context_node type ref to if_wd_context_node, ld_pernr type pernr-pernr, wa_userdet type if_main=>element_USER_DETAILS, ld_visible type if_main=>element_VISIBLE. ld_pernr = '11111'. if not ld_pernr is initial. select single anred nachn vorna from pa0002 into CORRESPONDING FIELDS OF wa_userdet where pernr = ld_pernr. ld_visible-vis_userdet = '02'. endif. * Populate webDynpro field(s) context_node = wd_context->get_child_node( name = 'USER_DETAILS'). context_node->BIND_STRUCTURE( wa_userdet ). context_node = wd_context->get_child_node( name = 'VISIBLE'). context_node->BIND_STRUCTURE( ld_visible ).
Also see SET_ATTRIBUTE method or see here for more methods available within the IF_WD_CONTEXT_NODE interface.