Skip to Content
avatar image
Former Member

Calling a Z BADI

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jun 14, 2008 at 08:56 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2008 at 02:11 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 16, 2008 at 02:47 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jan 03, 2011 at 06:51 AM

    Created a Z event and called the Zbadi

    Add comment
    10|10000 characters needed characters exceeded