Skip to Content
0

How to display Lock Indicator from a table to display in HTML viewer Sap Personas 3

Nov 07, 2016 at 11:34 AM

91

avatar image

Hi all,

I have recently started to develop a new PA20 Display Flavor for our users. One requirement is to display a table on the main screen.

For this I used the excellent guide provided by Steve Rumsby:

https://blogs.sap.com/2015/11/26/custom-tables-in-personas-take-2/

This works superbly for me, however, what I am unable to do is to 'grab' the lock indicator as shown here:

and display it in my html view:

According to the debugger, this field within the display table is empty:

Although if I go to SE16N and view the field, there is an "X" there, although the field name appears to be slightly different.

Has anyone managed to achieve this themselves?

kind regards,

Ian

rfu83.png (10.9 kB)
y8cfq.png (15.6 kB)
1hojr.png (1.2 kB)
ioak6.png (2.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Kranthi Kumar Muppala
Nov 09, 2016 at 05:03 PM
0

Hi Ian,

It looks like an issue with the getCellValue function of the GuiTableControl and GuiGridView controls. Kindly create an incident, so we can provide a solution.

Alternatively, if you are creating your flavor for only SAP GUI for HTML, you can use the work-around described below.

If your function to copy table control content is based on our KB article Scripting: A Library of Useful Functions, create a new function within your script with a different name and with the following contents:

/**
 * Returns an array of rows containing information from the table control.
 * @param {string} sTableControlId - The ID of the table control.
 * @returns {Array[Object]} The contents array.
 */
copyTableContents = function(sTableControlId) {
    // Fetch the table and its columns
    var oTableControl = session.findById(sTableControlId),
        aColumns = oTableControl.columns,
        aContents = [],
        nTopRow,
        oRow,
        sColumnName,
        nRowIndex,
        i,
		sCellValue;
    if (oTableControl.rowCount > 0) {
        //Set the visible row to 0
        oTableControl.firstVisibleRow = 0;
        //Get the Max visible row number
        nTopRow = oTableControl.visibleRowCount - 1;
        //Loop through all the rows
        for (nRowIndex = 0; nRowIndex < oTableControl.rowCount; nRowIndex++) {
            oRow = {};
            if (nRowIndex > nTopRow) {
                // Set the first visible row to the next set of rows. If the next set goes beyond the maximum rows,
                // adjust it so that the set's last row is the table's last row.
                if (nTopRow + oTableControl.visibleRowCount > oTableControl.rowCount) {
                    oTableControl.firstVisibleRow = oTableControl.rowCount - oTableControl.visibleRowCount;
                } else {
                    oTableControl.firstVisibleRow = nTopRow + 1;
                }
                nTopRow += oTableControl.visibleRowCount;
            }
            // Populate the row information.
            for (i = 0; i < aColumns.length; i++) {
                sColumnName = aColumns.elementAt(i).name;
				sCellValue = oTableControl.getCellValue(nRowIndex, sColumnName);
				try{
					if(!sCellValue){
						sCellValue = session.findById(sTableControlId + "/txt" + sColumnName + "[" + i + "," + nRowIndex + "]").getProperty("IconId");
					}
                
				} catch (oError){
					// Ignore any errors.
				}
				oRow[sColumnName] = sCellValue;
				
            }
            // Break after the first blank row - the values usually contain all underscores like "____" for a 4 character column.
            if (oRow[aColumns.elementAt(0).name] && !oRow[aColumns.elementAt(0).name].replace(/_/g, "")) {
                break;
            }
            aContents.push(oRow);
        }
    }
    return aContents;
};

The changes to the original function is mainly in the try-catch block where the individual cell is accessed and the server side property IconId is used to read the icon's ID.

Kindly note that this works only for GUITableControl and is an unofficial way to access the icon ID and may change without notice and will only work in SAP GUI for HTML.

Best regards
Kranthi

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Kranthi,

Thank you, yes i did use the copy table control content is based on your KB article, and then the other guide to help display it.

I have used your code and i do now see S_LOCL in my html viewer so at least it now gives a visual indicator (albeit not the icon), but at least you know the record is locked.

I have also raised a call as you have suggested which is 400477 / 2016

thanks again,

Ian

0

Thanks Ian. I see the incident and will work on a solution.

1
Kranthi Kumar Muppala
Nov 07, 2016 at 10:15 PM
0

Hi Ian,

Are you using an RFC to fetch the table information? If it is a standard RFC, is it possible there is a bug? Did you test the FM in SE37?

If you are using the getCellValue function of the GuiTableControl/GuiGridView, please let me know and I will check if it is a bug.

Best regards

Kranthi

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Kranthi,

Thank you for your response. I have actually saved the code to get the table information within the javascript library so I can call upon it in different scenarios as and when I need it.

When I run it through debugger i see no errors, and yes I do use getCellValue within the script:

oRow[sColumnName] = oTableControl.getCellValue(nRowIndex, sColumnName);

I would attach the script to this reply, but I'm unable to attache txt or word files for some reason.

kind regards,

Ian

0