Please also have a look in our OnlineHelp for further information.

This example acquires the user names and the address data of all users in the SAP system.

Basis for this example is the function module BAPI_HELPVALUES_GET. This function module provides the use of selection parameters, because it contains an import Table (SELECTION_FOR_HELPVALUES)

static ArrayList getUserList(string sign, string option, string low, string high)
            R3Connection con = new R3Connection("SAPServer",
            RFCFunction func = con.CreateFunction("BAPI_HELPVALUES_GET");
            func.Exports["OBJTYPE"].ParamValue = "USER";
            func.Exports["METHOD"].ParamValue = "GETDETAIL";
            func.Exports["PARAMETER"].ParamValue = "USERNAME";
            RFCStructure shlp = func.Exports["EXPLICIT_SHLP"].ToStructure();
            shlp["SHLPNAME"] = "USER_ADDR";
            shlp["SHLPTYPE"] = "SH";
            RFCStructure sfh = func.Tables["SELECTION_FOR_HELPVALUES"].AddRow(); ;
            sfh["SELECT_FLD"] = "MC_NAMELAS";
            sfh["SIGN"] = sign;
            sfh["OPTION"] = option;
            sfh["LOW"] = low;
            sfh["HIGH"] = high;
            func.Execut e();
            ArrayList user = new ArrayList();
            for (int i = 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");
            return user;                           

For example we are going to display all users, whose name starts with M, on the console

static void Main(string[] args)
            ArrayList users = getUserList("I","CP","M*","");
            foreach (object userdetail in users)