cancel
Showing results for 
Search instead for 
Did you mean: 

use iCommand to show XML Output Messages

Former Member
0 Kudos
Hi masters.
I have a MII Transaction (12.2.2) that returns this xml:

<?

xml version="1.0" encoding="UTF-8" standalone="no"?><Rowsets CachedTime="" DateCreated="2012-08-25T16:37:26" EndDate="2012-08-25T16:37:26" StartDate="2012-08-25T15:37:26" Version="12.2.2 Build(212)"><Rowset><Columns><Column Description="" MaxRange="1" MinRange="0" Name="CONSUMO_ACIMA_TOLERANCIA" SQLDataType="4" SourceColumn="CONSUMO_ACIMA_TOLERANCIA"/><Column Description="" MaxRange="1" MinRange="0" Name="CONSUMO_ABAIXO_TOLERANCIA" SQLDataType="4" SourceColumn="CONSUMO_ABAIXO_TOLERANCIA"/><Column Description="" MaxRange="1" MinRange="0" Name="CONSUMO_OK" SQLDataType="4" SourceColumn="CONSUMO_OK"/><Column Description="" MaxRange="1" MinRange="0" Name="QTD_DIFERENCA" SQLDataType="8" SourceColumn="QTD_DIFERENCA"/></Columns></Rowset><Messages><Message>Nº equipamento não informado</Message><Message>Unidade de medida do registro não informado</Message><Message>Dispositivo de saída não informado</Message><Message>Nº reserva / necessidades dependentes não informado</Message><Message>Nº item da reserva / das necessidades dependentes não informado</Message></Messages></Rowsets>

I just need to know how to show the these messages in a IRPT screen:

<Messages><Message>Nº equipamento não informado</Message><Message>Unidade de medida do registro não informado</Message><Message>Dispositivo de saída não informado</Message><Message>Nº reserva / necessidades dependentes não informado</Message><Message>Nº item da reserva / das necessidades dependentes não informado</Message></Messages>

But I still didn´t find the method of the applet to use, this is my applet call and HTML button:
         <input type="button" value="Confirma (F11)" onClick="javascript:confirmarReserva()">
  <APPLET NAME = "appletConfirmarReserva" CODEBASE="/XMII/Classes" CODE="iCommand" ARCHIVE="illum8.zip" WIDTH="1" HEIGHT="1" MAYSCRIPT>
  <PARAM NAME = "QueryTemplate" VALUE="MonitorFracionamento/Query/ConfirmarReservaQuery">
</APPLET>
And this is the javascript function:
function confirmarReserva(){
var peso = document.getElementById("balancaPeso").value;
peso = peso.replace(",",".");
var applet = document.appletConfirmarReserva;
applet.getQueryObject().setParam(1, document.getElementById("DOCUMENTO_SEL").value );
applet.getQueryObject().setParam(2, document.getElementById("ORDEM_ITEM_NUM_SEL").value );
applet.getQueryObject().setParam(3, document.getElementById("balancaPeso").value );
applet.getQueryObject().setParam(4, document.getElementById("balancaPesoUM").value);
applet.getQueryObject().setParam(5, document.getElementById("etiquetaBalanca").value );
applet.getQueryObject().setParam(6, document.getElementById("etiquetaImpressora").value);
var cmd = document.appletConfirmarReserva.executeCommand();
alert( applet.hasResults() );
alert( applet.getRowCount() );
alert( applet.getColumnCount() );
}
Please how can I do to show the content of the Messages node ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

If you're not set on using the iCommand or Applets you can use AJAX and the MII Runner functionality.

Call the MII Runner in an AJAX call (This executes your transaction)

The AJAX call will return the raw XML in a string.

Use the browsers XML DOM objects to parse out the string.

You can then use the XML DOM's getElementsByTag("Message") to get all the XML nodes labeled Message.

Do what you want with your list of XML nodes containing the text.

I can give you some pointers on how to use the AJAX and XML DOM stuff if needed.

Former Member
0 Kudos

anybody could help me please ?

agentry_src
Active Contributor
0 Kudos

Hi Michel,

I ran your messages through Google Translate and it would appear that these are all error messages returned by your Query Template.  What is the nature of your query template?  Do you have the query template embedded in a transaction?  How do you want to handle error messages separately from standard query results?

Regards, Mike

<messages> <Message> No. equipment uninformed </ Message> <Message> Unit of measure of the record uninformed </ Message> <Message> Output Device Not Set </ Message> <Message> No reservation / dependent requirements uninformed </ Message> <Message> no item of reservation / dependent needs uninformed </ Message> </ Messages>

Regards, Mike

Former Member
0 Kudos

Michael, I have a XacuteQuery and its transaction executes a RFC, the messages that I should show in the screen are the messages returned by the RFC.

in this step I create the SAP MII XML Output Document:

in this step I create the SAP MII XML Output Messages:

here I assigned the output XML of this transaction:

and finally, after executing the xAcuteQuery on the IE browser, I have this XML output:

agentry_src
Active Contributor
0 Kudos

Hi Michel,

Rather than add Messages to the MII XML Document you created, you may want to simply use a repeater to add a Row with each message being added to a field named ErrorMsg (I would stay away from naming it Message).  Then you can simply create Grid display template to use with your applet.  You may need a javascript if statement to determine whether you are receiving error messages or valid data which would change the display template for one to the other.  If I misunderstood your goal, please advise.

Regards, Mike

Former Member
0 Kudos

Michael, in other developments I developed like you said, but now I cannot change this XML Document structure because it has been used in other processes.

There isn´t any way to catch these messages ? If not I will need to change to full server-side processing and catch these messages with xsl.

agentry_src
Active Contributor
0 Kudos

Hi Michel,

I don't know if there is another way of capturing multiple error messages and presenting them.  I always went with what I suggested.  In 12.2 there are built in error handlers which may have some capability to do what you want, but I don't have a lot of experience working with them.  Maybe someone with more practice can answer your question?  I will see if I can get someone else to respond who may have other ideas.

Regards, Mike

Former Member
0 Kudos

Thank you a lot Michael.

I am working with 12.2.2 MII version and still didn´t find how to handle these messages using the applet, now I believe it is not possible, so I have to change my development to full server-side processing because the applets can not handle the messages  

agentry_src
Active Contributor
0 Kudos

Hi Michel,

You may want to look at the SP3 and SP4 releases to see if they hold the solution.

Regards, Mike