‎2011 Jun 27 8:30 AM
why doesnt this select query work....??
Am confused bcoz i need to check BLART from a set function and AUGBL and BELNR from internal table of type BSEG.
SELECT * FROM bsas INTO TABLE it_bsas
for ALL ENTRIES IN t_set_values
where blart <> t_set_values-from(2)
GROUP BY augbl belnr
HAVING augbl = i_bseg1-augbl
and belnr = i_bseg1-belnr.
following is the error message :
The addition "GROUP BY" only makes sense with a field list.
‎2011 Jun 27 8:42 AM
1 . the use of blart is not correct it should be blart = itab-field .
2. Group by is obsolete and puts extra load on the server and lead to poor performance . Instead process the data in the internal table after selecting without group by from data base .
‎2011 Jun 27 9:36 AM
thanks for the reply.
t_set_values is the set function
i just missed the equal sign .....but the problem is
how can i check the data from i_bseg1 itab even with comparing belnr augbl from i_bseg1 table...
DATA: t_set_values TYPE TABLE OF rgsb4 WITH HEADER LINE,
wa_itabsetvalues TYPE rgsb4,
itab_set_values LIKE TABLE OF t_set_values.
DATA: BEGIN OF xyz OCCURS 0,
value TYPE bkpf-blart,
END OF xyz.
DATA it_bsas TYPE TABLE OF bsas WITH HEADER LINE.
CALL FUNCTION 'G_SET_GET_ALL_VALUES'
EXPORTING
client = sy-mandt
FORMULA_RETRIEVAL = ' '
LEVEL = 0
setnr = 'ZHDFC_SET_DOCTYPE'
VARIABLES_REPLACEMENT = ' '
table = 'BKPF'
class = '0000'
NO_DESCRIPTIONS = 'X'
NO_RW_INFO = 'X'
DATE_FROM =
DATE_TO =
fieldname = 'BLART'
TABLES
set_values = t_set_values
EXCEPTIONS
SET_NOT_FOUND = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SELECT * FROM bsas INTO TABLE it_bsas
for ALL ENTRIES IN t_set_values
where blart = t_set_values-from(2)
GROUP BY augbl belnr
HAVING augbl = i_bseg1-augbl
and belnr = i_bseg1-belnr.