cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI OR IDOC

Former Member
0 Kudos

Hi Expert,

We want to post event message from third party system thru SAP PI . I am wondering whether BAPI or IDOC will be suitable .

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I have a similar question, we seem to have a lot of issues with our ECC qRFC queues. The only way for us to clear the queue is to delete the top message failure, but this could mean we are losing data. I am wondering if the PI way would be a better solution...however I don't know what kind of guarantee this has that we keep EOIO ( Exactly Once In Order).

I have seen similar situations where people use the specific object ID instead of a blanket RFC queue like EM* that way if you have a failure in one object it doesn't affect the others.

Looking more for a good discussion on this not an answer.

I have also created Service Interfaces to update the Sales order in ECC from events happening in EM. Trying to find out if async stateless is the way to go with this because it seems that this does not offer EOIO like I would like either.

Let me know if I should start a new thread on this!

former_member583013
Active Contributor
0 Kudos

Alex,

I've always modified that queue to be more in line with the object you are dealing with. i.e. at my one client we had the sales order line as an EH so we used the last number of the sales order to distinguish a certain queue. i.e. we had 10 queues. All events for that sales order would be in the same queue so any qRFC failure would effect only 10% of the orders. You can expand accordingly. If your qRFCs are failing you should elliminate the root cause and then delete the entry if it continues to fail to post.

I ended up creating a small utility to keep the EHs in synch by posting these events that you delete from the queue.

If it's the EH create that is deleted then you'll need to go and touch that object again to re-create the EH.

Running it through PI will not add any redundancy or improve on these issues either. It will just add to the complexity. If your interfaces are coming from outside SAP then by all means use PI otherwise stick to qRFC.

Thanks

Kevin

0 Kudos

Is there a way to change the standard queue being used?

I thought that everything channeled through the SAP EM definition. So in SPRO->EM Interface->Define Applicaiton Interface

if you define Event Manager as "EM" and leave the sync flag off this will flow only to the qRFC queue of EM*

I would love to have everything move through EM+AO ID, so for a sales order line EH that has AO ID of 0200005020001200 I would like to see a queue of EM0200005020001200. So that messages moving to the EM system are only affected from a EH to EH basis.

Is that what you were suggesting Kevin?

If there is an easy enhancement for this please let me know the spot

former_member190756
Active Contributor
0 Kudos

Hello Alex,

if you have PI_BASIS 2006 or higher in your system you can create a Queue Name extractor where you can do this.

You can create the extractor in transaction /SAPTRX/ASC0TF and afterwards assign it in transaction /SAPTRX/ASC0TO to your Business Process Type.

Alernative if you have a lower PI_BASIS release you could create your own BADI implementation

For Sales Order integration it is BADI BADI_SD_SALES. Our implementation is /SAPTRX/SD_SALESORD.

You could copy the coding and create your implementation and afterwards deactivate /SAPTRX/SD_SALESORD.

The queue name is specified here:

CALL FUNCTION '/SAPTRX/EVENT_MGR_COMMUNICATE'

EXPORTING

business_process_type = 'ESC_SORDER'

table_container = datacontainer

rfc_queue_name = rfc_trx_queue

Instead rfc_trx_queue provide e.g. the Sales Order number.

Best regards,

Steffen

former_member583013
Active Contributor
0 Kudos

Alex,

That's precisely what I'm saying. Steffen described exactly how to do it. Although the example used is the Sales Order object and that BAdI is not open for customers to create their own implementations.... There is an OSS note that guides you through how to open it for your own customer implementation

Thanks

Kevin

former_member190756
Active Contributor
0 Kudos

I have overseen that the BADI is only for internal use. But there should be also a User Exit at the same place that you could use.

Best regards,

Steffen

former_member583013
Active Contributor
0 Kudos

Yes you can use the SAVE_DOCUMENT user exit instead but don't forget to deactivate the SAP EM BAdI in that case.

Answers (4)

Answers (4)

former_member583013
Active Contributor
0 Kudos

Looks like sufficient info has been provided to mark as closed.

Former Member
0 Kudos

Below are techniques for external system communication via SAP PI with SAP EM:

1. Sending Event Message

>> BAPI EventHandler.AddEventMessages02 (remote-enabled function module / SAPTRX/BAPI_EH_ADDEVENTMSG_02)

>> IDoc EVMSTA02

2. Fetching Event handler data

>> BAPI EventHandler.GetData (RFC) / SAPTRX/ BAPI_EH_GET_DATA

>> IDoc None

3. Creating or updating event handlers

>> BAPI EventHandler (RFC) SAPTRX/BAPI_EH_POST)

>> IDoc EHPOST01

The interfaces of BAPIs and IDocs have the same content, but there are three major differences between the two:

- An IDoc has a hierarchical structure, whereas a BAPI has flat one.

- A BAPI has a wider available interface and allows files to be sent as attachments.

- A BAPI interface has indicators that allow you to control event message processing (for example, synchronous or asynchronous processing).

Itu2019s worth mentioning that IDocs arenu2019t automatically generated based on BAPIs. Event messages are derived from the EDI message standards (for example, EDIFACT) and converted into IDoc format. BAPI interfaces have a set of parameters

that function as the interfaces of the function module of the underlying BAPI. The BAPI interface consists of a set of input parameters and a set of output tables.

Hope this helps,

Sandeep

former_member583013
Active Contributor
0 Kudos

I would agree with Steffen except for one other consideration... Failures...

In which system do you want to deal with the Event posting failures? If the user that will deal with potential issues sits in a tradition SAP environment then it may be an option to generate an Idoc and send it to SAP EM and if it fails to post have the standard IDoc error handling deliver the error to the user for resolution. If it's in PI using the RFC adapter the error would be available in PI only for resolution.

Usually I steer people toward using IDocs for Asynchronous communication and RFCs / BAPIs for synchronous communication because of the IDocs inherent error handling mechanism but in this instance PI wraps the RFC up in an asynchronous process so this is not a factor in the decision.

former_member190756
Active Contributor
0 Kudos

Hello Rajesh,

if you go over PI i would recommend the BAPI via RFC Adapter.

IDOC would cause unnecessary overhead in your case.

Best regards,

Steffen