12-23-2022 7:37 AM
Hi together,
I am trying to use the method CHECK_TSK_AT_SAVE of the BadI: CEWB_TSK_UPDATE. Now the code that I have written is:
DATA: lr_ref TYPE REF TO if_ex_cewb_tsk_update,
lt_tsk TYPE STANDARD TABLE OF cpcl_tsk_plko_type.
* CREATE OBJECT lr_ref.
CALL METHOD lr_ref->check_tsk_at_save
EXPORTING
i_tsk_data = lt_tsk
* i_mtk_data =
* i_seq_data =
* i_plas_data =
* i_opr_data =
* i_com_data =
* i_prt_data =
* i_cha_data =
* i_chv_data =
* i_pac_data =
* i_mst_data =
EXCEPTIONS
inconsistency_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
I get the dump: CX_SY_REF_IS_INITIAL, that the interface is not yet initiated, thus we cannot use the method.Can anyone tell me how can I get reference or initiate the lr_ref that I have declared?
Thanks,
R
12-23-2022 7:57 AM
An interface is a contract between a class and the outside, it does not contains code, and it cannot be instanciated.
So, you need an instance of a class using this interface.
It will depends of your code, comment the use of the method, and in debug check what you have in memory (in variable tab, go in LOCAL)
If you check the class CL_EX_CEWB_TSK_UPDATE, you will see it does a deference of an object :
(use the contract of the interface to access the object <flt_cache_line>-obj )
EXITINTF ?= <flt_cache_line>-OBJ.
CALL METHOD EXITINTF->CHECK_TSK_AT_SAVE
12-23-2022 9:54 AM
12-23-2022 1:49 PM
Are you actually trying to call a BAdI method from a customer code ?
Or explain what you're trying to obtain?