<?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 api method. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/api-method/m-p/3195045#M761336</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to create API Method using the bapi wizard.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Dec 2007 15:54:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-21T15:54:15Z</dc:date>
    <item>
      <title>api method.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/api-method/m-p/3195045#M761336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to create API Method using the bapi wizard.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2007 15:54:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/api-method/m-p/3195045#M761336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-21T15:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: api method.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/api-method/m-p/3195046#M761337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create the API Method Using the BAPI WIZARD &lt;/P&gt;&lt;P&gt;The BAPI wizard is used toTo expose the remote function module as a BAPI. The wizard will generate some additional code, so the function module is a valid method of the BOR. This allows the BAPi to be called as a workflow method in addition to be called by an outside program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Each function module corresponds to a method in the BOR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to the Business Object Builder SWO1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can either create the new Object type as a subtype of an existing business object or create a new business object from scratch. In this example it would be obvious to create the Object type as a subtype of BUS2005 Production order. However, to illustrate how to create a new Object type from scratch, we will do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Object/Interface type field write the name of the new Business Object: ZORDERSTAT. Press enter and fill in the additional fields necessary to create the object type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Supertype: Not relevant because we are creating our object from scratch&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program. This is the name of the program where the wizard generates code for the Object type, NOT the function module we created earlier. The program name must not be the name of an existing program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create the API Method Using the BAPI WIZARD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The BAPI wizard is used toTo expose the remote function module as a BAPI. The wizard will generate some additional code, so the function module is a valid method of the BOR. This allows the BAPi to be called as a workflow method in addition to be called by an outside program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Each function module corresponds to a method in the BOR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to the Business Object Builder SWO1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can either create the new Object type as a subtype of an existing business object or create a new business object from scratch. In this example it would be obvious to create the Object type as a subtype of BUS2005 Production order. However, to illustrate how to create a new Object type from scratch, we will do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Object/Interface type field write the name of the new Business Object: ZORDERSTAT. Press enter and fill in the additional fields necessary to create the object type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Supertype: Not relevant because we are creating our object from scratch&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program. This is the name of the program where the wizard generates code for the Object type, NOT the function module we created earlier. The program name must not be the name of an existing program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create the API Method Using the BAPI WIZARD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The BAPI wizard is used toTo expose the remote function module as a BAPI. The wizard will generate some additional code, so the function module is a valid method of the BOR. This allows the BAPi to be called as a workflow method in addition to be called by an outside program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Each function module corresponds to a method in the BOR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to the Business Object Builder SWO1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can either create the new Object type as a subtype of an existing business object or create a new business object from scratch. In this example it would be obvious to create the Object type as a subtype of BUS2005 Production order. However, to illustrate how to create a new Object type from scratch, we will do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Object/Interface type field write the name of the new Business Object: ZORDERSTAT. Press enter and fill in the additional fields necessary to create the object type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Supertype: Not relevant because we are creating our object from scratch&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program. This is the name of the program where the wizard generates code for the Object type, NOT the function module we created earlier. The program name must not be the name of an existing program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you have finished the wizard, you will notice that the ZGetOrderStatus has been added to the business object:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can double-click on the method to see its properties. To use the business object you must change the Object type status to Implemented. Use menu Edit-&amp;gt;Change releases status-&amp;gt;Object type-&amp;gt;To implemented. No you can test the object (Press F8).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the BAPI wizard has added a wrapper class for the function module so it can be sued as method in the business object. Choose menu Goto-&amp;gt;Program to display the program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="5" type="ul"&gt;&lt;P&gt;          Implementation of object type ZORDERSTAT           *****&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;INCLUDE &amp;lt;OBJECT&amp;gt;.&lt;/P&gt;&lt;P&gt;BEGIN_DATA OBJECT. " Do not change.. DATA is generated&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;only private members may be inserted into structure private&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;" begin of private,&lt;/P&gt;&lt;P&gt;"   to declare private attributes remove comments and&lt;/P&gt;&lt;P&gt;"   insert private attributes here ...&lt;/P&gt;&lt;P&gt;" end of private,&lt;/P&gt;&lt;P&gt;      KEY LIKE SWOTOBJID-OBJKEY.&lt;/P&gt;&lt;P&gt;END_DATA OBJECT. " Do not change.. DATA is generated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BEGIN_METHOD ZGETORDERSTATUS CHANGING CONTAINER.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;      BAPIORDERSTATUSIMPORT LIKE ZBAPI_ORDER_STATUS_IMPORT,&lt;/P&gt;&lt;P&gt;      RETURN LIKE BAPIRETURN,&lt;/P&gt;&lt;P&gt;      TBAPISTAT LIKE ZBAPISTAT OCCURS 0.&lt;/P&gt;&lt;P&gt;  SWC_GET_ELEMENT CONTAINER 'BapiOrderStatusImport'&lt;/P&gt;&lt;P&gt;       BAPIORDERSTATUSIMPORT.&lt;/P&gt;&lt;P&gt;  SWC_GET_TABLE CONTAINER 'TBapistat' TBAPISTAT.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'Z_BAPI_GET_ORDER_STATUS'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      BAPI_ORDER_STATUS_IMPORT = BAPIORDERSTATUSIMPORT&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      RETURN = RETURN&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      T_BAPISTAT = TBAPISTAT&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      OTHERS = 01.&lt;/P&gt;&lt;P&gt;  CASE SY-SUBRC.&lt;/P&gt;&lt;P&gt;    WHEN 0.            " OK&lt;/P&gt;&lt;P&gt;    WHEN OTHERS.       " to be implemented&lt;/P&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt;  SWC_SET_ELEMENT CONTAINER 'Return' RETURN.&lt;/P&gt;&lt;P&gt;  SWC_SET_TABLE CONTAINER 'TBapistat' TBAPISTAT.&lt;/P&gt;&lt;P&gt;END_METHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;award points if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Dec 2007 12:13:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/api-method/m-p/3195046#M761337</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-22T12:13:34Z</dc:date>
    </item>
  </channel>
</rss>

