Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting reference to if_ex_cewb_tsk_update

Raxph
Participant
0 Kudos
365

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

4 REPLIES 4

FredericGirod
Active Contributor
0 Kudos
319

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

raymond_giuseppi
Active Contributor
0 Kudos
319
Perform some search on implement a BAdI
  • First call transaction SE19 and create an implementation of the BAdI CEWB_TSK_UPDATE in your namespace (e.g. Z_CEWB_TSK_UPDATE) This will create an implementing class (e.g. ZCL_IM__CEWB_TSK_UPDATE)
  • Within this class you will code the method IF_EX_CEWB_TSK_UPDATE~CHECK_TSK_AT_SAVE implementation.
  • Then activate class and implementation

raymond_giuseppi
Active Contributor
0 Kudos
319

Are you actually trying to call a BAdI method from a customer code ?

  • The reference to this BAdI instance will be provided by standard code (e.g. CP_CC_P_PROVIDE_REF_TO_BADI) but the standard program will execute this, not your code.
  • You have to implement the BAdI from SE19

Or explain what you're trying to obtain?

Peter-Severin
Newcomer
0 Kudos
212

I have activated this funktion and I am doing my error handling when CEWB data got saved. But how can I get information about selected item that I want to change and for which I don't want error handling? For ex. in table I_OPR_DATA . There is no indicator telling me which item got locked for change.