2020 Dec 31 12:24 PM
Hi All,
I am trying get all users with certain filters like FirstName="somename", LastName=somename", pls. refer below, how can I pass logical oprtation like "or" , currently with below code it's always going as "and" operation, all the users where FIRSTNAME="Ellena" and LASTNAME="Clarc". But I want as FIRSTNAME="Ellena" or LASTNAME="Clarc"
Code using with .Net connector NCO 3.0,
IRfcFunction fnGetAllUsers = repo.CreateFunction("BAPI_USER_GETLIST");
IRfcTable selectionRange = fnGetAllUsers.GetTable("SELECTION_RANGE");
selectionRange.Append();
selectionRange.SetValue("PARAMETER", "ADDRESS");
selectionRange.SetValue("FIELD", "FIRSTNAME");
selectionRange.SetValue("SIGN", "I");
selectionRange.SetValue("OPTION", "EQ");
selectionRange.SetValue("LOW", "Ellena");
selectionRange.Append();
selectionRange.SetValue("PARAMETER", "ADDRESS");
selectionRange.SetValue("FIELD", "LastNAME");
selectionRange.SetValue("SIGN", "I");
selectionRange.SetValue("OPTION", "EQ");
selectionRange.SetValue("LOW", "Clarc");
Thanks,
Kumar
2020 Dec 31 1:17 PM
Hello,
try it using the SELECTION_EXP parameter, filling the first row with 'OR' and specification of 2 following selection criteria that has to be considered. See attached screenshot.
2020 Dec 31 1:17 PM
Hello,
try it using the SELECTION_EXP parameter, filling the first row with 'OR' and specification of 2 following selection criteria that has to be considered. See attached screenshot.
2021 Jan 06 6:27 AM
Thank you Jan, it's working as explained above.
Is it possible to do like below,
(FIRSTNAME='ELLENA' or LASTNAME='Clarc') AND (E_MAIL='test@test.com' or Department='Sales')
In my application user gets an option to choose the filters, with 'AND', 'OR' combinations.
2021 Jan 06 8:28 AM
Hello,
I think that this is not possible in a single call. So, for the selection you gave, you have to call the function module twice and use the intersection of both result lists.
2021 Jan 06 9:52 AM
2021 Jan 06 10:33 AM
Hello,
is it possible to search on UserName? Not sure what is the parameter value for Username?
selectionRange.Append();
selectionRange.SetValue("PARAMETER", "<???>");
selectionRange.SetValue("FIELD", "USERNAME");
selectionRange.SetValue("SIGN", "I");
selectionRange.SetValue("OPTION", "EQ");
selectionRange.SetValue("LOW", "Clarc");
2021 Jan 06 3:06 PM
Hello,
in that case you have to use the other parameter table SELECTION_RANGE.
2021 Jan 07 10:22 AM
Thanks Jan.
It's working even with selection exp, with out "Field" property.
selectionExpression.Append();
selectionExpression.SetValue("LOGOP", "AND");
selectionExpression.SetValue("ARITY", "0");
selectionExpression.Append();
selectionExpression.SetValue("PARAMETER", "USERNAME");
// selectionExpression.SetValue("FIELD", "USERNAME");
selectionExpression.SetValue("OPTION", "EQ");
selectionExpression.SetValue("LOW", "TestUserName1");