36
BAPI-ALE Interfaces Published On: July 19, 2008 SAP GEEKS CLUB http://sapgeeksclub.com BAPI-ALE INTERFACES Summary: This document talks about custom BAPI creation and generating the ALE interface for the Custom BAPI. BAPIs are integrated into the ALE communication model. ALE communication is asynchronous and message-based. ALE communication is the preferred way to integrate distributed SAP Systems, for example, for distributing master data. Since Release 4.0 BAPIs are the standardized interfaces for ALE-supported communication. ALE services, such as asynchronous BAPI calls, distribution model, monitoring and error handling can be used for BAPIs. The IDoc types required for the ALE services can be generated from BAPIs. Author(s): Izhar Khan Company: Deloitte Consulting India Pvt Ltd Izhar Khan is working as SAP Netweaver Consultant with Deloitte Consulting India Pvt Ltd. His key areas are ABAP, XI & ALE.

Generate Bapi ALE Interface

Embed Size (px)

Citation preview

Page 1: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

BAPI-ALE INTERFACES

Summary:

This document talks about custom BAPI creation and generating the ALE interface for the Custom BAPI.

BAPIs are integrated into the ALE communication model. ALE communication is asynchronous and message-based. ALE communication is the preferred way to integrate distributed SAP Systems, for example, for distributing master data.

Since Release 4.0 BAPIs are the standardized interfaces for ALE-supported communication. ALE services, such as asynchronous BAPI calls, distribution model, monitoring and error handling can be used for BAPIs. The IDoc types required for the ALE services can be generated from BAPIs.

Author(s): Izhar Khan Company: Deloitte Consulting India Pvt Ltd

Izhar Khan is working as SAP Netweaver Consultant with Deloitte Consulting India Pvt Ltd. His key areas are ABAP, XI & ALE.

Page 2: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

TABLE OF CONTENT 1.0 Introduction............................................................................................................... 3

1.1 Concept ................................................................................................................. 3 1.2 Mini requirement for the creation of a BAPI........................................................ 4

2.0 Step by Step BAPI-ALE Interface creation .............................................................. 5

Page 3: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

1.0 Introduction

This document talks about custom BAPI creation and generating the ALE interface for the Custom BAPI.

BAPIs are integrated into the ALE communication model. ALE communication is asynchronous and message-based. ALE communication is the preferred way to integrate distributed SAP Systems, for example, for distributing master data.

Since Release 4.0 BAPIs are the standardized interfaces for ALE-supported communication. ALE services, such as asynchronous BAPI calls, distribution model, monitoring and error handling can be used for BAPIs. The IDoc types required for the ALE services can be generated from BAPIs.

1.1 Concept Below Object stack shows flow of message from source system to target system. Object Stack: o/b – outbound i/b – inbound

Once ALE-BAPI interface is created, below objects will get generated.

1. Inbound function module 2. Outbound function module 3. Custom IDoc type 4. Custom message type

Page 4: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

5. Custom IDoc segments

ALE-BAPI interface is used to push IDoc from one SAP system to another SAP system. IDoc transmission can be triggered in two ways. 1. Via some object event

a. When any Object event is triggered, transaction data is passing to BAPI-ALE outbound function module which will in turn generate corresponding IDoc. This IDoc will then get transmitted to corresponding target system via tRFC based on Partner profile setting.

b. On receiver side, it will be received by BAPI-ALE inbound function module based on partner profile settings. Inbound function module will convert this IDoc data into structures/tables of BAPI and the BAPI in turn shall implement the required Business logic.

2. Explicitly calling BAPI-ALE outbound function module. a. One can directly call BAPI-ALE outbound function module by passing

all required structure/tables data. BAPI-ALE outbound function module which will in turn generate corresponding IDoc. This IDoc will then get transmitted to corresponding target system via tRFC using Partner profile setting.

b. On receiver side, it will be received by BAPI-ALE inbound function module based on partner profile settings. Inbound function module will convert this IDoc data into structures/tables of BAPI and the BAPI in turn shall implement the required Business logic

Notice the inbound process flow exits during the inbound function module. Above inbound function module sits a BAPI and supporting Business object. They are required for the generation of the BAPI-ALE interface objects, but are not utilized during the processing of the inbound IDoc.

1.2 Mini requirement for the creation of a BAPI 1. Do not use “type” for parameters. Use “like” 2. Import parameters must be passed in as “value” 3. Must had “Return” parameter 4. Must be “RFC enabled”

