cancel
Showing results for 
Search instead for 
Did you mean: 

Design around Event message buffer concept

Former Member
0 Kudos

Hi Expert ,

I am designing a process around event message buffer concept .

I have a requirement where event should not be posted in EM if a specific indicator is not set in control parameter . In this case , event message should be saved in buffer and a batch job should be set which will try to process buffer event message .

These buffer event message should be processed if specific indicator is set otherwise message should again be stored in buffer .

There is a configuration where you can define the condition when event message should be buffered . However required field are fixed and there is no possibility to check specific indicator (control parameter ) .

Do you any idea how can I make use of above mentioned configuration for buffering event message .

Otherwise I do not think we have possibility to write a code in preprocessing function module to buffer message based on condition . Do we ?

Regards,

Rajesh Dwivedi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

My requirement is that I should be able to check a condition to decide buffering event message at both point of time .

1) At the time of BAPI trigger (event message processing )

2) At the time when process buffer event message run .

Regards,

Rajesh

Former Member
0 Kudos

Hi Rajesh,

For your point 2, you need a wrapper as I mentioned which checks the control param condition and decide if you want to post or wait in buffer. Without wrapper ( zprogram) it will simply post and not go via pre-processing.

Thanks,

Vishnu

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Steffan , Hi Vishnu ,

It seems I have 2 option .

1) Wrapper around Event message BAPI (As per Steffan)

2) Wrapper around /SAPTRX/PROC_BUFF_MSG_02 (As per Vishnu )

We are facing issue for EDI carrier and EDI message is directly mapped to WEBSERVICE in EM through PI . So i believe it will be more complicated if i go for option 1 . It seems option 2 works better considering the scenario .

Regards,

Rajesh

former_member190756
Active Contributor
0 Kudos

Hi Rajesh,

yes if you can live with the fact that you then buffer all incoming messages and check them later with the Report option 2 would be easier to implement.

In PI you could also create an RFC Adapter and map the messages to it. If you refer with WEBSERVICE to the EM ESA Service you should keep in mind that it can handle only one message per call.

Best regards,

Steffen

Former Member
0 Kudos

Hi ,

I was going through event message processing BAPI and understood that first preprocessing function module gets triggered and then buffering condition is triggered .

If I check specific control parameter field during preprocessing function module , then the program can decide if it has to be buffered and set buffer_mode = A .

Is there any possibility I can decide buffer mode=A in preprocessing function module and pass it to BAPI so that in next step , it buffer the event message .

If this solution do not work , I can change tracking code set to  X in prepreocessing FM (when specific control parameter is not available )

I can configure in buffering screen of customization that if tracking code set is X then buffer the message .

if specific control parameter is not available then tracking code set will be changed to Y and it will not go to buffer mode .

Will this solution work ?

In this way , I need not write any wrapper program .

Regards,

Rajesh

Former Member
0 Kudos

Hi ,

If I am able to do as mentioned above , then my worry is does "process buffered event message " work in the same way .

Does process buffer event message will run preprocessing FM first and then buffering ?

If it does not execute in this way then my requirement will not be achieved .

Regards,

Rajesh

Former Member
0 Kudos

Hi Rajesh,

Once you buffer a message, it will not flow through pre-processing again as you pre-processed it already in your first attempt of posting.

The buffered message when run through buffer posting program will directly proceed to rulesets and not go through /SAPTRX/BAPI_EH_ADDEVENTMSG_02.

Thanks,

Vishnu

Former Member
0 Kudos

Hi Rajesh,

As name suggest as preprocessing, it checks before processing the event when it is posting.  The buffer message goes after preprocessing check.

Check this Kevin post of processing sequence.

Regards


GGOPII

Former Member
0 Kudos

Hi Rajesh,

Just a suggestion.

Would you able to check your preprocessing functional module to make hard code value as "A" and pass onto  /SAPTRX/BAPI_EH_FLAGS-BUFFER_MODE when it fulfills the condition.  I haven't tried this but can you check.


Regards



GGOPII

Former Member
0 Kudos

Hi Gopi,

You mean't to say when posting a buffered message, it will go through pre-processing again?

Thanks,

Vishnu

former_member190756
Active Contributor
0 Kudos

Hi Rajesh,

buffer mode unfortunately cannot be changed inside pre processing.

In Buffer mode pre processing is not executed again. But you could copy the buffer report and adjust it to your needs. Then the way with changing the Tracking Code Set should work.

Best regards,

Steffen

Former Member
0 Kudos

Hi Gopi,

By now you might have realized that posting a buffered message will not go through pre-processing. Can you please remove or add comment/clarification in your post so that others will not design based on that.

Thanks,

Vishnu

Former Member
0 Kudos

HI Vishnu,

You have to read message again probably and there is no need to remove.

The buffered message code executes after preprocessing.

Regards


GGOPII

Former Member
0 Kudos

You have mentioned  /SAPTRX/BAPI_EH_ADDEVENTMSG_02. When you post buffer message, it doesn't go via /SAPTRX/BAPI_EH_ADDEVENTMSG_02.

Thanks,

Vishnu

Former Member
0 Kudos

