Application Development and Automation 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: 
Read only

Home grown BAdI (Enhancement Spot) - Method "SEND_MESSAGE" is unknown or PROTECTED or PRIVATE

rosenberg_eitan
Active Contributor
0 Kudos
1,040

Hi,

I am trying to create home grown BAdI .

Using SE18 I created:

Enhancement Spot: Y_EITAN_ENHANCEMENT_SPOT_01 .
Enhancement implementation: Y_ENHANCEMENT_IMP_01
Interface for a BAdI: Y_EITAN_BADI_01_INT
BAdI Definition: Y_EITAN_BADI_01
BadI Implementation: Y_EITAN_BADI_01_IMP_01
Implementing Class: Y_EITAN_BADI_01_IMP_01

Screens:

No problem so far....

I created a test program Y_R_EITAN_TEST_51_18 .

*----------------------------------------------------------------------*
FORM test_02 .

  DATA: ob_y_eitan_badi_01 TYPE REF TO y_eitan_badi_01 .

  GET BADI ob_y_eitan_badi_01 .

* Does not compile....
* Complain about: Method "SEND_MESSAGE" is unknown or PROTECTED or PRIVATE


  CALL METHOD ob_y_eitan_badi_01->send_message
    EXPORTING
      message = 'Hi there from test 02 .'.

  BREAK-POINT .

ENDFORM .                                                   "test_02
*----------------------------------------------------------------------*

I get this syntax message: Method "SEND_MESSAGE" is unknown or PROTECTED or PRIVATE

To verify that method "send_message" is public I have created this piece of code and it is

compiling and working with no problem.

As you can see I am using the interface and the class from the BadI .

*----------------------------------------------------------------------*
FORM test_01 .

* A class that implement Y_EITAN_BADI_01_INT interface
  DATA: ob_y_eitan_badi_01_imp_01 TYPE REF TO y_eitan_badi_01_imp_01 .

  CREATE OBJECT ob_y_eitan_badi_01_imp_01 .

* Interface
  DATA: ob_y_eitan_badi_01_int TYPE REF TO y_eitan_badi_01_int .

  ob_y_eitan_badi_01_int ?= ob_y_eitan_badi_01_imp_01 .

  CALL METHOD ob_y_eitan_badi_01_int->send_message
    EXPORTING
      message = 'Hi there from test 01 .'.

ENDFORM .                                                   "test_01

*----------------------------------------------------------------------*

Am I missing somthing here ?

Regards.

1 ACCEPTED SOLUTION
Read only

ChristianGnter
Contributor
0 Kudos
871

Hi Eitan,

you have to do a CALL BADI instead of CALL METHOD.

CALL BADI ob_y_eitan_badi_01->send_message

    EXPORTING

      message = 'Hi there from test 02 .

Regards

Christian

4 REPLIES 4
Read only

former_member195402
Active Contributor
0 Kudos
871

Hi Eitan,

please check your implementing class. Method should be Public.

Regards,

Klaus

Read only

0 Kudos
871

Hi,

Thanks for the prompt replay.

The method is a result of an interface.

As you can see that it is gray out in even in edit mode.

Here it is:

Thanks.

Read only

ChristianGnter
Contributor
0 Kudos
872

Hi Eitan,

you have to do a CALL BADI instead of CALL METHOD.

CALL BADI ob_y_eitan_badi_01->send_message

    EXPORTING

      message = 'Hi there from test 02 .

Regards

Christian

Read only

0 Kudos
871

Hi,

I am getting old......

Regards.

(I do have 5 grand children's....)