cancel
Showing results for 
Search instead for 
Did you mean: 

passing data from one grid field to other field in different transactions

pakula123
Participant
0 Kudos

Hi Experts, I have to pass operation number that is selected in gird  from iw32  to gird in CAT2 where the next row is blank. I was able to get the data from iw32 but I am having issue passing in to cell in the row that is empty. How can I achieve this. Best regards, pradeep.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
but I am having issue passing in to cell

Perhaps if you told us what issue you were having, we might be more able to help...

Steve.

pakula123
Participant
0 Kudos

Hi Steve , I wanted to use Modify cell it did not work and then i tried using session.findid for cell but the issue i am having is  my count in for loop 'i' value is different from the one it shows on screen. for example i have grid with first two rows empty(uneditable mode) and third row with some value . so the next row number is 4 but on the screen it shows as second field where third row ( since row number starts with 0 its number here is 2 as per system)starting from  becomes first row after execution of script (is it because i set the first visible row to 2 ?) Could you please let me know if i can use modify cell in this case or how can i code for the cell id in this case .Either is fine if it works . Kindly suggest . Best regards, pradeep.

Former Member
0 Kudos

So you have discovered that the row count starts at 0, but that also you have to take into account the table's first visible row. That sounds like you need to add some subtraction to your calculation of the row number to use. Did you try that? Is that what isn't working? Could you post your code?

Steve.

former_member214137
Participant
0 Kudos

Hi,

Have you looked at ?

You situation sounds similar.

regards

Julian Christian

pakula123
Participant
0 Kudos

Hi Steve and Julian , My case is in the below thread as posted in the recent conversation that was mentioned by me the same post . I have 2 issues one is finding the next empty row and other is populating the values in to that cell . http://scn.sap.com/thread/3900885 i did some research last night and came up with this logic ......though the code is not the same i made a mockup  . I will try this once i get to office . var selectedTable = session.findById("wnd[0]/usr/tblSAPM_GUITEST_PORTABLETABLECONTROL")   if (selectedTable.rowCount > 0) {     //Set the visible row to 0     selectedTable.firstVisibleRow = 0;     //Get the Max visible row number     var topRow = selectedTable.visibleRowCount - 1;     //Loop through all the rows     for (var rowIndex = 0; rowIndex < selectedTable.rowCount; rowIndex++) {         if (rowIndex > topRow) {             // 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 (topRow + selectedTable.visibleRowCount > selectedTable.rowCount) {                 selectedTable.firstVisibleRow = selectedTable.rowCount - selectedTable.visibleRowCount;             } else {                 selectedTable.firstVisibleRow = topRow + 1;             }             topRow += selectedTable.visibleRowCount;         }     /////by now first visible row will be set so that there is no error .....i think so ....  lets test and see....if i get getCellValue(): rowIndex '4' is outside the visible range. Set property firstVisibleRow properly.///////////////// if(table.getCellValue(rowIndex, "CATSD-SUMDAYS")=='') {   session.findById("wnd[0]/usr/subCATS002:SAPLCATS:2200/tblSAPLCATSTC_CATSD/txtCATSD-DAY1[7,"+i+"]").text="4";   break;   } }///this is end of for loop }///this is end of if condition . Best regards, pradeep.

pakula123
Participant
0 Kudos

Hi Steve and Julian,

here is the code it was not readable in earlier post . if (selectedTable.rowCount > 0) {     //Set the visible row to 0     selectedTable.firstVisibleRow = 0;     //Get the Max visible row number     var topRow = selectedTable.visibleRowCount - 1;     //Loop through all the rows     for (var rowIndex = 0; rowIndex < selectedTable.rowCount; rowIndex++) {         if (rowIndex > topRow) {             // 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 (topRow + selectedTable.visibleRowCount > selectedTable.rowCount) {                 selectedTable.firstVisibleRow = selectedTable.rowCount - selectedTable.visibleRowCount;             } else {                 selectedTable.firstVisibleRow = topRow + 1;             }             topRow += selectedTable.visibleRowCount;         }           /////by now first visible row will be set so that there is no error .....i think so ....  lets test and see....if i get getCellValue(): rowIndex '4' is outside the visible range. Set property firstVisibleRow properly.///////////////// if(table.getCellValue(rowIndex, "CATSD-SUMDAYS")=='') {   session.findById("wnd[0]/usr/subCATS002:SAPLCATS:2200/tblSAPLCATSTC_CATSD/txtCATSD-DAY1[7,"+i+"]").text="4";   break;   }

Former Member
0 Kudos

If this is all the same problem - find a row and put something in it - why not keep it all in one thread? Likely the code to modify the cell will be intimately connected to the code that finds the empty row, so we may as well discuss them together. I suggest posting the code (formatted a little better ) in the other thread and closing this one...

Steve.

pakula123
Participant
0 Kudos

Hi Steve , I will do that. best regards, pradeep.

Answers (0)