Note: For full BAPI compliance, check the “BAPI Project” in the “BAPI

Explorer” - BAPI If Filter Objects are to be used, parameters must be passed as tables (i.e.

multi-line in BAPI parameters.

Page 5: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

2.0 Step by Step BAPI-ALE Interface creation 1. Analyze the fields that require filling in the IDOC segment. Create a dictionary structure for the same fields. Follow the naming standard as ZBAPI_<FRICEID>_<DESC>

2. In this scenario structure looks as below.

.

Page 6: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

3. Create function group. Follow naming standard as Z<APPLICATION AREAS><FRICE ID>

4. Save and assign to a package and request.

Page 7: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

5. Create Function module .Follow naming standard as Z_BAPI_<FRICEID>_<DESC>

6. Supply function group that was created already.

7. Select Processing type as “Remote-Enabled-Module” as shown in screen shot.

Page 8: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

8. Go to TABLE tab pass the structure that was created at first (point: 1) and assign a parameters name.

9. BAPI returns the value. Go to EXPORT tab and pass BAPIRETURN as shown below.

Page 9: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

10 .Save and activate. Release it as shown below. In the status bar you can see the message.

Page 10: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

11. Go to T.code SWO1 and create object. Follow naming standard as Z<APPLICATION AREA><FRICEID>

12. Assign values to the fields as shown below and continue.

13. Object ZMINT207 was created as shown.

Page 11: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

14. Select on the key fields as shown and select create button on the tool bar.

15. A pop up message will display as shown. Select YES.

16. Pass the dictionary table i.e. as to your scenario and select the key field and continue.

Page 12: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

17. If you want you can change the names & description and then select create button.

18. It added key field (Order) to the node key fields.

19. Add method: To add methods go to menu Utilities->API methods->Add Method

Page 13: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

20 Then it will request for function module name. Supply BAPI that was created earlier (Ref STEP-5) and continue.

Page 14: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

21. Then by default it will has a method, name, description. We can change these names if required .Click on the continue arrow as shown.

22. Again continue the screen as shown

23. It displays a pop up window. Select YES.

Page 15: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

24. It inserted a method under methods node and message can see in the status bar.

Page 16: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

25. Implement the object type as shown.

Page 17: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

26. After implemented the object type. Message can see in the status bar.

Page 18: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

27. Release the object type shown below.

28. Continue the information message

Page 19: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

29. Continue the information message

30. Released message can see in the status bar.

Page 20: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

31. Implement the object type component as shown below.

Page 21: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

32. Implemented status can see in the status bar.

Page 22: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

31. Release object type component as shown below.

Page 23: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

32. Release status can see in the status bar.

Page 24: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

33. Finally generate it.

34. Generated status can see in the status bar. As shown below.

Page 25: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

35. Go to T.code BAPI .Select tab ALPHABETIC. Check for your object name which was created in the STEP: 12.

Page 26: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

36. Expand the object name and select method .In the right hand side observes the ALE message type – “does not exit”. Click on.

37. Generate a new ALE interface for BAPI .To do this click on the create button as shown.

Page 27: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

38. By default it shown the message type with certain name. Continue.

Page 28: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

39. A pop up interface parameter screen appears .By default it has certain names. Continue

Page 29: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

40. Check rounded check box as shown. Continue

Page 30: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

41. Finally it generated an ALE interface for the BAPI. As shown below.

42. Click on the IDOC type as shown below

Page 31: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

43. The screen shown as below.

44. Set release status for IDOC as shown.

Page 32: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

45. A POP up message was displayed. Just click on the YES. It the status bar you can the see the release message.

Page 33: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

46. Click on the Segment type as shown below.

Page 34: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

47. Set release status for segment as shown.

Page 35: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

48. Once it was set to release. Release check was checked as shown below.

49. Finally by calling the BAPI we can trigger the IDOC.

Page 36: Generate Bapi ALE Interface

BAPI-ALE Interfaces Published On: July 19, 2008

SAP GEEKS CLUB http://sapgeeksclub.com

Disclaimer: Sapgeeksclub is determined to provide useful learning materials but it does not hold liability or responsibility of any damage caused by using the code sample or information provided in this document. This document has been published based on Author’s understanding of the subject and neither the author nor sapgeeksclub can be hold responsible for any disparity in the information provided here and at any other source.