Hi Rajesh,

Standard buffering config would not allow to check specific field and post it.

1. You can use preprocessing function to achieve this or

2. Try to implement and check in /SAPTRX/BADI_MESSAGE -> /SAPTRX/IF_EX_BADI_MESSAGE -> BEFORE_PROCESSING to post event with your check.

Check /SAPTRX/BAPI_EHADDEVENTMSG_02 - BUFFER_MODE

Regards


GGOPII

Former Member
0 Kudos

Hi Gopi ,

As far as i know , EM has following process of sequennce .

1) Check if event can be buffered

2) Trigger Preprocessing function module

There is no input field in preprocessing function module which can put event message in buffer save mode .

I think same case is with /SAPTRX/BADI_MESSAGE -> /SAPTRX/IF_EX_BADI_MESSAGE -> BEFORE_PROCESSING .

Please suggest .

Regards,

Rajesh

Former Member
0 Kudos

Hi Rajesh,

I just debugged and could see CALL BADI l_badi_message->before_processing calls after CALL FUNCTION '/SAPTRX/SPLIT_MESSAGE_TABLE_O2' in /SAPTRX/BAPI_EHADDEVENTMSG_02.


You need to tweak on the code to achieve this (I didn't try this) but can be achievable.


Check this call function /SAPTRX/SPLIT_MESSAGE_TABLE_O2 and check how code checks validation.


Regards



GGOPII




Former Member
0 Kudos

Hi Rajesh/Gopi,

/saptrx/badi_message is obsolete and this enhancement has been replaced by pre-processing functionality.

Thanks,

Vishnu

Former Member
0 Kudos

Hi Vishnu,

Could you explain in detail about OBSOLETE of BADI /SAPTRX/BADI_MESSAGE? Are you talking in generic or specific to buffer?

I checked in SAP service marketplace too but I can't find says like OBSOLETE.  I have done different solutions in previous and current projects based on this BADI.

Check these threads and Location Codes and descriptions | SCN

Regards


GGOPII

former_member190756
Active Contributor
0 Kudos

Hi,

yes the BADI is obsolete. Please use the Pre Processing functions instead.

It does the same as the BADI.

The buffering i need to check if it is somehow possible.

Best regards,

Steffen

former_member190756
Active Contributor
0 Kudos

Hi Rajesh,

only way i see would be:

You create a wrapper for the Event Message BAPI.

First you check your condition based on the Control Parameter.

The BAPI has an importing parameter BUFFER_MODE that also allows to switch on the buffer mode.

The Parameter has the following options:

SPACE Check Messages for Buffering (customizing settings)

A All Messages Buffered (no check)

N No Messages Buffered (no check)

Based on your check you could set it and enable buffering.

Set it to A    All Messages Buffered (no check) i.e. all messages are buffered -> customizing for buffering won't be checked.

-> see function module /SAPTRX/SPLIT_MESSAGE_TABLE_O2

If you have buffered and not buffered message in one call you have to call the BAPI twice one time with Buffer mode A and one time for the buffered buffer_mode = N.

Best regards,

Steffen

Former Member
0 Kudos

Thanks Steffen...

What is the alternative BADI for event message?

Regards


GGOPII

Former Member
0 Kudos

Gopi,

As I said before and by Steffen, you need to use pre-processing instead of Message BADI.

Thanks,

Vishnu

Former Member
0 Kudos

Hi Vishnu and Steffen.

There are few hiccups on preprocessing function that lit bit lack on performance side.

If you use BADI directly on enhancement and another through preprocessing then you can see performance difference in both.

Try and let me know.

Regards


GGOPII

former_member190756
Active Contributor
0 Kudos

Hi Gopi,

as the Preprocessing function evaluates the customizing settings this could only be the difference. But we never had any issues with performance calling the function module.

If you have any traces or examples that show a difference here please post it.

Best regards,

Steffen

Former Member
0 Kudos

Hi Steffen,

Yes we had an issue two months before for one of solution which we designed and moved to BADI.  I have another solution which I am proposing for preprocessing and I will send your runtime trace of both.

Regards


GGOPII

Former Member
0 Kudos

Not sure if you can send the message back to buffering from pre-processing but you can create a wrapper(zprogram) which checks if indicator is set and then only calls the standard buffer processing program.

Like Zprogram will SUBMIT the standard program /SAPTRX/PROC_BUFF_MSG_02 for each message which has indicator set.

Thanks,

Vishnu

Former Member
0 Kudos

Hi Vishnu ,

It should happen real time . As soon as event is triggered , event should be go to buffer .

Where you want me to trigger Z PROGRAM ?

Regards,

Rajesh

Former Member
0 Kudos

Hi Rajesh,

I meant to say, create ZPROC_BUFF_MSG_02 instead of /SAPTRX/PROC_BUFF_MSG_02 which you can run in the background.

In this Zprogram, for every message which is in buffer, check if your indicator is set in the control parameter, then submit the standard program /SAPTRX/PROC_BUFF_MSG_02 which will post the event. If no indicator is set, do nothing and the event will stay in the buffer until the condition is met.

Thanks,

Vishnu