cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic context and tables

Former Member
0 Kudos

Greetings everyone,

New to WDA world and have some Qs

Required:

I need to create x number of tables (all input ready) in the run time , how many is determined by the user in the previous view, those tables have the same structure , let say like this

Activity Cost1 Cost2 Cost3

Activity1 4 444 444

Activity2 23 55 422

So each table have to have its own context , so also the context creation will be dynamically at run time , here is my problem , how can I create x number of context at run time ??

Can I achieve this by using only 1 context and bind all the table to it , some how ??

This is how I want to see my output

Cost for Org 1

Activity Cost1 Cost2 Cost3

Activity1 4 444 444

Activity2 23 55 422

Cost for Org 2

Activity Cost1 Cost2 Cost3

Activity1 4 444 444

Activity2 23 55 422

u2026u2026u2026.

u2026u2026u2026.

Cost for Org N

Activity Cost1 Cost2 Cost3

Activity1 4 444 444

Activity2 23 55 422

someof my friend mention something about recursion node, but i'm not familiar with that and thus don't know who will i be able to read the different node created for different table ??

Any ideas

Thanks in advance

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi ,

u can refer WIKI :

http://wiki.sdn.sap.com/wiki/display/stage/dynamiclayoutmanipulationinWD+ABAP

u can create nodes dynamically , u create a attribute in Attribute tab of ur view. There is a parameter VIEW in the WDDOMODIFY of ur view , u can create the attribute of that type IF_WD_VIEW

now u can take tht view reference

and can create the dynamic node in the OnAction method of ur button

In order to create a new independent context node a reference to the metadata of the context root node has to be obtained first. This reference is obtained by calling the method

wd_context->get_node_info( ).

Next, the metadata of the new node has to be defined. To create a new node, the method add_new_child_node( )

from the reference to the context root node can be used.

try to search the class with prefix cl_wd .. for ur table

regards,

amit

Former Member
0 Kudos

Thanks Amit for quick respond, i tried that example and it gave me this error when i test the application

Adapter error in &VIEW_ELEMENT_TYPE& "_02" of view "YTESTMMN3.MAIN": LayoutData type "MATRIX_HEAD_DATA" for chile element "DD_12" is not permitted

Former Member
0 Kudos

If you check in St22 then there is a erorr log ...

I guess you might be passing some wrong type of data ..to that method which vaused error..

Or it could be with teh Layout that you are trying to design..

Former Member
0 Kudos

hi Mohammed ,

change the data type for the element to "MATRIX DATA" instead of the "MATRIX HEAD DATA" in the OnAction of your button UI

or wherever u r using it in ur coding .

refer this presentation for dynamic context creation , mapping and data binding

http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/201ddd3b-b4ce-2b10-8883-880ae8147f89&overrid...

cheers:)

regards,

amit

Edited by: amit saini on Dec 23, 2009 5:20 AM

Former Member
0 Kudos

Thanks Amit,

the problem was that the container layout was set to flow layout and i was trying to add matrix data to it , i used cl_wd_flow_data=>new_flow_data instead and it worked fine , now I'm trying to add the attributes to the context , also is it possible to add n number of attributes but not binding all of them to the table ??

Regards

Answers (0)