<?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 return value after call bapi in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-value-after-call-bapi/m-p/6463827#M1415917</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please read my code as below.     My problem always exit even when call bapi successfully. I debug this code, find RETURN is null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm a newbie at ABAP. please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'BAPI_PO_GETITEMS'
EXPORTING
...
TABLES
...
RETURN = RETURN.


if RETURN-TYPE  u300Au300B 'S'.
  OUTPUT-RETCODE = RETURN-TYPE.
  exit.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Dec 2009 01:48:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-24T01:48:25Z</dc:date>
    <item>
      <title>return value after call bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-value-after-call-bapi/m-p/6463827#M1415917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please read my code as below.     My problem always exit even when call bapi successfully. I debug this code, find RETURN is null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm a newbie at ABAP. please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'BAPI_PO_GETITEMS'
EXPORTING
...
TABLES
...
RETURN = RETURN.


if RETURN-TYPE  u300Au300B 'S'.
  OUTPUT-RETCODE = RETURN-TYPE.
  exit.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 01:48:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-value-after-call-bapi/m-p/6463827#M1415917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-24T01:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: return value after call bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-value-after-call-bapi/m-p/6463828#M1415918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you provide a valid PO number, then the RETURN parameter will be empty.  If you give an invalid PO, you will get RETURN with TYPE NE 'S'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Venu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 02:29:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-value-after-call-bapi/m-p/6463828#M1415918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-24T02:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: return value after call bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-value-after-call-bapi/m-p/6463829#M1415919</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;There are two things you should note.&lt;/P&gt;&lt;P&gt;1. RETURN is a table parameter. So you need to loop through it. You seem to be reading only the header of the table.&lt;/P&gt;&lt;P&gt;2. This BAPI returns an EMPTY table RETURN if it is successful in reading the PO items. In this case your code will exit whenever PO items are read successfully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You change your code like below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: v_failure TYPE c.
.....
....
CLEAR v_failure.
LOOP AT return.
  IF return-type IN ('E', 'A'). "Error or Abend - both un-successful
    v_failure = 'X'.
    EXIT.  "This EXIT is to exit the loop if any error is found
  ENDIF.
ENDLOOP.
IF v_failure = 'X'.
  EXIT.  "This EXIT is to exit your routine.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 02:57:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-value-after-call-bapi/m-p/6463829#M1415919</guid>
      <dc:creator>SureshRa</dc:creator>
      <dc:date>2009-12-24T02:57:14Z</dc:date>
    </item>
  </channel>
</rss>

