cancel
Showing results for 
Search instead for 
Did you mean: 

Pass "RowCount" dynamically from irpt page to Sql query in SAP MII

Former Member
0 Kudos

Hello Everyone,

I want to download all rows in result set.I am using sql query to get details.I want to pass row count dynamically from irpt to sql query so that I can get all rows in result.Could you please help with this.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Deepali,

Here are the 2 ways you can pass RowCount to SQL query via IRPT.

1) Using PARAM of the applet

2) Using JS function setRowCount()

It will display the Grid with 5 rows.

after clicking on setRowCount it will send row count as 10 and it will show 10 records in Grid.

If you dont know the number of rows, you need to Run a query and get the total number of rows and then pass it dynamically using setRowCount() method

so that you will get all the data in SQL table.

Regards,

Sriram

Former Member
0 Kudos

If you wanna fetch the actual no of rows from the SQL table.

Create a small query like this which will just fetch the RowCount.

Select count(*) as R_Count  from <Table_Name>

Then in IRPT you can do a JQuery AJAX call like or do a XML AJAX call

<!DOCTYPE HTML>

<HTML>

<HEAD>

  <TITLE>Your Title Here</TITLE>

  <META http-equiv="X-UA-Compatible" content="IE=edge">

  <META http-equiv='cache-control' content='no-cache'>

  <META http-equiv='expires' content='0'>

  <META http-equiv='pragma' content='no-cache'>

  <SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js" data-libs="i5Chart,i5Grid,i5SPCChart,i5Command"></SCRIPT>

  <SCRIPT>

var rowCount;

// JQUERY AJAX---------

$.ajax({

            type: 'POST',

  url:'/XMII/Illuminator?QueryTemplate=Regression_15.0/SCN/iGrid_ColumnHeading/RowCount&content-type=text/json',

            success: function(data)

  {

   rowCount=data.Rowsets.Rowset[0].Row[0].R_Count;

  alert("RowCount " + rowCount + " Rows");

  //alert(data);

          }

            });

// XML AJAX---------

           var url = '/XMII/Illuminator?QueryTemplate=Regression_15.0/SCN/iGrid_ColumnHeading/RowCount&content-type=text/xml';

  var data,parser,xmlDoc;

  var xmlhttp;

  if (window.XMLHttpRequest)

  {// code for IE7+, Firefox, Chrome, Opera, Safari  

              xmlhttp=new XMLHttpRequest();}

      else

  {// code for IE6, IE5

              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  }

                xmlhttp.onreadystatechange=function()

         {

                if (xmlhttp.readyState==4 && xmlhttp.status==200)

                {

alert(xmlhttp.responseText);

rowCount= $(xmlhttp.responseText).find("R_Count").text();

alert(rowCount);

//data=xmlhttp.responseText;

  //alert(data.getElementsByTagName("Col1")[0].childNodes[0].nodeValue);

// alert(data);

                }

           }

  xmlhttp.open("GET",url,true);

  xmlhttp.send();

  </SCRIPT>

</HEAD>

<BODY>

</BODY>

</HTML>

So you can do this call 1st to get the actual[exact] number of rows in the SQL table.

and then set it dynamically in the way which i mentioned earlier.

Regards,

Sriram

Answers (1)

Answers (1)

abhinaste
Explorer
0 Kudos

Hi,

While calling the SQL query from the page and while preparing URL for the query add extra parameter as &Rowcount=* and then execute it.

Regards,

Abhijeet