<?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 Re: BADI ME_PROCESS_PO_CUST Method Post in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626418#M603519</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alexandre&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be possible to check the transaction. However, if the BAPI BAPI_PO_CREATE is used the BAdI is also processed yet the transaction is most likely wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An &amp;lt;u&amp;gt;unambigous &amp;lt;/u&amp;gt;approach is to check IMPORTING parameter IM_TRTYP in method IF_EX_ME_PROCESS_PO_CUST~OPEN:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
METHOD if_ex_me_process_po_cust~open.
* define local data
  DATA:
    lo_po          TYPE REF TO cl_po_header_handle_mm,
    ls_header      TYPE mepoheader.

  me-&amp;gt;md_trtyp = im_trtyp.  " save transaction type

  IF ( im_trtyp = 'H' ).  " add new purchase order
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would add an instance attribute MD_TRTYP to the BAdI implementing class and save the transaction type in method IF_EX_ME_PROCESS_PO_CUST~OPEN (see above).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can simply add the following IF condition to your POST method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD if_ex_me_process_po_cust~open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  CASE me-&amp;gt;md_trtyp.  
    WHEN 'H'.    " add new purchase order
  ...  " do required action for CREATE

    WHEN ... .

    WHEN others.
      ...
  ENDCASE.
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The possible transaction types can be found at: im_trtyp -&amp;gt; data element -&amp;gt; &amp;lt;b&amp;gt;domain &amp;lt;/b&amp;gt;(fixed values).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Aug 2007 18:23:20 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2007-08-02T18:23:20Z</dc:date>
    <item>
      <title>BADI ME_PROCESS_PO_CUST Method Post</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626416#M603517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, how can we know in the method post of the BADI ME_PROCESS_PO_CUST if we are in creation mode (me21n) or change mode (me22n), I need to do some coding only at the creation of the PO but this method is call anytime we click save!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2007 17:53:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626416#M603517</guid>
      <dc:creator>AlexGiguere</dc:creator>
      <dc:date>2007-08-02T17:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: BADI ME_PROCESS_PO_CUST Method Post</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626417#M603518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can check Transaction Code in BADI.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2007 18:18:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626417#M603518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-02T18:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: BADI ME_PROCESS_PO_CUST Method Post</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626418#M603519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alexandre&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be possible to check the transaction. However, if the BAPI BAPI_PO_CREATE is used the BAdI is also processed yet the transaction is most likely wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An &amp;lt;u&amp;gt;unambigous &amp;lt;/u&amp;gt;approach is to check IMPORTING parameter IM_TRTYP in method IF_EX_ME_PROCESS_PO_CUST~OPEN:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
METHOD if_ex_me_process_po_cust~open.
* define local data
  DATA:
    lo_po          TYPE REF TO cl_po_header_handle_mm,
    ls_header      TYPE mepoheader.

  me-&amp;gt;md_trtyp = im_trtyp.  " save transaction type

  IF ( im_trtyp = 'H' ).  " add new purchase order
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would add an instance attribute MD_TRTYP to the BAdI implementing class and save the transaction type in method IF_EX_ME_PROCESS_PO_CUST~OPEN (see above).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can simply add the following IF condition to your POST method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD if_ex_me_process_po_cust~open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  CASE me-&amp;gt;md_trtyp.  
    WHEN 'H'.    " add new purchase order
  ...  " do required action for CREATE

    WHEN ... .

    WHEN others.
      ...
  ENDCASE.
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The possible transaction types can be found at: im_trtyp -&amp;gt; data element -&amp;gt; &amp;lt;b&amp;gt;domain &amp;lt;/b&amp;gt;(fixed values).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2007 18:23:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626418#M603519</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-08-02T18:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: BADI ME_PROCESS_PO_CUST Method Post</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626419#M603520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Uwe, this is what I was searching for, I never thought to look in the open method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I give you 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2007 18:40:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626419#M603520</guid>
      <dc:creator>AlexGiguere</dc:creator>
      <dc:date>2007-08-02T18:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: BADI ME_PROCESS_PO_CUST Method Post</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626420#M603521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alexandre&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are welcome!&lt;/P&gt;&lt;P&gt;Since BAdI interface usually do not have that many methods I usually "browse" through all methods and their parameters to get an idea about the function of the methods (because, sadly enough, they are poorly documented).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2007 19:02:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626420#M603521</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-08-02T19:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: BADI ME_PROCESS_PO_CUST Method Post</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626421#M603522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I face the same problem as I need to have some logic implemented in the close method if it is a create PO action.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try your coding in METHOD if_ex_me_process_po_cust~open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;me-&amp;gt;md_trtyp = im_trtyp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get 'Field "MD_TRTYP" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides, I would like to ask if I can declare a global variable to be shared within the different methods in the BADI ME_PROCESS_PO_CUST.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2007 04:41:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626421#M603522</guid>
      <dc:creator>former_member220801</dc:creator>
      <dc:date>2007-09-14T04:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: BADI ME_PROCESS_PO_CUST Method Post</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626422#M603523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gundam&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have defined MD_TRTYP (most like of TYPE trtyp) as &amp;lt;i&amp;gt;private &amp;lt;/i&amp;gt;instance attribute of the class implementing the BAdI interface. This way the transaction type is available in all methods of the BAdI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2007 05:46:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi-me-process-po-cust-method-post/m-p/2626422#M603523</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-09-14T05:46:07Z</dc:date>
    </item>
  </channel>
</rss>

