cancel
Showing results for 
Search instead for 
Did you mean: 

How can I access Parent_View's data in Child_View and again other way?

former_member194142
Participant
0 Kudos

Hello

I have cretaed Parent_WDC, w/ Parent_View, it has a button

Also created Child_WDC, w/ Child_view

By using the below tutorial i am calling Child_View as a POPUP from Parent_View of Parent_WDC, well.

http://www.saptechnical.com/Tutorials/WebDynproABAP/Popup/Index2.htm

Now, i want to have visibility of context/nodes of Parent_View in Child_View.

I need to do some validations in WDDOINIT, MODIFYVIEW of Child_View, but for that i need Parent_View's data / context

For example, Parent_View's node has a value of 3, i need to pass this 3 to Child's_View's node, here on the Child_View user enters 2, so, i need to add them as 2+3 = 5, finally i need to send the result as 5 to Parent_View's node


Pls. note all the context i defined at COMPONENTCONTROLLER of Parent_WDC

Pls. let me know how can i access Parent_View's data in child_view

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

To access node of one component in another, the Context Node in the component controller must be an 'Interface Node' ( select the property interface node of the context Node). then you can pass data to another component via Interface Controller

Regards,

Kiran

former_member194142
Participant
0 Kudos

Thank you.

Already i have my_asssitance_class is in Parent_WDC

Can i go ahead and use the same my_assistance_class in Child_WDC?

If yes, can i store the nodes data as a CLASS-ATTRIBUTES in Parent_WDC and access in Child_View?

If OK, then i guess, it would be STATIC CLASS-ATTRIBUTES right?

is this approach is OK?

Bcz below how am calling Child_View as POPUP,


      lo_window_1              = lo_window_manager_1->create_and_open_popup(
        window_name          = 'ZCHILD_WDC'
        component_usage_name = 'CM_CON_DATA_ALV'
        message_type                = if_wd_window=>co_msg_type_none
        message_display_mode  = if_wd_window=>co_msg_display_mode_selected
         buttons              = lt_buttons
        cancel_action        = ls_canc_action
    ).

Regards

former_member184578
Active Contributor
0 Kudos

Hi,

Yes, you can use your assistance class with static attribute. Infact no need to add it in assistance class of your child component, you can simple access that attribute using class_name=>attr_name (if it is static public ).

Regards,

Kiran

former_member194142
Participant
0 Kudos

Thank you.

You mean, i need to add my_assistance calss in Child_WDC at all? just keepint it in Parent_WDC is enough?


ramakrishnappa
Active Contributor
0 Kudos

Hi,

As Kiran suggested,  you use assistance class zcl_my_class in Parent_wdc and create static attributes example gv_attr1, gv_attr2.

Before you call pop up window make sure you have filled values in attributes.

Now you can access the vales stored in class attributes inside child_wdc as below.

You can add value......

Zcl_my_class=> gv_attr1 = Zcl_my_class=> gv_attr1 + 1

Hope this helps you. 

Regards,

Rama

former_member184578
Active Contributor
0 Kudos

Hi,

You mean, i need to add my_assistance calss in Child_WDC at all? just keepint it in Parent_WDC is enough?

Yes. You don't have to add the class as assistance class either in Parent component/ Child Component. You can simply access/set the static attribute using class_name=>attr_name.

Regards,

Kiran

former_member194142
Participant
0 Kudos

Thank you.

Last question pls...

I am guessing, every session has its own zcl_my_cl instance right?

I mean, i started running parent_WDC in my PC w/ my ID, i have my own zcl_my_cl instance..........whereas in thesame time you started running the Parent_WDC in your PC w/ ur own ID, then an another your own instance of zcl_my_cl will be created right?

Thank you

ramakrishnappa
Active Contributor
0 Kudos

Yes, you are right.

Each session should have different instance of this class and its attributes.

Regards,

Rama

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Option 1: convert node to 'Interface Node' and access throw events


Option 2: user plug in parameters to transfer data to main view to pop view.


Regards,

Ashok.

former_member194142
Participant
0 Kudos

THank you,

Option 2: user plug in parameters to transfer data to main view to pop view.

Pls. eloborate it, bcz i don't see any PLUGs between MAIN & POPUP

Bcz below how am calling Child_View as POPUP,


      lo_window_1              = lo_window_manager_1->create_and_open_popup(
        window_name          = 'ZCHILD_WDC'
        component_usage_name = 'CM_CON_DATA_ALV'
        message_type                = if_wd_window=>co_msg_type_none
        message_display_mode  = if_wd_window=>co_msg_display_mode_selected
         buttons              = lt_buttons
        cancel_action        = ls_canc_action
    ).

Regards