‎2011 Sep 07 7:41 PM
Hello Experts,
I'm trying to write a simple Aggregate Select statement to count POSNR from VBAP but having a short dump saying 'Error in module RSQL of the database interface'. Can anybody see what's wrong with the following statement.
select vbeln posnr kdmat cuobj
into table t_sales_order
from vbap
where vbeln = pv_pin_number (user input parameter)
describe table t_sales_order lines lv_lin.
read table t_sales_order into lwa_sales_order index lv_lin.
-
> Error select count( distinct posnr ) from vbap
into gv_posnr
where vbeln = lwa_sales_order-vbeln.
Many thanks in advance.
‎2011 Sep 07 7:51 PM
‎2011 Sep 07 7:48 PM
There should be further information about the error. Please share it.
Rob
‎2011 Sep 07 7:51 PM
‎2011 Sep 07 8:02 PM
HI
I copied the same code and did some small modificatio.
I have replaced the GV_POSNR with V_COUNT and declared it as INT4. The COUNT holds only upto INT4 values.
It is working for me. Please change the data type of VG_POSNR to INT4.
Please a break on select count statement and check the index of LV_LIN value and also the VBELN.
Check how many entries are there for the same VBELN.
types : begin of ty_vbap,
vbeln type vbak-vbeln,
posnr type vbap-posnr,
kdmat type vbap-kdmat,
cuobj type vbap-cuobj,
end of ty_vbap.
Data : t_vbap type table of ty_vbap,
wa_vbap type ty_vbap,
lv_lin type i,
v_count type int4.
select vbeln posnr kdmat cuobj
into table t_vbap
from vbap
up to 2000 rows.
describe table t_vbap lines lv_lin.
read table t_vbap into wa_vbap index lv_lin.
*----> Error
select count( distinct posnr ) from vbap
into v_count
where vbeln = wa_vbap-vbeln.
write : v_count.
SHIVA
‎2011 Sep 07 8:08 PM
Many thanks folks, It was data type which caused error. Instead of keep gv_posnr as type i I'd it type posnr.
Thanks again