SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Cost Center Hierarchy



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> CO
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Mon Oct 08, 2007 4:36 pm    Post subject: Cost Center Hierarchy Reply with quote

I made some utility program to my self
There is no one table that hold this data .
--
Ilch
Code:

REPORT ZGET_COST_CENTER_GROUP .
parameters : pcst_ctr like cobrb-KOSTL.
types : begin of typ_member_group,
member(15) type c,
end of typ_member_group.
TYPES : begin of icostgr , " USE FOR BAPI_COST_GROUP (STAGE 7 )
costgr(15) type C,
acttypegr(15) type C,A
priceview type price,
priceupd type price,
end of icostgr.
types : begin of typ_get_group,
group_name like GRPVALUES-SETID,
end of typ_get_group.
*DATA : IT_icostgr TYPE icostgr OCCURS 0 WITH HEADER LINE.
DATA : IT_icostgr LIKE bapi0012_cclist OCCURS 100 WITH HEADER LINE.
data l_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
data : tbl_get_group type typ_get_group occurs 0 with header line.
data : it_member_group type typ_member_group occurs 0 with header line.
DATA: global_unique_info TYPE flag,
get_val like GRPHP2 ,
ls_info LIKE grphinfo ,
ld_over LIKE sy-datar ,
get_nodes like GRPOBJECTS occurs 0,
get_value like GRPVALUES occurs 0 WITH HEADER LINE,
get_lines like GRPMDLINE occurs 0,
get_form like GRPFORMULA occurs 0,
get_info like GRPFLDINFO occurs 0,
get_objct TYPE GRPOBJECTS occurs 0,
TMP_GROUP(15) TYPE C.
data : tmp_SETID like GRPVALUES-SETID .
* TMP_GROUP(15) TYPE C.
*
data : begin of st_mbs ,
m type c value 'X' ,
b type c value 'X' ,
s type c value 'X' ,
end of st_mbs.

CALL FUNCTION 'K_HIERARCHY_TABLES_READ'
EXPORTING
E_CLASS = '0101'
E_SETID = '01011000RATE_IAI'
E_KOKRS = '1000'
E_MANDT = sy-mandt
E_MASTER_DATA = st_mbs
E_STRUCTURE = get_val
* E_REPLACE_CLASS =
* E_REPLACE_UNIT =
* E_REPLACE_TABLE = ' '
* E_REPLACE_FIELD = ' '
* E_SUFFIX =
E_OLD_LINE_LEVEL = '1'
* IMPORTING
* I_DOUBLE_CHECK = global_unique_info
* I_MASTER_DATA = get_val
TABLES
T_NODES = get_nodes
T_VALUES = get_value
T_MASTER_DATA = get_lines
T_FORMULA = get_form
T_FIELD_INFO = get_info
* T_NODE_LIST_OVERWRITE = get_objct
CHANGING
C_INFO = ls_info
C_OVERWRITE = ld_over
EXCEPTIONS
NO_CONTROLLING_AREA = 1
NO_CHART_OF_ACCOUNT = 2
DIFFERENT_CONTROLLING_AREAS = 3
DIFFERENT_CHART_OF_ACCOUNTS = 4
SET_NOT_FOUND = 5
ILLEGAL_FIELD_REPLACEMENT = 6
ILLEGAL_TABLE_REPLACEMENT = 7
FM_RAISE = 8
CONVERT_ERROR = 9
NO_OVERWRITE_STANDARD_HIER = 10
NO_BUKRS_FOR_KOKRS = 11
OTHERS = 12.

loop at get_value .
tmp_SETID = get_value-SETID.
at new SETID.
tbl_get_group-group_name = tmp_SETID.
append tbl_get_group.
endat.
endloop.
translate pcst_ctr to upper case.
loop at tbl_get_group.
clear : IT_icostgr , it_member_group .
refresh : IT_icostgr , it_member_group .
TMP_GROUP = tbl_get_group-group_name+8.
CALL FUNCTION 'BAPI_COSTCENTER_GETLIST1'
EXPORTING
CONTROLLINGAREA = '1000'
COSTCENTER_FROM = '1000'
* COSTCENTER_TO =
* COMPANYCODE_FROM =
* COMPANYCODE_TO =
* PERSON_IN_CHARGE_FROM =
* PERSON_IN_CHARGE_TO =
DATE_FROM = SY-DATUM
* DATE_TO =
COSTCENTERGROUP = TMP_GROUP
* BUSINESS_AREA_FROM =
* BUSINESS_AREA_TO =
* MASTER_DATA_INACTIVE =
TABLES
COSTCENTERLIST = IT_icostgr
RETURN = l_return
* EXTENSIONIN =
* EXTENSIONOUT =
.
loop at IT_icostgr .
it_member_group-member = IT_icostgr-COSTCENTER.
append it_member_group.
endloop.
*
loop at it_member_group.
if it_member_group-member cp pcst_ctr.
write : 'your group is : ' , TMP_GROUP.
endif.
endloop.
endloop.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> CO All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.