Hi,
I'm facing an issue in building a SELECT query with WHERE operation. I do not know if I'm using a wrong technique to build it. Can anybody help me out with this?
For example I'm trying to build a query like:
SELECT <attribute1>, <attribute2>, .... FROM <table name> WHERE <one attribute>=<value> AND <another attribute>=<some value> .....
Then I need to populate certain text boxes with the data thus obtained.
So far I have done: (I'm using the standard BAPI, BAPI_BANK_GETDETAIL)
Query query = new Query(); query.select("x.STREET, x.BANK_GROUP, x.BANK_NAME, x.BANK_NO, x.REGION, x.CITY"); query.from("Bank_details", "x"); AttributeTest at1 = new AttributeTest(); at1.setAttribute("BANK_NO"); at1.setValue(edtKey.getText().toString()); AttributeTest at2 = new AttributeTest(); at2.setAttribute("BANK_GROUP"); at2.setValue(edtCtry.getText().toString()); at1.and(at2); query.where(at1); QueryResultSet rs = SAPBankDemoDB.executeQuery(query); String street = rs.getString(1); String bank_ctry = rs.getString(2); String bank_name=rs.getString(3); String bank_key = rs.getString(4); String region = rs.getString(5); String city = rs.getString(6);
However, on debugging I see, the query is only built as:
SELECT x.STREET, x.BANK_GROUP, x.BANK_NAME, x.BANK_NO, x.REGION, x.CITY FROM Bank_details
Please guide me as to where I'm going wrong and what is the correct way to fetch records using query. Note: I do not want to fetch records using findByPrimaryKey() operation.
Thanks in advance!
Tags edited by: Michael Appleby