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: 

how to pass import/export parameters while event handler call in OOABAP?

former_member220941
Participant
0 Kudos

Hi Experts,

Is it possible to use export parameter in set handler method?

Actually my requirement is while creating customer through XD01 after committing to data base i want that customer.

So i exporting  customer no. in one of the badi before commit  and importing in my custom class (zabc) after commit.

Using event TRANSACTION_FINISHED and checking KIND eq C.

My question is instead of using import export abap command  is it possible to pass those parameters in ??


Sample : SET HANDLER zcl_sd_after_commit=>get_kunnr.

Regards,

Raj....

3 REPLIES 3

Former Member
0 Kudos

Hi

Which BADI?

Max

0 Kudos

Max,

I am using this BADI which triggers before commit...

CUSTOMER_ADD_DATA

Regards,

Raj..

0 Kudos

Yes it can

but the event should be defined in the BADI so why do you need to do it?


CLASS MY_CLASS_1 DEFINITION FINAL.

   PUBLIC SECTION.

     METHODS GET_KUNNR IMPORTING KUNNR TYPE KUNNR.

     EVENTS MY_EVENT EXPORTING VALUE(KUNNR) TYPE KUNNR.

ENDCLASS.

CLASS MY_CLASS_2 DEFINITION FINAL.

   PUBLIC SECTION.

     METHODS MY_METHOD FOR EVENT MY_EVENT OF MY_CLASS_1

        IMPORTING KUNNR.

ENDCLASS.


CLASS MY_CLASS_1 IMPLEMENTATION.

   METHOD GET_KUNNR.

     RAISE EVENT MY_EVENT EXPORTING KUNNR = KUNNR.

   ENDMETHOD.

ENDCLASS.

CLASS MY_CLASS_2 IMPLEMENTATION.

   METHOD MY_METHOD.

     WRITE KUNNR.

   ENDMETHOD.

ENDCLASS.

So it can move KUNNR from class1 to class2


DATA: MY_OBJ_1 TYPE REF TO MY_CLASS_1.

DATA: MY_OBJ_2 TYPE REF TO MY_CLASS_2.

PARAMETERS: P_KUNNR TYPE KUNNR.

START-OF-SELECTION.

   CREATE OBJECT MY_OBJ_1.

   CREATE OBJECT MY_OBJ_2.

   SET HANDLER MY_OBJ_2->MY_METHOD FOR MY_OBJ_1.

   MY_OBJ_1->GET_KUNNR( P_KUNNR ).