You can use the gettableatribute command within a function to both extract the data from the table and to display it on the scren. In the following example, we will display the attributes of the All items table on the VA02 screen.
Open the Easy Access script file and enter the following code to create a pushbutton:
pushbutton([TOOLBAR], "Test Loop", {"process":test_loop});
Create a function that will be called when the pushbutton is pressed. An example is shown below::
function test_loop(){
onscreen 'SAPMV45A.0102'
set("F[Order]" , "14200");
enter();
onscreen 'SAPMV45A.4001'
gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow","lastvisiblerow":"LVisRow","lastrow":"LRow"});
absrow = 1;
relrow = 1;
if (FVisRow == 1){
goto new_row;
}
else{
enter("/scrolltoline=1",{"table":"T[All items]"});
goto new_screen
}
new_screen:
onscreen 'SAPMV45A.4001'
gettableattribute("T[All items]",{"firstvisiblerow":"FVisRow","lastvisiblerow":"LVisRow","lastrow":"LRow"});
relrow =1;
new_row:
if (absrow > LVisRow) {
enter("/scrolltoline=&V[absrow]",{"table":"T[All items]"});
goto new_screen
}
if (absrow > LRow){
goto table_end;
}
set("V[z_temp]" , "&cell[All items, Material,&V[relrow]]");
println(absrow + ".----------Material is: " + z_temp);
absrow++;
relrow++;
goto new_row;
table_end:
enter("/n");
}
Save the file and refresh the SAP screen.
Press the pushbutton to display the table attributes in the Console.