Liquid UI: Display count of new work items
This example is to create the logic to do RFC and get the list of work items for current user, in order to provide the count of returned data.
Allow user to notice if there is any new work item without checking inbox.
Step 1: Create logic to do RFC
//Specify read table rules
tmp_options = [("USER_ID = '" + _user + "'")];
tmp_fields = ["WI_ID"];
tmp_data = [];
//RFC
rfcResult = call("RFC_READ_TABLE", {"in.QUERY_TABLE":"SWWUSERWI",
"table.OPTIONS":"tmp_options",
"table.FIELDS":"tmp_fields",
"table.DATA(width:3000)":"tmp_data"});
//Verify potential RFC exception and returned data count
println("=====>>RFC_READ_TABLE Exception="+rfcResult.exception+"<==");
println("=====>>WI Count="+tmp_data.length+"<==");
Step 2: Create logic to reflect result on the screen
//Logic to change screen title to represent the work item count
if(tmp_data.length > 0){ //If returned data count is larger than 0
title(_title + ": New Work Item(s): " + tmp_data.length);
}
Note: By reading data from table SWWUSERWI, we're able to locate the ID of each work item.
Combine other FM to display general description on the screen can be another useful scenario.
See attachments for code samples