cancel
Showing results for 
Search instead for 
Did you mean: 

Context Node

Former Member
0 Kudos

Hi,

What are the different ways of getting data from a table and pass it to Webdynpro context node?

Regards,

Dinesh90

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Three ways we can do it.

select the data to an internal table and pass it to the node using bind table method

use a model class instance to get data

use the service call option provided by webdynpro framework

Regards

Karthik.R

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

1. First load the data to an internal table from the database table.

2. Navigate to the context node which you want to bind data.

3. After that you can bind the data to the node using following methods.

Example Code :



data:
      BEGIN OF KNA1_STRU,
        KUNNR TYPE KNA1-KUNNR,
        LAND1 TYPE KNA1-LAND1,
        NAME1 TYPE KNA1-NAME1,
        ORT01 TYPE KNA1-ORT01,
        PSTLZ TYPE KNA1-PSTLZ,
        STRAS TYPE KNA1-STRAS,
        TELF1 TYPE KNA1-TELF1,
      END OF KNA1_STRU,
      node_kna1 type ref to IF_WD_CONTEXT_NODE,
      itab_kna1 LIKE STANDARD TABLE OF KNA1_STRU.

select * from KNA1 into corresponding fields of table itab_kna1.

node_kna1 = wd_Context->get_Child_Node( Name = 'KNA1_NODE' ).

node_kna1->Bind_Table( itab_kna1 ).

Bind_elements method can be also used. It can be used as follows



node_kna1->Bind_Elements( exporting new_items = itab_kna1 set_initial_elements = abap_false ).

When set_initial_elements is given abap_false, It will append the given table to already existing data bound to that context.

To add a single row of data i.e. a structure use Bind_element method.



node_kna1->Bind_Elements( exporting new_item = kna1_stru set_initial_elements = abap_false ).

Former Member
0 Kudos

HI,

I just wanted different ways.not coding.Thank for all your help.

Thanks

Dinesh90

Former Member
0 Kudos
  • create local data variable to access context information

Data: context_node type ref to if_wd_context_node.

Data: it_scarr type STANDARD TABLE OF if_view1=>element_CARRIERS,

wa_scarr like line of it_scarr.

DATA: index type i.

context_node = wd_context->get_child_node( name = 'CARRIERS').

refresh: it_scarr.

  • Get data contained within ABAP web dynpro table

context_node->get_static_attributes_table(

importing

table = it_scarr ).

  • Get data contained in a Specific row of an ABAP web dynpro table

index = 3. "Get row 3

context_node->GET_STATIC_ATTRIBUTES(

exporting index = index

importing STATIC_ATTRIBUTES = wa_scarr ).

*to save in context

LO_EL_ANS->SET_ATTRIBUTE(

EXPORTING

NAME = `PWD`

VALUE = it_scarr).

former_member199125
Active Contributor
0 Kudos

Getting the data from database table is always using select statemet, the question how & where u will call the select statement like using RFC? or In methods & classes(24).

i prefer to write the database operation in methods( se24) then call those methods in ur wddoint method or in button action..

once you get the data, if the node structure and internal table structure both are same then you can use bind_table( ) method.

lo_nd_nodename->bind_table( new_items = it_Data ).

Regards

Srinivas

Former Member
0 Kudos

Hi,

First fetch the data from your database table to your internal table, then using the method BIND_TABLE of

IF_WD_CONTEXT_NODE you can pass the data to the node and i think you can also use bind_elements or

Bind_structure to set the data of the node.