Skip to Content
0
Former Member
May 31, 2011 at 10:12 AM

sql , how to get cost elements in cost element group in sql statement ?

127 Views

sql , how to get cost elements in cost element group in sql statement ?

hello everyone.

i need some help.

i want to get data from bseg which have gl = cost element in cost element group

such as cost element group "promo_allo"

have cost element = 496362,496341,496335

i know that cost element group keep in table "setleaf"

in table "setleaf"

record 1

setname = "promo_allo"

valfrom = 0000496362 = gl

record 2

setname = "promo_allo"

valfrom = 0000496341

record 3

setname = "promo_allo"

valfrom = 0000496335

but i donot know how to get data from table bseg which have gl = cost element in cost element group

SELECT BUKRS BELNR BUZEI GJAHR LIFNR DMBTR MWSKZ SGTXT HKONT

INTO TABLE T_BSEG

FROM BSEG

FOR ALL ENTRIES IN T_DOC_HEADER

WHERE BUKRS = T_DOC_HEADER-BUKRS AND

BELNR = T_DOC_HEADER-BELNR AND

GJAHR = T_DOC_HEADER-GJAHR AND

LIFNR IN S_LIFNR

HKONT = ????????????????????????????????????????

.

please advice