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

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

Similar Messages

  • Calling Bapi through BADI gives data statement error

    Dear Experts,
    I am trying to call BAPI through BADI ME_PROCESS_REQ_CUST --> process_item.
    I get an error stating that "The addition OCCURS no longer supported in OO objects"
    If, I remove OCCURS statement I get an error stating that "Tables with headers are no longer supported in OO context" for the following data statement.
    Appreciate, if you could provide possible solution to overcome the problem.
    Regards
    Kumar
    BAPI code is as follows.
    DATA: LV_TABIX LIKE SY-TABIX,
    LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
    LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
    LV_TABIX = SY-TABIX.
    CLEAR: LT_WMDVSX, LT_WMDVEX.
    REFRESH: LT_WMDVSX, LT_WMDVEX.
    Fill communication table
    LT_WMDVSX-REQ_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
    LT_WMDVSX-REQ_QTY = ET_PROCUREMENT_ITEM-QUANTITY.
    APPEND LT_WMDVSX.
    Availability check with check rule '03'
    CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
    EXPORTING
    PLANT = ET_PROCUREMENT_ITEM-PLANT
    MATERIAL = ET_PROCUREMENT_ITEM-MATERIAL
    UNIT = ET_PROCUREMENT_ITEM-UNIT
    CHECK_RULE = '03'
    TABLES
    WMDVSX = LT_WMDVSX
    WMDVEX = LT_WMDVEX
    EXCEPTIONS
    OTHERS = 1.
    IF SY-SUBRC EQ 0.
    READ TABLE LT_WMDVEX WITH KEY
    COM_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
    IF SY-SUBRC EQ 0.
    ET_PROCUREMENT_ITEM-AVAIL_QTY = LT_WMDVEX-COM_QTY.
    ENDIF.
    ENDIF.

    Hi,
    Occurs is no more supported by SAP ( is an obsolete statement )
    <b>Instead of following code</b>
    DATA: LV_TABIX LIKE SY-TABIX,
    LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
    LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
    you can use
    data: LT_WMDVSX type standard table of BAPIWMDVS,
            LT_WMDVEX type standrad table of  BAPIWMDVE,
            LS_WMDVSX like line of LT_WMDVSX ,      "( work area )
            LS_WMDVEX like line of LT_WMDVEX.       "(work area)
    use workarea to get the data and then append the records from workarea to Internal tables
    Reward points if usefull
    Regards,
    Mohan

  • Okay, for a novice (iphone for dummies) what steps to take and in what order to identify specific problem and resolve issue of dropped calls and/or bad connections.  I have a 3g iphone4, I think.  Where is best place to find that information so I can veri

    Okay, for a novice (iphone for dummies) what steps to take and in what order to identify specific problem and resolve issue of dropped calls and/or bad connections.  I have a 3g iphone4, I think.  Where is best place to find that information so I can verify.  

    You can call your wireless provider and talk to them about it.
    You can restart your iphone, reset, your iphone and restore your iphone.

  • Call R/3 BADI from CRM without XI

    Hello Experts,
    I have to implement some BADIs in R/3 which will get executed through CRM.
    What are the various options of calling the BADI in R/3 from CRM? The BADIs are used for sales order processing, invoicing, etc....
    Thanks
    Ricky

    I could suggest u with XI
    1. Direct RFC call using RFC adapter
    2. Expose RFC as webservice and use SOAP adapter
    3. Use ABAP proxy to call RFC
    Without XI: CRM would be a better place to search for the ans
    Regards,
    Parteek

  • Call R/3 BADI from CRM

    Hello Experts,
    I have to implement some BADIs in R/3 which will get executed through CRM.
    What are the various options of calling the BADI in R/3 from CRM? The BADIs are used for sales order processing, invoicing, etc....
    Thanks
    Ricky

    Hi Ricky,
       It is might not possible to call BADI R/3 from CRM or CRM from R/3.
       This is possible in case of only RFC enabled FM.
       Could you provide information realated to your problem, so that one could guide you properly.
    Regards,
    Amit R.

  • Call R/3 BADIs from CRM

    Hello Experts,
    I have to implement some BADIs in R/3 which will get executed through CRM.
    What are the various options of calling the BADI in R/3 from CRM? The BADIs are used for sales order processing, invoicing, etc....
    Thanks
    Ricky

    Hi Ricky,
    You may build a RFC enabled function module in R/3 and can call the same from CRM Badi's. If want to code a R/3 badi which would be enabled in normal order processing or invoicing process, then you don't have to put effort figuring out how to enable or call it from CRM, as it would be called as a part of normal processing once document is in R/3.
    Best Regards,
    Pratik Patel
    <b>Reward with Points!</b>

  • RFC call from Delphi (Bad Variant Type error)

    Well, I'm trying to call an RFC function from Delphi via ActiveX objects..
    I have Codegear 2009 installed and it works without any problem..
    But on another system with Delphi7 installed when I ran same code it gives "Bad Variant Type" error when assigning SapLogonControl's connection object to SapFunction's connection parameter... Both computers have same SAP installation. And on both systems ActiveX objects imported correctly on Delphi.
    Here is the code:
    unit logon1;
    interface
    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    ExtCtrls, OleCtrls, StdCtrls, SAPFunctionsOCX_TLB,
    Grids, SAPLogonCtrl_TLB;
    type
      TForm1 = class(TForm)
      SAPFunctions1: TSAPFunctions;
      Button2: TButton;
      Grid: TStringGrid;
      Edit1: TEdit;
      Edit2: TEdit;
      Label1: TLabel;
      Label2: TLabel;
      SAPLogonControl1: TSAPLogonControl;
    procedure Button2Click(Sender: TObject);
    private
    { Private-Deklarationen }
    public
    { Public-Deklarationen }
    end;
    var
    Form1 : TForm1 ;
    Table, Funct, Connection : VARIANT ;
    implementation
    {$R *.DFM}
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      Connection                  := SAPLogoncontrol1.newConnection;
      Connection.User             := 'testuser';
      Connection.System           := 'CRD';
      Connection.Client           := '300';
      Connection.ApplicationServer:= '10.1.1.10';
      Connection.SystemNumber     := '00';
      Connection.Password         := 'testpass';
      Connection.Language         := 'EN' ;
      if Connection.LogOn(0,true) = true then
      (* parameter "true" = SilentLogOn *)
      begin
        (* assign the existing connection to the *)
        (* component SAPFunctions1                *)
        SAPFunctions1.Connection := Connection; // It gives error on this line...
        Funct := SAPFunctions1.add('ZGIS_TEST_FUNC');
      end;
    end;
    end.
    As I said while Codegear 2009 runs this code without any problem, Delphi 7 crashes on that assignment.. Also I tried outside Delphi, and the file compiled with Codegear works on both systems while the file compiled with Delphi 7 again crashes on buth systems...
    Is there a problem with Delphi 7? Should I use at least Delphi 8 or something for compiling?

    Hi Hakan,
    You must use Non-Unicode RFC library for Delphi 7.0.
    ( Bende Delphi 7.0 kullaniyorum. Ayni hatayi aldim. Unicode library kullanmistim. Kaldirip Non-Unicode olani kullandim. Su an hata yok. RFC cagirabiliyorum. )
    Mustafa Yalcin

  • How to identify that the call to a BAdI is coming from SAPGUI

    Hi All,
    In the current project involving SAPCRM 5.0 (both GUI and PCUI), we need to display a pop-up asking the user whether he would like to go ahead with the changes in both GUI and PCUI.
    The function module 'Popup-to-confirm'  was used in a BAdI implementation and it worked fine in GUI but caused problems in PCUI. So this code was commented out as of now.
    Could you let me know as to how should we differentiate the call being placed to a BAdI is from GUI or from PCUI so that we could ensure that the pop-up gets displaced in GUI atleast as of now and does not get populated/cause errors in PCUI as of now?
    Else please let me know what is the correct way of displaying a pop-up in both GUI and PCUI in CRM 5.0?
    Thanks,
    Ravi Kiran

    Hello All,
    I am moving this to another forum as I accidentally put it in this category.
    Thanks,
    Ravi Kiran

  • Sequence of classes called in a badi

    Hi guys,
    I have a problem on the sequence of the classes called in a standard BADI occuring in different system.
    In the DEV system, the sequence called is A, B, C (Just to illustrate). But, in the QA and PROD system, the sequence called is B, C, A. Versions of each objects have been compared and found to be the same.
    Any ideas how to solve this?
    Thanks!

    Hi guys,
    I have a problem on the sequence of the classes called in a standard BADI occuring in different system.
    In the DEV system, the sequence called is A, B, C (Just to illustrate). But, in the QA and PROD system, the sequence called is B, C, A. Versions of each objects have been compared and found to be the same.
    Any ideas how to solve this?
    Thanks!

  • Problem with BAPI_PO_CHANGE when called within ME_PURCHDOC_POSTED BADI Implementation

    Hi All,
    We have a situation where PR to PO conversion needs to happen through a custom program which submits ME59N in batches. During this conversion, it's a business requirement to update the PO's GS Partner function based on the manufacturer in the first item's inforecord.
    In order to do this, we have implemented the badi "ME_PURCHDOC_POSTED". The only method within this is "POSTED"
    In order to update the PO, I use "BAPI_PO_CHANGE" inside this badi with IN BACKGROUND TASK addition. The reason behind this is that this BADI is called before the commit that creates the PO happens. And by calling the BAPI_PO_CHANGE in a background task, I ensure that it's run after the commit has happened.
    This approach works extremely well, but fails in certain scenarios when executed for large PR to PO conversion where certain PRs exceed 300 line items.
    Since the background task call cannot be debugged, I used the enjoy bapi_po_change exit EXIT_SAPL2012_004 to dump the return table to a custom table or the application log, to check what has happened.
    In the instances that this has failed, the return table's content was -> function "change purchase order" performed in test
    I assure you I have NOT used the test flag. I even applied a couple of SAP notes that mention this issue, but still had no success. I am waiting for a proper response from OSS at the moment but this is a real headscratcher.
    Also importantly at this point, the PO was successfully created.So the partner function change should happen without issues  :'(
    Have any of you come across this issue before ? What steps have you taken to overcome this issue ?
    Regards,
    Tharindu

    Hi All,
    We have a situation where PR to PO conversion needs to happen through a custom program which submits ME59N in batches. During this conversion, it's a business requirement to update the PO's GS Partner function based on the manufacturer in the first item's inforecord.
    In order to do this, we have implemented the badi "ME_PURCHDOC_POSTED". The only method within this is "POSTED"
    In order to update the PO, I use "BAPI_PO_CHANGE" inside this badi with IN BACKGROUND TASK addition. The reason behind this is that this BADI is called before the commit that creates the PO happens. And by calling the BAPI_PO_CHANGE in a background task, I ensure that it's run after the commit has happened.
    This approach works extremely well, but fails in certain scenarios when executed for large PR to PO conversion where certain PRs exceed 300 line items.
    Since the background task call cannot be debugged, I used the enjoy bapi_po_change exit EXIT_SAPL2012_004 to dump the return table to a custom table or the application log, to check what has happened.
    In the instances that this has failed, the return table's content was -> function "change purchase order" performed in test
    I assure you I have NOT used the test flag. I even applied a couple of SAP notes that mention this issue, but still had no success. I am waiting for a proper response from OSS at the moment but this is a real headscratcher.
    Also importantly at this point, the PO was successfully created.So the partner function change should happen without issues  :'(
    Have any of you come across this issue before ? What steps have you taken to overcome this issue ?
    Regards,
    Tharindu

  • Call of a BADI method inside another BADI

    Dear colleagues,
    Could someone guide me with the information whether it is allowed to create/call  a Badi inside an implementation of another Badi method?
    Please let me know whether there are other alternatives or the Badi call within Badi acceptable as per SAP standards?
    Many thanks in advance,
    Best regards,
    Srivatsa

    hi Ganesh,
    Check this out
    <b>Calling a BADI from another BADI</b>
    Regards,
    Santosh

  • Call BSP from BAdI

    Hi all,
    We are implementing a BAdI and want to launch a browser calling our own BSP (we have developped a new application). Could you please tell me if there is any FM or class which allows this?
    Thanks in advance
    Pablo

    Hello Pcui Experts,
    i didn't find a solution in this forum to manage this simple request : open a url/internet page (eg google) from a button event or any pcui event.
    It seems that the abap function CALL_BROWSER need a sapgui context / or an ITS server (not my case). Also, i can't manage this little development using a BSP.
    Does someone has any idea ?
    M. Markus H.

  • CRM  Call List Save BADI / Enhancement Point

    Hi
    I need to perform some validations on Call List Save using TX CRMD_TM_CLDIST . I searched for a BADI which gets called when the call list is saved but could not find one .
    Has anyone worked on a BADI which gets called when a call list is modified ?
    Regards
    Ajitabh

    Hi
    In the call list application there are individual operations some of which require a save and some do not for eg adding a user to the assignment block of a call list does not require a save button .
    For this operation class CL_TM_CLM_ASSIGNMENT is used by the standard.
    SAP has provided implicit enhancement points in each of the methods of this classs .These methods handle the individual operations for eg deleting an assignment,adding an assignment etc.
    To identify the classes we did a trace of the operation(adding a new assignment,deleting an assignment etc etc). From the ST05 traces we identified the classes which were performing the various operations and then implemented the implicit enhancements in these methods to do our processing.
    Hope this helps....
    Ajitabh

  • Every 4th or 5th call: terrible audio, bad connection

    The whole time I've owned my phone, I've had a persistent issue that I've simply dealt with, but it's becoming more and more irritating.
    About every 5th call or so -- incoming or outgoing, doesn't matter -- my connection is unusably bad. Crackling, static-filled audio and white noise fill the line for both people. If I hang up and one person calls the other back immediately, the problem's cleared up.
    Why is this? Anyone else get this issue? I'm assuming it's an AT&T problem; I've never had this with any other cell phone.

    Bump? I guess posting late at night gets me buried.

  • Call BAPI in BADI 'MB_DOCUMENT_BADI'

    Hi all,
    How can i call a BAPI in MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE ? I wrote code below but got  "GOODSMVT_CODE" is the correct type, its length is incorrect." error.
      DATA:
            goodsmvt_header       TYPE TABLE OF  bapi2017_gm_head_01,
            goodsmvt_code         TYPE TABLE OF  bapi2017_gm_code,
            goodsmvt_headret      TYPE TABLE OF  bapi2017_gm_head_ret,
            matdocumentyear       TYPE  bapi2017_gm_head_ret-doc_year,
            goodsmvt_item         TYPE TABLE OF  bapi2017_gm_item_create, " OCCURS 0 WITH HEADER LINE,
            goodsmvt_serialnumber TYPE TABLE OF  bapi2017_gm_serialnumber. " OCCURS 0.
        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
          EXPORTING
            goodsmvt_header  = goodsmvt_header
            goodsmvt_code    = goodsmvt_code
            testrun          = ''
          IMPORTING
            goodsmvt_headret = goodsmvt_headret
            materialdocument = materialdocument
            matdocumentyear  = matdocumentyear
          TABLES
            goodsmvt_item    = goodsmvt_item
            return           = messages.
    Best regards,
    Munur

    Hi,
      I think field GOODSMVT_CODE is not table type, you mension it type table of 'BAPI2017_GM_CODE'.
    Thanks,
    Anmol.

Maybe you are looking for

  • Follow up email creates a interaction record in business context area

    Hi experts, We have just upgraded system to 7.0. here we are facing a problem when we create a service order and save it.then we go to inbox and search for the service order->create afollow up activity->go to the action and send a follow up email. No

  • Multiple of the same iTunes library appearing in Apple TV

    Since I up dated my macbook air (13" Mid 2011) to the developer preview of Yosemite, my iTunes library on apple tv appears twice, some times as many as four times. None of them will connect properly. They usually time out with the standard error ' Co

  • Creating simple shared library using gcc under Solaris 10

    Hi All: I apologize if this is too newbie a question but have seen nothing that works for me yet. I'm trying to create a shared library that contains a single object file using gcc (as installed on Solaris 10). I compiled the source code as follows:

  • Users cannot see XServe after an undetermined time

    I have an office with an Xserve G5 with OS X Server 10.5.5 and 10 PowerMac G5 clients with OS X 10.5.5 The Xserve does nothing special except offer and FTP server and share files among the office... each user gets to the server via the left and Finde

  • Where to buy new fan?

    I just bought a new hard drive 7200 rpm 500gb install went fine, but the computer is overheating and Im wondering if there is a place to buy a new fan? It is a 13 inch macbook pro