‎2010 Nov 29 4:12 PM
Can we write the method constructor for a BADI implementation class?
‎2010 Nov 29 4:22 PM
‎2010 Nov 29 4:22 PM
‎2010 Nov 29 6:14 PM
My requirement is to write a seperate prg (with no selection screen) for doing a batch job. So I was trying this peice of code :-
REPORT zur_eng_masterdelete.
*DATA: g_report TYPE REF TO ZCL_IM_IMPL_ENG_CHG.
CREATE OBJECT g_report
EXPORTING
if_repid = sy-repid .
IF g_report ->auth_check( ) = 'X'.
CALL METHOD g_report ->get_data( ).
ENDIF.
when I try to activate this code, it said the class has no constructor defined.
‎2010 Nov 29 7:09 PM
Hi
*DATA: g_report TYPE REF TO ZCL_IM_IMPL_ENG_CHG.
CREATE OBJECT g_report
EXPORTING
if_repid = sy-repid .I don't know the class ZCL_IM_IMPL_ENG_CHG, and I don't know which interface is the base for that class.
Anyway if some data is transfered while the object is being created, it means the class of the object has to have a constructor method.
Now the question is why you create the object by the following code?
CREATE OBJECT g_report
EXPORTING
if_repid = sy-repid .Max
‎2010 Nov 29 11:33 PM
Howdy,
You could just split it into two calls by creating a method eg set_syrepid on the badi implementing class:
create object g_report.
g_report->set_syrepid( exporting i_repid = sy-repid ).
" Do the rest of the code
Edit: Having said that, it's just as easy to create a constructor on the implementing class.
Cheers
Alex