Skip to Content

Dynamic Queuing Or as Said Content Based Routing [ CBR ] for XML messages from PI to ECC

Hello experts  ,

I am a ABAPer , this struck me  when i was receiving loads of XML message from PI  ( in ECC ) which had  QOS as EO and they were placed in  dynamic queues for processing .

Due  to dynamic queues 2 Message which had to process same document ( Say a  Purchase Req. ) were processed simultaneously . Consequently locking it due to  simultaneous operation on same PR i.e. while one was being processed the  other xml message got error ‘Document is already being processed by  user….’

To  avoid this we changed  the QOS to EOIO so that  the message will be  processed one by one in order …after ..which  new issue popped up  which  was that  the Message started getting piled up in the dedicated queue  which was set up for EOIO Resulting into  long waiting queues …so the  messages were in scheduled state most of the time  / this was case with  the message which were potentially good which had to wait without any  reason ……… over come all such problem here  is a proposal …..

I have done similar to what The Guarneri has written in his blog

for but for some other handler class hope this helps

Hypothetical Situation  :

  • You      want to have Payload Content Based Serialization for XML message form PI      to ECC

               (Assume their  is nothing much you can do at PI Side )

  • When      you want to Over ride the Queue name sent by PI in ECC for customized       Process Management  eg. if you are using QOS as EOIO and have a      static Queue name and you want to change it as per your clients       business process so as to achieve better system performance by      setting dynamic queues for functionally dependent or independent XML       pay loads as per desired
  • When      you want to explicitly SET a Queue at ECC side  name with respect to      Quality of service /  Interface name space / Payload size  Or      content so on and so forth .

Possible Advantages:

  • Business      Advantages and necessity  of Serialization Of XML message is well      known.
  • More      over  for avoiding Problems Like Object/document  locking due to      parallel processing , Queue Stuck up , Time for processing  due to      static queue definition for all ‘good’  message waiting in Queue      which are likely to get posted without any error such and may be more       
  • Load      balancing  of the incoming messages

Assumption  :

Your Service is  :  engine ( Can be checked in SICF Tcode ->    Services – >default_host – >  sap- >  xi-> engine  )
Check for handler class for the service ‘engine’  it will be engine CL_XMS_HTTP_HANDLER
Your path will be : /default_host/sap/xi/

Real Time scenario  :

Landscape : NON SAP System → PI → ECC System
Interface is simple Purchase Requisition  Create and Change Using i.e ( PR present in ECC Change it or else create )
You have set QOS to EOIO with a Static queue name ‘PRCREATECHANGE’ .
Case 1 :
Now say  at certain moment of time your queue contains 100  XML  message and the queue is processing and suddenly during execution of certain XML message there is a exception , This will block the queue and subsequently all the potentially good message will be in scheduled state Unless one one frees the queue by fishing out the faulty message from the queue and restart the queue again .
Case 2
Take  ideal condition that your queue free flowing but contains 1000 Message in the case the execution is from 1 message to 1000th message the Last message has to wait in the queue un-neccesserly for 999 messages to pass from the queue thus increasing the Scheduled state time of the message  which may be  was functionally independent of other messages .
Proposed Solution goes like this :


2.     In the method IF_HTTP_EXTENSION~HANDLE_REQUEST  of    class ZZCL_XMS_HTTP_HANDLER   line no 577 ( just after call of  CALL METHOD lv_xms_main_ref->get_message_properties ) write the code desired using the below hints

  • For reference rm ( it stands for Reliable Messaging ) you can use below method 





    • GET_CDATA          Delivers the HTTP body of this entity as character data

            i.e.    Server->request-> GET_CDATA will give the payload in Character format.

    • You       can Validate / authenticate / SET / Dissolve  on basis of data by writing simple code using above hints . It has many possiblity

Finally What you have to is to set the Newly created zee handler class instead of a standard on the  service as mentioned above

So after you have written the code  and  all is set…

For Cases we have taken    : The queue name will be set dynamically by our code say a Reference  or say Purchase req. number or say document type  so on and so as per  your wish  forth thus routing the documents/payload  to Dynamically set  queus  avoiding the long waiting queues and locking and scheduled message  solving our purpose as explained above .

You must be Logged on to comment or reply to a post.
  • First of all congratulations for writing this nice & informative blog.
    I would like to discuss some points with you, as I am not able to visualize couple of things (might be because of my short knowledge in ABAP)
    *) If we have more than 400 interfaces in our scenario, are you suggesting to customize the service for the interface in which we have Q related issues. All other interfaces will still follow automatic Q approach or not?
    *) Let say you are creating queues based on PO number and PI recieves 1000 PO #, this will create 1000 queues in ECC. Did you face situation like this and encounter any issues.
    *) Can you share the snipper of your code(where you make changes in service), so that we can use it as a refrence.

    Lalit Chaudhary

    • Thanks Lalit ,

      1. Yes you can do this for the interfaces you want rest will be intact as they are nothing will change for them ( for example  you can have the interface name space as a criteria ).
      2. Yes.. this will create 1000 Queues but the life  of those queues will be Very Very Short for example say Purchase order 4600000010 was edited 5 times in the source system then your Queue name would be X
      3. Sure will post the code snippit soon.