cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass event name from one component to another component

Former Member
0 Kudos

Hi,

i am calling activty creation componnet (bt126h_appt)  from activity closed list component (bp_bpbt) overview page.

here i am calling multiple configurations of bt126h_appt based on my selection buttons on bp_bpbt.

creation page is coming, but always it is coming same configuration, becuase i couldn't find which button clicked when my configuration changing in do_config_determination() of bt126h_appt.

here in bp_bpbt component when i am clicking on button i can read that event name into lv_variable. but i don't know how to pass this event name to other component.

someone suggested me creating valuenode in both components and pass the value, i don't know the procedure.

can anybody help me on this,

Thanks,

Neelam

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Neelam,

  If you want to use value node follow below steps

  • Create value node in compoent controller of bt126h_appt and bp_bpbt components with one attribue( for event name).
  • Go to runtime repository of BP_BPBT and add your component controler context node as

         interface.

  • In WD_INITIALIZE method of BT126H_APPT component controller bind both context node.

          CASE

               iv_usage->usage_name.
               
WHEN 'CU_BP_BPBT'.  

         
CALL METHOD iv_usage->bind_context_node
           
EXPORTING
              iv_controller_type 
= cl_bsp_wd_controller=>co_type_component
              iv_target_node_name
= 'XXX'  BP_BPBT context node
              iv_node_2_bind     
= 'YYY'. "BT126H_APPT Context node

         ENDCASE.

Regards

Rajarama U

   

Former Member
0 Kudos

Hi Rajarama,

Thanks for your reply,

i try to create value node under component controller context, but component controller not yet enhanced...

so first do i need to enhance it ?

Thanks,

Neelam

Former Member
0 Kudos

Hi Neelam,

  Yes.You need to enhance component controler of both  BT126H_APPT and BP_BPBT.

Regards

Rajarama U

Former Member
0 Kudos

Hi Rajarama,

i have created value node in both components,

now i don't know how to add comp.controller context under comp.interface in runtimerepository...can you explain little more.

Thanks,

Neelam

Former Member
0 Kudos

Hi Neelam,

  • Goto Runtime Repository Editor
  • Expand ComponentInterface--> InterfaceController
  • Right Click on Context and add your context node

Regards

Rajarama U

Former Member
0 Kudos

Hi Rajarama,

Thanks, now i added the context node under comp.interface,

one more doubt, i am reading the event name ex:- button1 under on_new1() method. now i need to pass this value 'button1' to other component(bt126h_appt)) thru this value node of component bp_bpbt.

i have created one global varialble GV_VAR type string under view IMPL class in BP_BPBT.

i am passing this event name 'button1' to gv_var.

now inside the value node attribute get_button()

i am assigning this gv_var to value.

pls correct me if my approach is wrong.

Thanks,

Neelam

Former Member
0 Kudos

Hi Neelam,

  Now you need to fill your context node collection.

  Suppose you are taking the name of the event on click of the button,then you need set your value node collection in this method.Refer below code

   DATA  lr_struct_ref    TYPE REF TO ls_button. "Structure of your context node

   DATA  lv_struct    TYPE  ls_button.""Structure of your context node

   DATA lr_value_node    TYPE REF TO cl_bsp_wd_value_node.  

  

   CREATE DATA lr_struct_ref.

   CREATE OBJECT lr_value_node

     EXPORTING

       iv_data_ref = lr_struct_ref.

   lv_struct-lv_botton = 'BUTTON_A'.

   lr_value_node->if_bol_bo_property_access~set_properties( lv_struct ).

  lr_coco->typed_context-><CONTEXT_NODE_NAME>->collection_wrapper->clear( ).

  lr_coco->typed_context-><CONTEXT_NODE_NAME>->collection_wrapper->add( lr_value_node ).

Regards

Rajarama U

Former Member
0 Kudos

Hi Rajarama,

Thanks for your reply,

yes i have 2 buttons inside gt_button () method of IMPL class.

(1NEW, 2NEW)

my value node name under comp.context node is  'BUTTONNAME' under this i have created only one attribute as BUTTON type char20.

i copied your code inside of this get_BUTTON() of value node attribute.

but i am getting below error. 

type "LS_BUTTON" is unknown 

can you help me where it is wrong.

Thanks,

Neelam

Former Member
0 Kudos

