<?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: catching error in bapi_po_create1 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313993#M1028329</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using sy-subrc use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF v_return[] IS INITIAL.&lt;/P&gt;&lt;P&gt;   then check for message type E&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Jul 2008 21:57:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-30T21:57:18Z</dc:date>
    <item>
      <title>catching error in bapi_po_create1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313990#M1028326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i'm calling the bapi_po_create1 from an rfc, it contains some errors, that i can see it in the return table, but i've tried to catch wether is an error ocurred or not, but the sy-subrc it's always 0, why??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here's my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
      poheader          = v_header
      poheaderx         = v_headerx
    IMPORTING
      exppurchaseorder  = v_purch
    TABLES
      poitem            = v_item
      poitemx           = v_itemx
      return            = v_return.

  IF sy-subrc = 0.    "always = 0
    PERFORM pr_commit TABLES v_return
                      USING  'X'.
    WRITE: / v_purch.
  ELSE.
    LOOP AT v_return.
      WRITE:  / v_return-type,
                v_return-message.
    ENDLOOP.
  ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 21:43:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313990#M1028326</guid>
      <dc:creator>sergio_cifuentes</dc:creator>
      <dc:date>2008-07-30T21:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: catching error in bapi_po_create1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313991#M1028327</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;Define an internal table or type BAPIRET2 for holding the error messages and pass it to function module as RETURN table for catching errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_return.&lt;/P&gt;&lt;P&gt;commit if there are no errors.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srilatha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 21:53:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313991#M1028327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T21:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: catching error in bapi_po_create1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313992#M1028328</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;the call of 'BAPI_PO_CREATE1' will never set the sy-subrc, because there's no exception for it. The only chance you have is to check  the return table for error messages, like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
loop at v_return where msgty = 'E'.
      WRITE:  / v_return-type,
                v_return-message.
endloop.
if sy-subrc &amp;lt;&amp;gt; 0.
* everyting seems ok
    PERFORM pr_commit TABLES v_return
                      USING  'X'.
    WRITE: / v_purch.
endif.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 21:56:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313992#M1028328</guid>
      <dc:creator>jens_becher</dc:creator>
      <dc:date>2008-07-30T21:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: catching error in bapi_po_create1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313993#M1028329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using sy-subrc use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF v_return[] IS INITIAL.&lt;/P&gt;&lt;P&gt;   then check for message type E&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 21:57:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catching-error-in-bapi-po-create1/m-p/4313993#M1028329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T21:57:18Z</dc:date>
    </item>
  </channel>
</rss>

