<?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 BAPI: How to Insert the code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937978#M62561</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;  I am trying to create a bapi, using the following example. &lt;A href="http://www.sapgenie.com/abap/bapi/example.htm#step2" target="test_blank"&gt;http://www.sapgenie.com/abap/bapi/example.htm#step2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the step2, source code attribute, I dont understand, how to write the " Include LZBAPIStatusu02.........".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can somebody please suggest me the steps to create that code. Thanks in advance.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Raj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jul 2005 16:08:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-07-19T16:08:39Z</dc:date>
    <item>
      <title>BAPI: How to Insert the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937978#M62561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;  I am trying to create a bapi, using the following example. &lt;A href="http://www.sapgenie.com/abap/bapi/example.htm#step2" target="test_blank"&gt;http://www.sapgenie.com/abap/bapi/example.htm#step2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the step2, source code attribute, I dont understand, how to write the " Include LZBAPIStatusu02.........".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can somebody please suggest me the steps to create that code. Thanks in advance.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Raj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2005 16:08:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937978#M62561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-19T16:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI: How to Insert the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937979#M62562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That line of code should have been generated for you in the LZBAPISTATUSUXX include program.   The LZBAPIStatusu02 include program is the include program which stores the main line source code of your function module/BAPI.   This is where your business logic is coded.  Do you know what your business logic is?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this example, the business logic is everything here.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA:
   l_aufnr LIKE afko-aufnr,
   l_objnr LIKE jest-objnr.

********************************************
* Check if order exists
********************************************
 SELECT SINGLE aufnr
    FROM afko
    INTO  l_aufnr
    WHERE aufnr = BAPI_ORDER_STATUS_IMPORT-orderid.
  IF sy-subrc NE 0.
    CLEAR message.
    message-msgty = 'E'.
    message-msgid = 'Z3'.
    message-msgno = '000'.
    message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.
    PERFORM set_return_message USING    message
                               CHANGING return.
    IF 1 = 2.
*     The only reason to include this statement, that will obviously
*     never execute, is that it will create a referecence so that you
*     can find out where a particular message is being used. This
*     functionality is used by the BAPIs programmed by SAP
      MESSAGE e000(z3).
    ENDIF.
  ENDIF.
  CHECK return IS INITIAL.

********************************************
* Read order status
********************************************
 CONCATENATE 'OR' BAPI_ORDER_STATUS_IMPORT-orderid INTO l_objnr.
  IF BAPI_ORDER_STATUS_IMPORT-i_excludeinactive = 'X'.
    SELECT objnr stat inact
      FROM  jest
      INTO  TABLE t_bapistat
      WHERE objnr = l_objnr AND
            inact &amp;lt;&amp;gt; 'X'.
  ELSE.
    SELECT objnr stat inact
      FROM  jest
      INTO  TABLE t_bapistat
      WHERE objnr = l_objnr.
  ENDIF.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   No object status found
    CLEAR message.
    message-msgty = 'E'.
    message-msgid = 'Z3'.
    message-msgno = '001'.
    message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.
    PERFORM set_return_message USING    message
                               CHANGING return.
    IF 1 = 2.
      MESSAGE e001(z3).
    ENDIF.
  ENDIF.
  CHECK return IS INITIAL.

********************************************
* Read order status texts
********************************************
  SELECT istat txt04 txt30
    FROM tj02t
    INTO TABLE t_tj02t
    FOR ALL ENTRIES IN t_bapistat
    WHERE istat = t_bapistat-stat AND
          spras = BAPI_ORDER_STATUS_IMPORT-i_spras.

  SORT t_tj02t BY istat.

  LOOP AT t_bapistat INTO g_bapistat.
    READ TABLE t_tj02t
      WITH KEY istat = g_bapistat-stat BINARY SEARCH
     INTO g_tj02t.
    IF sy-subrc = 0.
      MOVE:
        g_tj02t-txt04 TO g_bapistat-txt04,
        g_tj02t-txt30 TO g_bapistat-txt30.
      MODIFY t_bapistat FROM g_bapistat TRANSPORTING txt04 txt30.
    ENDIF.
 ENDLOOP.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SE80, just double click the function module name, click source code tab,  what you see here is really the include in question.  Put the code there.&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;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2005 16:15:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937979#M62562</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-19T16:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI: How to Insert the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937980#M62563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If these answers have been helpful, please don't forget to reward points accordingly.  Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2005 16:50:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937980#M62563</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-19T16:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI: How to Insert the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937981#M62564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Helman,&lt;/P&gt;&lt;P&gt;   Thank you for the help.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 20:08:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-how-to-insert-the-code/m-p/937981#M62564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T20:08:49Z</dc:date>
    </item>
  </channel>
</rss>

