tags:

views:

37

answers:

2

i am supposed to fetch the a field say excep_point from a table z_accounts for the combination of company_code and account_number.How can i do that in abap ? suppose the the table structure is zaccounts(company_code,account_number,excep_point) for the sake of this example.

+2  A: 

Assuming you have the full primary key...

data: gv_excep_point type zaccounts-excep_point.

select single excep_point
into gv_excep_point
from zaccounts 
where company_code = some_company_code
 and account_number = some_account_number.

if you don't have the full PK and there could be multiple values for excep_point

data: gt_excep_points type table of zaccounts-excep_point.

select excep_point
into table gt_excep_points
from zaccounts 
where company_code = some_company_code
 and account_number = some_account_number.

There is at least another variation, but those are 2 I use most often.

Bryan Cain
A: 

In addition to Bryans answer, here is the official online documentation about Open SQL.

vwegert