Hi Neelam,

  •   I belive you are having two events for 2 buttons 1NEW and 2NEW.
  • When clicking on 1NEW button,you need to set Value node value as 1NEW,and while clicking on 2NEW button you need to set value node as 2NEW. for this

        First go to event of 1NEW button and write code which is shown below.

        TYPES: BEGIN OF str_button,

           BUTTON TYPE char20,

        END OF str_button.

        DATA  lr_struct_ref    TYPE REF TOstr_button. "Structure of your context node

        DATA  ls_struct    TYPE  str_button.""Structure of your context node

        DATA lr_value_node    TYPE REF TO cl_bsp_wd_value_node.  

  

        CREATE DATA lr_struct_ref.

        CREATE OBJECT lr_value_node

          EXPORTING

            iv_data_ref = lr_struct_ref.

        ls_struct-BUTTON = '1NEW'.

        lr_value_node->if_bol_bo_property_access~set_properties( ls_struct ).

             "Get the reference of component controller ( lr_coco )"

       lr_coco->typed_context->BUTTONNAME->collection_wrapper->clear( ).

       lr_coco->typed_context->BUTTONNAME->collection_wrapper->add( lr_value_node ).

  • Paste same code in event of 2NEW button also ,just replace the value

           ls_struct-BUTTON = '2NEW'.

Regards

Rajarama U

Former Member
0 Kudos

Hi Rajarama,

Thanks for your code,

i have copied iniside my 1new button event

to get the reference of the comp.controller below lines i added

data: lr_coco type ref to ZL_BP_BPBT_BSPWDCOMPONENT_IMPL.

lr_coco ?= me->comp_controller.

and i added below two lines as you suggested.

       lr_coco->typed_context->BUTTONNAME->collection_wrapper->clear( ).

       lr_coco->typed_context->BUTTONNAME->collection_wrapper->add( lr_value_node ).

i am getting error says.... BUTTONNAME is unknown. but there is a field with the similer name "BUTTON_SAVE".

actually i created value node with name BUTTONNAME is available,   but BUTTON_SAVE also  available but it is in grey color.

anything wrong when creation of value node?

Thanks,

Neelam

Former Member
0 Kudos

Hi Rajarama,

below data element i have taken when i created 'BUTTON' attribute under BUTTONNAME value node...

" /BCV/FND_NAMESPACE "

Thanks,

Neelam

Former Member
0 Kudos

Hi Rajarama,

below data element i have taken when i created 'BUTTON' attribute under BUTTONNAME value node...

" /BCV/FND_NAMESPACE "

Thanks,

Neelam

Former Member
0 Kudos

Hi Neelam,

You need to provide the Value Node name that you have created and not the Attribute Name.

Regards

Rajarama U

Former Member
0 Kudos

Hi Rajarama,

i have given value node name only...i have not provide attribute name

valuenode name :    BUTTONNAME

inside value node name attribute is : BUTTON

Thanks,

Neelam

Former Member
0 Kudos

Hi Rajarama,

while creating value node is it mandatory to give the link for custom controller in wizard ?

i have not given any input in that step.

Thanks,

Neelam

Former Member
0 Kudos

Hi Neelam,

No, It is not mandatory.I am wondering y ur getting the error.

Regards

Rajarama U.

Former Member
0 Kudos

Hi Rajarama,

i found that ....when i am checking the comp.interface....there under context this context node BUTTONNAME is showing as Model node, BUTTONSAVE is showing as value node.

if i see under component controller context....BUTTONNAME is showing value node icon,

one more thing what i observed is there is already context class cn00 is available for partner context node for this component controller.

for BUTTONNAME context node class also ends with CN00 showing....

is it the problem ???

pls help me on this.

Regards,

Neelam

Former Member
0 Kudos

Hi Neelam,

I don't think these are the problems.

Regards

Rajarama U

Former Member
0 Kudos

Hi Rajarama,

is there any binding required for this BUTTONNAME context node of component controller ?

Regards,

Neelam

Former Member
0 Kudos

Hi Neelam,

Binding is required to share data between one component to another. We are doing same in WD_INITIALIZE method.

Regards

Rajarama U

Former Member
0 Kudos

Hi Rajarama,

i got the value of my event in comp.b by exporting it into memory variable, then i am importing in required place, now compo.controller value node is not required.

Thanks,

Neelam

Former Member
0 Kudos

Nice, continue.

Regards

Rajarama U