cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a Z BADI

Former Member
0 Kudos

HI Experts,

I have sucessfully created a Z badi, now i want to call that badi in my zprogram... can any one of you send me sample code to execute this badi from a z program

Thanks

sam

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Created a Z event and called the Zbadi

martin_nooteboom
Active Contributor
0 Kudos

What do you mean by 'created a Z Badi'? Do you mean you implemented a Badi? Why would you want to call a Badi from a z-program? But if you really want to, it is the same as calling a method from a class.

Regards,

Martin

Former Member
0 Kudos

Hi,

What martin says is right? Why would you want a z badi? a z badi is no better than a z function module...unless you are practicing it.

Anyway, in my example -

if_ex_bbp_ctr_be_create - is the interface of the badi

BBP_CTR_BE_CREATE is the badi name

If you can mention specifically what you have done and what your problem is then I would be able to give a better answer.

Regards

Saravanan.

Please, award if useful

Former Member
0 Kudos

Hi,

Still i am not able to execute my Z badi..

can you please me bit specific about this as i am new to SRM

Thanks

sam

Former Member
0 Kudos

You can check this -


  CONSTANTS:
    lc_ctr_badi              TYPE exit_def VALUE 'BBP_CTR_BE_CREATE'.
  STATICS:
* BADI declarations
    sv_exit                  TYPE REF TO if_ex_bbp_ctr_be_create,
    sv_checked               TYPE xfeld,
    sv_badi_active           TYPE xfeld.

        CALL METHOD cl_exithandler=>get_instance
          EXPORTING
            exit_name              = lc_ctr_badi
            null_instance_accepted = gc_yes
          IMPORTING
            act_imp_existing       = sv_badi_active
          CHANGING
            instance               = sv_exit.


      IF NOT sv_badi_active IS INITIAL.
* BADI is active
* now call the BADI
        CALL METHOD sv_exit->contract_interface_fill
          EXPORTING
            iv_src_guid       = iv_src_guid
            iv_logical_system = iv_logical_system
            is_pdext_header   = is_header
            it_pdext_items    = it_items
            it_pdext_org_data = it_org_data
            it_pdext_text     = it_text
            it_pdext_partner  = it_partner
            it_pd_status      = it_status
            it_dist           = it_dist
            it_tol            = it_tol
            it_attach         = it_attach        
          CHANGING
            cv_user           = lv_user
            cv_langu          = lv_langu
.....

Regards

Saravanan.

Please award if useful