<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic BADI and BAPI in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110527#M441064</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Could any one tell the process for this BADI&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;2) which BAPI well will use for populating using these transactions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Populated Purchase Order &amp;amp; Purchase Requisition Document number in a custom Z table each time created through ME21N &amp;amp; ME51N by using ME_PURCHDOC_POSTED &amp;amp; ME_REQ_POSTED&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Naren.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Apr 2007 04:36:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-02T04:36:29Z</dc:date>
    <item>
      <title>BADI and BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110527#M441064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Could any one tell the process for this BADI&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;2) which BAPI well will use for populating using these transactions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Populated Purchase Order &amp;amp; Purchase Requisition Document number in a custom Z table each time created through ME21N &amp;amp; ME51N by using ME_PURCHDOC_POSTED &amp;amp; ME_REQ_POSTED&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Naren.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 04:36:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110527#M441064</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T04:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: BADI and BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110528#M441065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Go to Transaction SE19 and implement the BADI ME_PURCHDOC_POSTED  or &lt;/P&gt;&lt;P&gt;ME_REQ_POSTED&lt;/P&gt;&lt;P&gt;by copying it to a ZBADI.&lt;/P&gt;&lt;P&gt;then go to the methods and write the code.&lt;/P&gt;&lt;P&gt;see the sample code of BADI.&lt;/P&gt;&lt;P&gt;BAdI Name: ZCHECK_PO_LINE_ITEM (Implementation name) PO Account assignment&lt;/P&gt;&lt;P&gt;Definition Name: ME_PROCESS_PO_CUST&lt;/P&gt;&lt;P&gt;Interface Name : IF_EX_ME_PROCESS_PO_CUST&lt;/P&gt;&lt;P&gt;Implementing Class: ZCL_IM_BADIN_ACCOUNT_ASSGN&lt;/P&gt;&lt;P&gt;Method :            PROCESS_HEADER&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;METHOD if_ex_me_process_po_cust~process_header .&lt;/P&gt;&lt;P&gt;  DATA : re_data TYPE mepoheader.&lt;/P&gt;&lt;P&gt;*get the item data&lt;/P&gt;&lt;P&gt;  CALL METHOD im_header-&amp;gt;get_data&lt;/P&gt;&lt;P&gt;    RECEIVING&lt;/P&gt;&lt;P&gt;      re_data = re_data.&lt;/P&gt;&lt;P&gt;  re_header = re_data.&lt;/P&gt;&lt;P&gt;  IF ( re_data-bsart NE 'ZOC' AND re_data-bsart NE 'ZPC' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF ( re_data-bsart &amp;lt;&amp;gt; 'ZIC' AND re_data-bsart &amp;lt;&amp;gt; 'UB' ).&lt;/P&gt;&lt;P&gt;      IF re_data-bukrs NE '1001'.&lt;/P&gt;&lt;P&gt;        MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'Use only Sipchem Company'&lt;/P&gt;&lt;P&gt;                                        'Code for External Procurement'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;Method :            PROCESS_ITEM&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;METHOD if_ex_me_process_po_cust~process_item .&lt;/P&gt;&lt;P&gt;  DATA: v_menge TYPE bamng,   " PR Quantity&lt;/P&gt;&lt;P&gt;        v_statu.              " PR Status&lt;/P&gt;&lt;P&gt;  DATA : re_data TYPE  mepoitem,&lt;/P&gt;&lt;P&gt;       re_data1 TYPE mepoaccounting,&lt;/P&gt;&lt;P&gt;re_accountings TYPE purchase_order_accountings ,&lt;/P&gt;&lt;P&gt;header TYPE purchase_order_accounting.&lt;/P&gt;&lt;P&gt;*get the item data&lt;/P&gt;&lt;P&gt;  CALL METHOD im_item-&amp;gt;get_data&lt;/P&gt;&lt;P&gt;    RECEIVING&lt;/P&gt;&lt;P&gt;      re_data = re_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF ( re_header-bsart NE 'ZOC' AND re_header-bsart NE 'ZPC' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF re_header-bsart EQ 'ZRL'.&lt;/P&gt;&lt;P&gt;      IF re_data-konnr EQ space.&lt;/P&gt;&lt;P&gt;        MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You cant create a Release order'&lt;/P&gt;&lt;P&gt;                                                     'without a reference to Outline Agreeement'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; IF ( re_header-bsart NE 'ZOC' AND re_header-bsart NE 'ZPC' ).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF ( re_data-banfn EQ space AND re_data-anfnr EQ space ).&lt;/P&gt;&lt;P&gt;      MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You can create a Purchase order'&lt;/P&gt;&lt;P&gt;                                                     'only with reference to a PR or RFQ'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt; call method IM_ITEM-&amp;gt;GET_ACCOUNTINGS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;   RECEIVING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;     RE_ACCOUNTINGS = RE_ACCOUNTINGS.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;**get the accounting reference variable,this reference is needed to get&lt;/P&gt;&lt;P&gt;**the GL account *number and Asset number&lt;/P&gt;&lt;P&gt;*loop at RE_ACCOUNTINGS into header.&lt;/P&gt;&lt;P&gt;**get the accounting info.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; call method header-ACCOUNTING-&amp;gt;GET_DATA&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   RECEIVING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     re_data = re_data1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;**if the account assignment is K then check for GL account&lt;/P&gt;&lt;P&gt;**if its A then check for Asset number&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; if re_data-KNTTP eq 'K'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   if re_data1-SAKTO IS INITIAL.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     MESSAGE ID 'ZM_MSG'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       TYPE 'E' NUMBER '000' WITH 'Enter G/L account'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ELSEIF re_data-KNTTP eq 'A'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   if re_data1-ANLN1 IS INITIAL.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'Enter Asset Number'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*endloop.&lt;/P&gt;&lt;P&gt;    IF re_data-knttp NE 'K' AND re_data-pstyp NE '9' .&lt;/P&gt;&lt;P&gt;      IF syst-cprog EQ 'RM_MEPO_GUI'.&lt;/P&gt;&lt;P&gt;        IF re_data-uebto IS NOT INITIAL OR&lt;/P&gt;&lt;P&gt;           re_data-uebtk IS NOT INITIAL OR&lt;/P&gt;&lt;P&gt;           re_data-untto IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;          MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You cant change delivery settings'.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Checking  PO quantity with PR Quantity&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; select single statu menge into (v_statu, v_menge) from eban&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   where banfn = re_data-banfn and&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;         bnfpo = re_data-bnfpo.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; if v_statu &amp;lt;&amp;gt; 'B'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   if re_data-menge gt v_menge.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    message e000(zm_msg) with 'You cant create PO exceeding' 'the PR Quantity'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; else.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  MESSAGE e000(ZM_MSG) WITH 'You cant create a PO with reference' 'to Completed PR'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;ANji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 05:00:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110528#M441065</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T05:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: BADI and BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110529#M441066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI for &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;me21n --&amp;gt; BAPI_PO_CREATE.&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;me51n --&amp;gt; BAPI_REQUISITION_CREATE&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check transaction BAPI and check under "Material management --&amp;gt; Purchasing" for more BAPIs related to purchasing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****************************************************************************&lt;/P&gt;&lt;P&gt;For creating BADI as per your requirement, follow these steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt; Go to transaction SE19.&lt;/P&gt;&lt;P&gt;--&amp;gt; Enter Implementation name "Z_ME_PURCHDOC_POSTED" ( you can enter any other meaningful name too) and hit create.&lt;/P&gt;&lt;P&gt;--&amp;gt; When asked for "definition name" , enter "ME_PURCHDOC_POSTED".&lt;/P&gt;&lt;P&gt;--&amp;gt; On the screen which opens, enter meaningful description. and hit save.&lt;/P&gt;&lt;P&gt;--&amp;gt; When asked, enter your custom development class and create a transport request.&lt;/P&gt;&lt;P&gt;--&amp;gt; Now, select "interface" tab.&lt;/P&gt;&lt;P&gt;--&amp;gt; Here you can do two things. a). double-click on method and it will directly take you to the place where you write your code to update custom Z table. OR b). Double-click on the "implementation class" . This you will fine under interface name and it would be line "ZCL_IM__ME_PURCHDOC_POSTED".&lt;/P&gt;&lt;P&gt;--&amp;gt; If you double-click on "implementation class", it will take you to the screen ( this is same as SE24 screen where you implement can see classes and interfaces ) where you can see method, what parameters are available etc. From here also you can double-click on method and do to the place where you can implement you code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ME_REQ_POSTED just replace ME_PURCHDOC_POSTED by ME_REQ_POSTED  in above steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more information on BADI, please refer to this link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_46c/helpdata/EN/ee/a1d548892b11d295d60000e82de14a/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_46c/helpdata/EN/ee/a1d548892b11d295d60000e82de14a/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 05:01:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110529#M441066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T05:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: BADI and BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110530#M441067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;But will be code we will write in the BADI method in implementation part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regards,&lt;/P&gt;&lt;P&gt;Naren.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 13:47:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110530#M441067</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T13:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: BADI and BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110531#M441068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, you write your code in BADI implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the last step in my answer before. It talks about where you write your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 14:42:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-and-bapi/m-p/2110531#M441068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T14:42:26Z</dc:date>
    </item>
  </channel>
</rss>

