Purpose:
Add Inputfield values to SAP table using pushbutton.
Below example demonstrates adding inputfield values created on the VA02 screen to the "All items" table.
Liquid UI Code:
-------------------------------------------------------------------------------------
Script File Name: SAPMV45A.E0102.sjs
-------------------------------------------------------------------------------------
//User Interface
del("G[Search Criteria]"); //Deletes Search Criteria group box
comment([4,2], "Item Material Order Quantity Plnt");
inputfield([5,2], {"name":"z_va02_item", "size":6,"nolabel":true});
inputfield([5,9], {"name":"z_va02_mat", "size":15,"nolabel":true});
inputfield([5,25], {"name":"z_va02_qty", "size":15,"nolabel":true});
inputfield([5,41], {"name":"z_va02_plnt", "size":4,"nolabel":true});
pushbutton([2,59],"Add Values To SAP Table", {"process":addValuesToSAPtable});
//Function to add values in the inputfield to SAP table
function addValuesToSAPtable(){
onscreen "SAPMV45A.0102"
enter();
onscreen "SAPMSDYP.0010"
enter();
onscreen "SAPMV45A.4001"
var absrow = 1;
var relrow = 1;
NEW_SCREEN:;
enter("/scrolltoline=&V[absrow]", {"table":"T[All items]"});
onscreen "SAPMV45A.4001"
relrow = 1;
gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LRow"});
NEW_ROW:;
if(absrow > LVisRow){
goto NEW_SCREEN;
}
if(absrow > LRow){
goto END_OF_TABLE_SCROLL;
}
relrow++;
absrow++;
goto NEW_ROW;
END_OF_TABLE_SCROLL:;
//Adding inputfields values to the All items table
set("cell[All items,Item,&V[relrow]]","&V[z_va02_item]");
set("cell[All items,Material,&V[relrow]]","&V[z_va02_mat]");
set("cell[All items,Order Quantity,&V[relrow]]","&V[z_va02_qty]");
set("cell[All items,Plnt,&V[relrow]]","&V[z_va02_plnt]");
set('V[z_*]',''); //it clears the values in the inputfield
enter('/11');
onerror //It navigates to VA02 screen if there is an error
message(_message)
enter('/nva02')
}