public async Task <Material> GetMaterialAsync(string materialCode) { List <string> whereClause = new AbapQuery().Set(QueryOperator.Equal("MATNR", materialCode)) .And(QueryOperator.NotEqual("LVORM", true, RfcDataTypes.BOOLEAN_X)).GetQuery(); using IRfcClient sapClient = _serviceProvider.GetRequiredService <IRfcClient>(); return((await sapClient.GetTableDataAsync <Material>(whereClause)).FirstOrDefault()); }
public Material GetMaterial(string materialCodePrefix, bool getUnsafeFields = true, int rowCount = 0) { var query = new AbapQuery().Set(QueryOperator.Equal("MATNR", materialCodePrefix)) .And(QueryOperator.NotEqual("LVORM", true, RfcTablePropertySapTypes.BOOLEAN_X)).GetQuery(); using IRfcConnection connection = _serviceProvider.GetService <IRfcConnection>(); connection.Connect(); using IReadTable <Material> tableFunction = _serviceProvider.GetService <IReadTable <Material> >(); List <Material> result = tableFunction.GetTable(connection, query, rowCount: rowCount, getUnsafeFields: getUnsafeFields); return(result.First()); }