Showing posts with label ABAP. Show all posts
Showing posts with label ABAP. Show all posts

Thursday, December 06, 2007

How to Create an ABAP Web Service...

Create a new Function Module within an existing or newly created Function Group

  • Choose a name e.g. Z_E_RFC_WS_MYSERVICE and short text.
  • Attributes > select Remote-Enabled Module
  • Import > add the import parameters
  • Export > add the export parameters
  • Source Code > add the ABAP that the WS should perform

Create a Virtual Interface from the Enterprise Services Tab

  • Choose a name e.g. ZES_VI_MYSERVICE and short description.
  • Endpoint Type should be Function Module and select the FM created above.

Create a Web Service Definition from the Enterprise Services Tab

  • Choose a name e.g. ZES_WS_MYSERVICE and short description.
  • Select the VI created above.

Release the Web Service via WSCONFIG

  • Select the Web Service.

Test the Web Service via WSADMIN

  • View the WSDL and test the Web Service

Develop a Web Service that sends an Email – in ABAP

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

Tuesday, December 04, 2007

INCLUDE

The INCLUDE statement includes the program in the main program for syntax check and generation purposes. Include programs are used to divide very large programs into smaller more manageable units.

TYPE-POOLS

TYPE-POOLS are ABAP programs where custom TYPES and CONSTANTS are defined which are maintained in the ABAP Dictionary. The TYPE-POOL is available to all programs and function modules after declaration in the TOP include.

All TYPES and CONSTANTS in the TYPE-POOL must be prefixed with the TYPE-POOL name followed by an underscore.