-
Create a pushbutton on the Easy Access screen that will make a call to a BAPI function. The code is as follows:
del("X[IMAGE_CONTAINER]");
pushbutton([2,1] , "Call Example" ,{"process":test_call});
-
Create an inputfield to sisplay the resulting message. The code is as follows:
inputfield([2,20],"1.Message", [2,50], {"name":"z_type", "size":"70"});
The screen now appears as follows:
-
Write a function to call the BAPI function. An example is shown below:
function test_call(){
call("BAPI_USER_GET_DETAIL",{"in.USERNAME":"&V[_user]","table.RETURN(width:3000)":"zguixt_return"});
println("return:"+zguixt_return);
for(i=0; i<zguixt_return.length; i++){
zguixt_var = zguixt_return[i].toString();
println("TYPE:"+zguixt_var.substring(0,1));
println("ID:"+zguixt_var.substring(1,21));
println("NUMBER:"+zguixt_var.substring(21,24));
println("MESSAGE:"+zguixt_var.substring(24,244));
}
set("V[z_type]" , zguixt_return[0].toString().substring(24,244))
}
Using the function, we can make a call to the specified BAPI function USER_GET_DETAIL. The input is the username, which is pulled from a table containing the user details. Once the requested data is returned, the function will print the user infromation into the consoel and will also display a message on the screen as shown below: