cancel
Showing results for 
Search instead for 
Did you mean: 

Call method on component A from component B

0 Kudos

Hello WDA gurus, I have a problem and I come to you for help, I'm new an WDA and I was not able to solve this by myself. Please help me!!

I create method VALIDATE_TASK_NOTE_CHANGES on COMPONENTCONTROLLER in ‘A’ component, this method has checked the interface flag.

This method calls a view to add a text in a table.

When I call this method from its component it works ok.

But I need to call this method from a ‘B’ component too. To do this I read that I should declare the component as used component in component B. Like this

That’s why the method has the interface flag checked.

I create the interface as used in a window from component B.

Using the code wizard I call the method form component A

method _PST_4S498K4PJS8BQOWPVKM33P1KC . "Exit of ONACTIONBTN_SAVE (in ZIACWPA_GENERAL_SAVE_DPR1 )

DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_FPM_OIF_COMPONENT .
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_justify_screen( ).

lo_interfacecontroller->validate_task_note_changes(
).

endmethod.


When I test it, it sends me next dump, telling me that there’s no active component.

So I instantiate the component using code wizzard.

method _PST_4S498K4PJS8BQOWPVKM33P1KC . "Exit of ONACTIONBTN_SAVE (in ZIACWPA_GENERAL_SAVE_DPR1 )


data lo_cmp_usage type ref to if_wd_component_usage.

lo_cmp_usage =   wd_this->wd_cpuse_justify_screen( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.


DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_FPM_OIF_COMPONENT .
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_justify_screen( ).

lo_interfacecontroller->validate_task_note_changes(
).

endmethod.

And when I test it send me next dump, according with the dump code, this methos was instantiated before, so I don’t understand why happens the previous dump.

This second dump appears logical because the way in which transaction works, here I explain how transaction works

I call a project with some phases and tasks, when a task is closed after the final date is necessary to create a note.

So if I change the status task to completed

The transaction call the method and view ok, the method is triggered with action on_pushed_button the Save button, method and view are in A component.

But if I change the Status to complete and I click on Close button, a new windows appears and ask If I want to save the change, this window is on component B

If I click no or cancel Its not necessary to call the method and view, but if I click Yes the method and view from component A should be called.

Thanks in advance for your time and your help!!!

Edgar

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Edgar,

I think that the problem may be in the place where you are inicializating the component A. Where do you inicialize the component?

Regards

0 Kudos

Hi Saúl

Right now is on ONACTIONBTN_SAVE method.

Regards

Edgar López