cancel
Showing results for 
Search instead for 
Did you mean: 

Monitoring data update in SQL DB from SAP MII

Former Member
0 Kudos

Greetings experts!

It is often needed to interact with data placed in SQL DBs from SAP MII to execute different transactions in SAP ERP. The most common scenario of SQL-to-MII interaction is described below:

  1. Select needed SQL-data;
  2. Insert selected data to SAP MII MDO;
  3. Proceed MDO data to execute SAP ERP transactions.

In common, I need to execute two basic actions: download data from SQL and transfer data to ERP.

I am not very expirienced in SAP MII, so I use the following approach to download data from SQL DB:

  1. Create BLS transaction to download SQL data. Transaction compares the last record in MDO and in SQL. If SQL DB has new records, they are downloaded in MDO.
  2. Create a scheduler task to execute that transaction in a specified period.

This approach works fine, but I think it's not a good practise. I need to run the download transaction periodically to monitor new records in SQL DB.

The question is: Is it possible to trigger MII download transaction from SQL? Maybe by webservice or another kind of messages that need to be placed in SQL trigger? If it is possible, I will not need to monitor new records in SQL DB all the time. The trigger will initiate the download and SQL data will be stored in MII MDO in online mode.

Any reply will be greatly appreciated!

Thanks in advance!

Best Regards,

Vitaliy

Accepted Solutions (1)

Accepted Solutions (1)

former_member204240
Active Participant
0 Kudos

Well, I can suggest

1. To write stored procedure in SQL and use trigger. Can send as message to MII and can be recieved through Message Listenser exposing the webservice.

2. Develop MII screen and provide to SQL user so that user clicks on some button when there is a change, so that button activity can run your transaction to make new insertions.

Former Member
0 Kudos

Hello, Padma

Thank you a lot for your answer. Sorry, but I've never worked with messages before.

I have three kinds of Message Listeners in MII: XMIIIDOC, XMIIRFC and XMIIMESSAGELISTENER. As I've understood I have to use the last one to communicate with SQL. Is that correct?

And how will I preceed the messages in MII? Should I use "Read Message" Action Block? Or maybe another one?

Can you please guide me how to set up this process?

Thank you for your time!

Best Regards,

Vitaliy

former_member204240
Active Participant
0 Kudos

Hi Vitaliy,

Can you just let me know where you pulling data? Is it from ERP? or some legacy system DB(some oracle or sql DB)?

I can say there are 3 Message Type and corresponding server or resource adapters used :

1. Web Service : XMIIMESSAGELISTENER

2. IDoc : XMIIIDOC01 to XMIIIDOC10

3. RFC : XMIIRFC01 to XMIIRFC10

Again, there are 2 types of Processing once you recieve any message to MII

1. Transaction --Synchronous Processing

2. Category -- Asynchronous Processing

Check link below for more understanding

Message Processing Rules (SAP Library - Message Services)

If you choosing Transaction, it is synchronous processing, If suppose using RFC to recieve data , then it immediately calls the MII linked transaction and executes. Even if second message is sent,it takes second message only after it process the first.

if you choosing Category, It is asynchronous and messages are stored in queue/data buffer which is retrieved and processed from queue using Message services actions in your Transaction and you should schedule transaction in Schedule Editor.

SAP Library - SAP MII Workbench

You can expose the webservice URL to get messages through message listener as below. You can test this in HTTP post action of MII.

"http://IP:Port/XMII/Illuminator?service=WSMessageListener&mode=WSMessageListenerServer&NAME=MessageN..."

Web Service Interface - Content Development - SAP Library

Just let me know where you getting data from to MII.So I can say what method is best.

Thanks,

Padma Rao

Former Member
0 Kudos

Hello Padma,

Thank you a lot for reply. I am getting data from MS SQL Database. Can you please suggest what method futs best?

Best Regards,

Vitaliy

former_member204240
Active Participant
0 Kudos

Hi Vitaliy,

Make use of XMIIMESSAGELISTENER and give an webservice url to send data when there is new data. In MII create a processing rule of type Transaction(I mean processing type is Transaction and link your download transaction)

You can use Webservice URL as below

http://IP:Port/XMII/Illuminator?Service=WSMessageListener&mode=WSMessageListenerServer&NAME=MessageN...

You can create single MII Transaction to get new data and send to ERP as below.

  1. XML file sent by SQL DB as an input to Web service which receives messages in Message listener and calls MII Transaction.
  2. Received XML will be checked with condition if New data and then saved in MII DB.
  3. Process the record to ERP.

Warm Regards,

Padma Rao

Answers (0)