SapMaterial.com
Costelement groups
Tables:
SETCLST Set Class Descriptions
SETHEADER Set Header and Directory
SETHEADERT Short Description of Sets
T800S FI-SL Set Table (before Release 4.0)
Note: The SETCLASS for Costelement groups = 0102
1. Create SETID
The setid is a concatenation from SETCLASS + Chart of accounts + Setname
Setname is the name of the costelement group.
You can either make the concatenation yourself or use function module G_SET_ENCRYPT_SETID
G_SET_ENCRYPT_SETID
EXPORTING
SETCLASS = '0102'
SHORTNAME = 'CA705_MAT'
KOKRS = '1000'
KTOPL = 'INT'
Returns setid: 0102INT CA705_MAT
Note that SETID can be decrypted again using functionmodule DECRYPT_SETID
2. Read accounst
CALL FUNCTION 'G_SET_TREE_IMPORT'
EXPORTING
CLIENT = '800'
SETID = '0102INT CA705_MAT'
NO_VARIABLE_REPLACEMENT = 'X'
NO_TABLE_BUFFERING = 'X'
Example
REPORT z_test.
data:
li_SET_VALUES like setvalues occurs 0,
l_SET_VALUES like setvalues.
DATA:
l_setid LIKE sethier-setid.
PARAMETERS:
p_ktopl LIKE sethier-ktopl DEFAULT 'INT', "Chart of accounts
p_kokrs LIKE sethier-kokrs DEFAULT '1000', "Controlling area
p_setcls LIKE sethier-setclass DEFAULT '0102', "Set class
p_setnam LIKE setheader-setname DEFAULT 'CA705_MAT'. "Setname - Costelement group
START-OF-SELECTION.
* Create SETID
CALL FUNCTION 'G_SET_ENCRYPT_SETID'
EXPORTING
setclass = p_setcls
shortname = p_setnam
kokrs = p_kokrs
ktopl = p_ktopl
IMPORTING
setid = l_setid.
.
* Read accounts
CALL FUNCTION 'G_SET_TREE_IMPORT'
EXPORTING
SETID = l_setid
TABNAME = ' '
NO_VARIABLE_REPLACEMENT = 'X'
MAX_HIER_LEVEL = 99
TABLES
SET_VALUES = li_SET_VALUES.
END-OF-SELECTION.
loop at li_SET_VALUES into l_SET_VALUES.
write: /
l_SET_VALUES-from,
l_SET_VALUES-to.
endloop.
All of the product names here are trademarks of their respective companies. The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity. Information used on this site is at your own risk.