<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663854#M614665</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;What is meant by FILTER in badi ? how it will work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;ASHOK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Aug 2007 04:05:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-14T04:05:59Z</dc:date>
    <item>
      <title>badi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663854#M614665</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;What is meant by FILTER in badi ? how it will work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;ASHOK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 04:05:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663854#M614665</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T04:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: badi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663855#M614666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you be more clear on what you mean by reusability? Almost any piece of code in SAP can be reused to some extent. You can insert code into your own custom programs to call badis, function module exits implemented in CMOD and even subroutine user exits if you try hard enough.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Multiple Use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every time a BADI is implemented in SE19, a new class is created for the implemented BADI. If a BADI Definition is flagged for multiple use, it means that you can create as many implementations of that BADI as you would like. For example if you had two different actions that need to be carried out, you could implement each action in a separate implementation. If the BADI is not set up for multiple use, both actions would have to be implemented in the same SE19 implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filters:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filters are used to attach some type of criteria to the execution of a BADI. It would be similar to putting a hardcoded "if" statement in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, see BADI Definition BDCP_BEFORE_WRITE. This BADI is set up for muletiple use and filters. It is used to do some checking before change pointers are written for a particular ALE Message Type. The Filter value can be set in your implementation to only be carried out for that message type. If a BADI is set up to have a filter value, this must be populated in your implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 04:07:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663855#M614666</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T04:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: badi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663856#M614667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1.1 Single Implementation of BADI&lt;/P&gt;&lt;P&gt;i) Go to transaction SE18 and create a BADI Definition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Def name:Ysub_get_materials&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Click On Create button&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter the description. The name of the interface will be automatically proposed. Double click on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Iname: yif_ex_sub_get_materials&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save as local object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter the name of the method you want to create. Click the Paramters pushbutton to create parameters for the method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mname: get_materials&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters:&lt;/P&gt;&lt;P&gt;Matnr importing type Matnr&lt;/P&gt;&lt;P&gt;X_mara exporting type mara&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save and activate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Go to transaction SE19 and create a BADI implementation.&lt;/P&gt;&lt;P&gt;Implname: ysub_getm_implement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Click on Create button&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A popup window will ask you for the definition name. Enter the name of the BADI definition which you have created&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Definition name: ysub_get_materials&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Press Enter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter the description for the implementation. Then save and activate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Goto interface tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Double click on the method name.&lt;/P&gt;&lt;P&gt;Click on yes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method yif_ex_sub_Get_materials~get_materials.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not matnr is initial.&lt;/P&gt;&lt;P&gt;Select single * from mara into x_mara&lt;/P&gt;&lt;P&gt;Where matnr = matnr.&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;Save and activate it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, create a code using the BADI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Report ysub_get_materials_program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS cl_exithandler DEFINITION LOAD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: l_badi_instnce type ref to yif_ex_sub_Get_materials,&lt;/P&gt;&lt;P&gt;x_mara like mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_matnr like mara-matnr obligatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;CALL METHOD CL_EXITHANDLER=&amp;gt;GET_INSTANCE &amp;#147; this is static method.&lt;/P&gt;&lt;P&gt;EXPORTING EXIT_NAME = &amp;#145;YSUB_GET_MATERIALS&amp;#146; &amp;#147;badi definition name&lt;/P&gt;&lt;P&gt;NULL_INSTANCE_ACCPETED = &amp;#145;X&amp;#146;&lt;/P&gt;&lt;P&gt;CHANGING INSTANCE =l_badi_instance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD l_badi_instance-&amp;gt; GET_MATERIALS&lt;/P&gt;&lt;P&gt;EXPORTING MATNR = p_matnr&lt;/P&gt;&lt;P&gt;IMPORTING X_MARA = x_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write:/ x_mara-matnr,&lt;/P&gt;&lt;P&gt;x_mara-maktl,&lt;/P&gt;&lt;P&gt;x_mara-meins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.2 Multiple Implementation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a BADI: YSUB_GET_MATERIALS_1 in a manner similar to that created above. But, check the checkbox for Multiple Use in Attributes tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, create one implementations for the same BADI:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method yif_ex_sub_Get_materials~get_materials.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not matnr is initial.&lt;/P&gt;&lt;P&gt;Select single * from mara into x_mara&lt;/P&gt;&lt;P&gt;Where matnr = matnr.&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;&lt;/P&gt;&lt;P&gt;Code is similar to the previous one)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Same above report program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, you want to create another implementation of the same BADI. Let us examplify the concept. Say, you want that when the user will enter &amp;#145;GARI&amp;#146; in the selectiuon-screen, it will stand for &amp;#145;CAR&amp;#146; internally and selection will be done out of MARA table based on material code : &amp;#145;CAR&amp;#146;. O, you define another implementation of the same BADI from transaction : SE19.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Implname2: YSUB_GETM_IMPL2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method yif_ex_sub_Get_materials~get_materials.&lt;/P&gt;&lt;P&gt;Data: l_matnr type matnr.&lt;/P&gt;&lt;P&gt;L_matnr = matnr.&lt;/P&gt;&lt;P&gt;If l_matnr = &amp;#145;GARI&amp;#146;.&lt;/P&gt;&lt;P&gt;L_matnr = &amp;#145;CAR&amp;#146;.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;Select single * from mara into x_mara&lt;/P&gt;&lt;P&gt;Where matnr = l_matnr.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, when you will execute the program and enter &amp;#145;GARI&amp;#146; in the material code field in the selection-screen, it will get internally translated to &amp;#145;CAR&amp;#146; when the second implementation will be active.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 04:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663856#M614667</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T04:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: badi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663857#M614668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Karthikeyan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for copying my response from here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3926622"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris H.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 11:07:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/2663857#M614668</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T11:07:31Z</dc:date>
    </item>
  </channel>
</rss>

