Thursday, December 06, 2007

How to Create a BAPI...

Create a new Function Group via SE37
  • Goto > Function Groups > Create Group
  • Function Group name should start with ‘ZBAPI_’ e.g. ‘ZBAPI_PIS_ORDER_LIST’
  • Each BAPI needs to have its own Function Group

Create a new Function Module via SE37

  • Function Module name must include the keyword ‘BAPI’ e.g. ‘BAPI_PIS_ORDER_LIST’
  • Set the Function Group to the one created above
  • You will see the warning Function Module name is reserved for SAP which means the name of this Function Module can not be altered by future development
  • Selected Remote-Enabled Module in attributes to allow the Function Module to be invoked via RFC
  • Import/Export Parameters can only be BY VALUE for RFC enabled Function Modules
  • Structures for use in BAPIs should include the keyword ‘BAPI’ e.g. ‘ZBAPI_PIS_INPUT’
  • Add the relevant Source Code, Save and Activate as usual

Release the Function Module via SE37

  • Function Module > Release > Release

Create the API Method using the BAPI Wizard via SWO1

  • Object Type should be prefixed with ‘ZBAPI_’ e.g. ‘ZBAPI_PIS’
  • Set the Object Name, Name and Program to be the same as the Object Type
  • Provide a relevant description and set the Application to * (cross-platform)
  • Utilities > API Methods > Add Method, enter the name of the Function Module created above
  • Provide a relevant method name and description, click the black arrow twice then click Yes when prompted to automatically generate a new template for the not yet implemented method
  • The newly created method should now be available under Methods
  • Select the name of the BAPI at the top of the screen:
  • Edit > Change Release Status > Object Type > To Implemented
  • Edit > Change Release Status > Object Type > To Released
  • Select the new API method under Methods:
  • Edit > Change Release Status > Object Type Component > To Implemented
  • Edit > Change Release Status > Object Type Component > To Released
  • Object Type > Generate

No comments: