cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the internal table filled in one web dynpro component into other component?

Former Member
0 Kudos

Hi experts,

I have one scenario, in which i need your help. Suppose I have two Web Dynpro components, WD1 (having two views WD1_V1 , WD1_V2) and WD2 (one view WD2_V)

Now, I want to use the internal table (which is already bind to the node of WD1_V2 of WD1) into the WD2_V of WD2, so that I can update the same table  by clicking the button on WD2_V, i.e, the updated table should be reflect in WD1 (Note that, WD2 has similar node as in WD1 to which internal table is bind, by making the node as interface node in WD1)

Do i need to pass this internal table to WD2 ? If yes then how? Or   we can make this internal table as the global one (by declaring as a attribute in the component controller of WD1) and use into WD2? If we can, then how would we do this?

I am new to Web Dynpro and in learning phase. I would be thankful to you, if you can help me out.

Regards,

Shivam

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Shivam,
Mandatory things you need to do at Component 1.

1) The node you want to share should be better create at Component controller level. In your case    

    create a Interface Node in component controller of  Component 1.

2) Populate the data in to this node before you are sharing.

Mandatory things you need to do at Component 2.

1) At the component level of Component 2,  in the Used Components tab, provide the Component 1 

   Name and it's component use name.

2) At the View level of Component 2 , go to properties tab, click on 'create controller usage'  and choose

  Component 1.

3) No need to create any New node here in this View, you can directly refer the node of Component 1.

   This can be done by the following process. Go to Context tab of View of (Component 2). There you

   can find the Interface controller of Component 1. You can find the Node of Component 1 there, Simply

   map the Node from Component 1 context to Context of View (of Component 2).

The data is now available , you can either use the data or display the data by using Table UI element.

No Coding is required here in Component 2,  to populate the Node , as the data is already populated in Node in Component 1.

Hope this helps you to understand clearly.

If required i can share you step by step screen shots.

Regards

RK v

Former Member
0 Kudos

Hi Shivam,

When you r using outbound plug from WD1 where you can declare your internal table and

Transfer the values.

Please find the attached document.

Thanks

Vijay vikram

Former Member
0 Kudos

Hi,

use can use the shared objects to pass data between two components running parallel.

use the link to create and use the shared classes which plays a vital role in data transfer between sessions.

http://wiki.sdn.sap.com/wiki/display/WDABAP/Shared+Objects-+Pass+value+from+ABAP+screen+to+WD+applic...

ronaldo_aparecido
Contributor
0 Kudos

Hi use INTERFACE NODE , CHANGE YOUR CONTEXT AND MARK THE OPTION INTERFACE NODE.

SEE ATTACHED.

THE OTHER PROGRAM CAN SEE YOU CONTEXT.

iN THE OTHER PROGRAM YOU WILL CALL THE OTHER WEB DYNPRO APLICATION

AND IN COMPONENT CONTROLLER YOU WILL CLICK IN BUTTON CONTROLER USAGES TO CALL THE CONTEXT OF OTHER APLICATION

THEN THE COMPONENTS OF OTHER APLICANTION WILL SHOW OF YOU .

THEN YOU WILL MAPED THIS CONTEXTS AND CALL IN YOU CODE.

HOPE HAVE HELPED

Former Member
0 Kudos

Hi Rolando,

Thanks for your reply.

Already tried your solution and the node is visible in the 2nd component either but whatever the internal table bind to this node (in the 1st component, WD1) has not bind to the same node in WD2. (After reading the same node as a table, in Wd2 , I checked in debugging mode)

Is there anything,which I am not aware of or lacking? If yes then, please tell me else suggest me some other solution, if possible.

Best Regards,

Shivam

ronaldo_aparecido
Contributor
0 Kudos

OK,

You tryed save data in transparent table created for you with structure equal of internal table and trasporting data via select?

It´s option.

Former Member
0 Kudos

Hi Ronaldo

Your post clarifies many scenarios, Thanks

ronaldo_aparecido
Contributor
0 Kudos

Ok !! Good!

amy_king
Active Contributor
0 Kudos

Hi Shivam,

Another option beside using an interface node that is shared by the two components is to store the internal table data as an attribute of an assistance class which both components use.

Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

