This sample shows how to read the user names and address data of all users in the SAP system using the function module BAPI_HELPVALUES_GET.
Call BAPI_HELPVALUES_GET
The following sample code reads user names and address data of SAP users using uses selection parameters for the import Table (SELECTION_FOR_HELPVALUES) of BAPI_HELPVALUES_GET.
staticArrayListgetUserList(stringsign,stringoption,stringlow,stringhigh){// Set your ERPConnect licenseLIC.SetLic("xxxx");// Open the connection to SAPusingvarconnection=newR3Connection(host:"server.acme.org",systemNumber:00,userName:"user",password:"passwd",language:"EN",client:"001"){Protocol=ClientProtocol.NWRFC,};connection.Open();RFCFunctionfunc=connection.CreateFunction("BAPI_HELPVALUES_GET");func.Exports["OBJTYPE"].ParamValue="USER";func.Exports["METHOD"].ParamValue="GETDETAIL";func.Exports["PARAMETER"].ParamValue="USERNAME";RFCStructureshlp=func.Exports["EXPLICIT_SHLP"].ToStructure();shlp["SHLPNAME"]="USER_ADDR";shlp["SHLPTYPE"]="SH";RFCStructuresfh=func.Tables["SELECTION_FOR_HELPVALUES"].AddRow();;sfh["SELECT_FLD"]="MC_NAMELAS";sfh["SIGN"]=sign;sfh["OPTION"]=option;sfh["LOW"]=low;sfh["HIGH"]=high;func.Execute();connection.Close();ArrayListuser=newArrayList();for(inti=0;i<func.Tables["HELPVALUES"].RowCount;i++){user.Add(func.Tables["HELPVALUES"].Rows[i,0]);}if(user.Count==0){user.Add("No results matching criteria");}returnuser;}
Display Users
How to display all users, whose name start with M: