cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help to Populate data to Table in the View

Former Member
0 Kudos

Hi,

In my Component I have to populate one or two sets of recoords in the table. In my data base table no data. I have to create intenally by using Internal table to populate two sets of records for testing other functions.

I have created the context with the std structure .

how to define the Internal table using the context node and append the data to the internal table and populate to table in the view.

If any guys are having codes pl help me to provide.

thanks in advance.

sri

Accepted Solutions (0)

Answers (1)

Answers (1)

Sm1tje
Active Contributor
0 Kudos

When defining the node with structure of internal table in the context of the component controller, you should define it with cardinality 0..n or 1..n. This case node can have n-records. In the view in which table data must be displayed, you should map the context from the component controller to the context of the view.

Now in a method of the component controller, you can retrieve data from database table, but in your case, you can also simulate the data in a method of the component controller. If you enter the data in the method, it will automatically be part of the view data as well, due to the context mapping.

But before this is the case, you should bind the data from the internal table to the context of the component controller. You do this in the same method in which you fill the data from the internal table. The code for binding the data to the context can be generated almost fully automatically.

Do this by using the code wizard (button with a 'magic' wand) and choose READ CONTEXT. Enter the name of the context node for internal table. The code will give you a method GET_ATTRIBUTE. Change this to SET_ATTRIBUTE and also change the name and value to EXPORTING parameters.

Former Member
0 Kudos

Hi,

Thanks for the reply. In my Component controller I have created a one method called fill_data.and then as per your reply I tried with creation for method the option Read Context (node/Atribute) is diabled.

how to define the internal table and append the two sets of data for display pupose. pl help me

Thanks,

sri

Former Member
0 Kudos

data:

prod_node type ref to IF_COMPONENTCONTROLLER=>Element_ZS_TTT,

itab_node like table of prod_node.

itab_node-mat_ID = '00001'.

append itab_node.

after defining internal table and put the field name and value it is giving error as internal table with occurs define .

pl help me what is the code I have to put for building the data for internal table and bind to table .

thanks in advance

sri

Sm1tje
Active Contributor
0 Kudos

Define the internal table like this:

itab_node type table of ZS_TTT. "If this is the name of the database table which you want to use.

Also create a workarea for the internal table like this:

data: wa_node type ZS_TTT.

wa_node-mat_ID = '00001'.

append wa_node to itab_node.

Former Member
0 Kudos

Hi,

Thanks for the help.

Thanks,

sri

Former Member
0 Kudos

>

>

> Do this by using the code wizard (button with a 'magic' wand) and choose READ CONTEXT. Enter the name of the context node for internal table. The code will give you a method GET_ATTRIBUTE. Change this to SET_ATTRIBUTE and also change the name and value to EXPORTING parameters.

How/where do we do this? I'm not able to find the Code Wizard... please suggest.

Thanks.

Former Member
0 Kudos

The shortcut for the code wizard is Ctrl+F7, and it is placed at left side of pattern button in toolbar. (SE80)