Thanks for your reply.

But as per our scenario, the inputs (lets say material number) which is being taken from user, has been collected in the 1st view (WD1_V1) of 1st component (WD1) and based upon those inputs records are being fetched from certain tables (this logic has been written in the method of assistance class itslef) and collected into one internal table which is bind to the node of WD1_V1.

If we'll use this assistance class in the second component (WD2), then again we have to pass the inputs (as a export parameter to the method of the class) ,i.e., those inputs are not visible in the WD2 and again the question arises, how to pass those inputs into WD2?

Is there any other way, to get our job done?

Best Regards,

Shivam

former_member184578
Active Contributor
0 Kudos

Hi,

Create the node in Component controller of WD1 and make the node Interface node. Then use WD1 in WD2 and you can transfer the data easily.

Check the Component Usage Tutorial here: http://scn.sap.com/docs/DOC-8863

Hope this helps u.,

Regards,

Kiran

Former Member
0 Kudos

Hi Kiran,

By doing so, we would be able to make the node (say ND1) visible in one component (say, WD1) ,though it's defined/created in other component (say, WD2). And yes,if we perform some operation with ND1 in WD1,it will be reflected in WD2 as well (because in WD2, this node is defined as an interface node).

But my scenario is something different, here if we defined the node in WD1 (say Nd2) as interface node and performing certain operation in WD1 only,i.e.,binding any internal table with ND2 . Now i want to use the same internal table in WD2 with the same node (which is not happening ),although ND2 is visible in WD2.

Best Regards,

Shivam

amy_king
Active Contributor
0 Kudos

Hi Shivam,

How did you map the WD1 context node ND_MAT_DTL to the WD2 context? Did you define the node from scratch in WD2 or did you drag-and-drop the node from the WD1 context to the WD2 context? I wonder if maybe it isn't working because you didn't map the WD1 node to WD2 by drag-and-drop.

I'm not sure I see how your scenario is different from a typical interface node scenario. Maybe you could explain more what steps you have done already and what steps you are not able to do.

Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

Yes, I mapped the WD1 node (ND_MAT_DTL) to WD2, by drag and drop only. For your better understanding, i performed below steps :

1) Created node(ND_MAT_DTL, as interface node) in WD1 and bind with one internal table (say,
    itab1) and displayed the contents in the second view (WD1_V2)  of WD1 ,in the alv form.

2) Created node (ND_MAT_PLNT, as interface node) in the WD2 and performed certain operations in
    WD1 and bind another internal table (say, itab2) with node ND_MAT_PLNT. Now ,I am able to
    see the contents of table itab2, with ND_MAT_PLNT in WD2.

3) Now i want to perform, some operations with the ND_MAT_DTL (has to bind with table itab1, in
    WD2),i.e.,to update the content of itab1 and reflect in WD1, which I am not able to do. Although, I
    am able to make the node ND_MAT_DTL visible in WD2.

If some how, I can pass the table itab1 to WD2 then, I can do that. Hope I am clear now.

Regards,

Shivam

amy_king
Active Contributor
0 Kudos

Hi Shivam,

If the WD1 interface node is visible in the WD2 context, you can get the node's static attributes table-- this is the node's "internal table'.

   DATA lo_nd_mat_dtl TYPE REF TO if_wd_context_node.
   DATA lt_data             TYPE wd_this->elements_mat_dtl.

* Get the node from context
   lo_nd_mat_dtl = wd_context->get_child_node( name = wd_this->wdctx_mat_dtl ).

* Get the node's static attributes table
   lo_nd_mat_dtl->get_static_attributes_table( IMPORTING table = lt_data ).

To update the context node after making updates to the internal table, simply bind the updated internal table to the node.

  lo_nd_mat_dtl->bind_table(
     new_items                = lt_data
     set_initial_elements = abap_true

  ).

Cheers,

Amy

Former Member
0 Kudos

Hi Shivam,

Create an event DATA_TRANSFER in the component controller of the second component.

Event Handler for the same will be written in first component.

On Click of the button in second component, fire the event.

wd_comp_controller->fire_data_transfer_evt( ).

In the first component create an event handler.

Refer the attached screenshot.

Regards,

Sanjeev Kotwal.