Skip to Content
0

SAP Screen Personas - Address Non visible row

Dec 06, 2017 at 05:59 PM

45

avatar image
Former Member

We at Terumo BCT have implemented SAP Screen personas (service pack level 3) and are trying to simplify Purchase order creation screen. While creating Purchase order, we used a button on the screen to populate default values – so when the user hits the button, it populates default value like issuing storage location, receiving storage location and plant. It works for the rows which are visible on the screen, but doesn’t work for non-visible rows which will be visible only when scrolled down. The number of visible rows depends on the screen size – it varies. We are looking for a way to address this issue. Please let us know if this is a limitation on the screen personas – that this will work on visible screen rows rather than the whole table and if there is a better way to address this issue.

Note:

We tried to use rowCount, absolute rows, visible row property but couldn’t get pass this issue.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Brian Wills Dec 07, 2017 at 08:52 PM
0

You will need to use a combination of firstVisibleRow, rowCount, and visibleRowCount properties.

I use this function to read table contents, but you should be able to see how it scrolls the table and use these pieces as it pertains to you.

I attached the following code as a text document as well.

To call this:

var zTable = session.findById("wnd[0]/usr/tabsTABSTRIP_0300/tabpANWS/ssubSUBSCREEN:SAPLBSVA:0302/tblSAPLBSVATC_E");
var zContents = getTableContents(zTable);
//Read Table Contents
function getTableContents(zStatusTable)
{
	session.utils.log('=============================== Read Table Contents Function ===============================');
	var zFoundYa = false;
	var zContents = [];
	var zcolumns = zStatusTable.columns;
	var zname;
	var oRow = [];

	zXcolumnname = zcolumns.elementAt(0).name;       //X column
	zStatusColumnName = zcolumns.elementAt(1).name;  //Status column

	zStatusTable.firstVisibleRow = 0;
	var zStatusVisibleRows = zStatusTable.visibleRowCount - 1;  //Number of visable rows in the table (does not change).


	for(zCurrentRow = 0; zCurrentRow < zStatusTable.rowCount; zCurrentRow++)
	{
		oRow = {};  //clear the oRow variable - reinitialize it
		if(zCurrentRow > zStatusVisibleRows)
		{	
			if(zStatusVisibleRows + zStatusTable.visibleRowCount > zStatusTable.rowCount) //Make sure not to go past the last row in the table
			{
				zStatusTable.firstVisibleRow = zStatusTable.rowCount - zStatusTable.visibleRowCount;  
			}
			else
			{
				zStatusTable.firstVisibleRow = zStatusVisibleRows + 1;  //Pagedown in table
			}
			zStatusVisibleRows += zStatusTable.visibleRowCount;
		}

		//Populate columns 0 and 1 into oRow array
		for(i=0; i <= 1; i++)  // only want columns 0 and 1
		{
			zColumnName = zcolumns.elementAt(i).name;
			session.utils.log('zCurrentRow = ' + zCurrentRow + ', zColumnName = ' + zColumnName + ' Value = ' + zStatusTable.getCellValue(zCurrentRow, zColumnName));
			
			if(zStatusTable.getCellValue(zCurrentRow, zColumnName) == '____')
			{
				session.utils.log('Last Row - Exit For Loop');
				zFoundYa = true;
			}
				
			//Add data from table to the Array
			oRow[i] = zStatusTable.getCellValue(zCurrentRow, zColumnName);
		}


		if(zFoundYa === true)
		{
			break;
		}


		//Add Array to the Array
		zContents.push(oRow);
	}
	zStatusTable.firstVisibleRow = 0;
	return zContents;
}


Share
10 |10000 characters needed characters left characters exceeded