如何通过'G_SET_GET_ALL_VALUES'函数取成本中心组的成本中心
DATA: t_set_values TYPE TABLE OF rgsb4.CALL FUNCTION 'G_SET_GET_ALL_VALUES'
EXPORTING
client = sy-mandt
setnr = 'NP_SLOC_SERV'
table = 'MARD'
class = '0000'
fieldname = 'LGORT'
TABLES
set_values = t_set_values
EXCEPTIONS
set_not_found = 1
OTHERS = 2.
这里的几个参数是什么意思?需要传递什么数据到函数,传出的是什么函数?才能的到成本中心组下边的成本中心?
有看到这篇BBS http://blog.csdn.net/CompassButton/archive/2007/11/14/1884794.aspx#FeedBack,现在的问题是如果用这个函数来取成本中心组的成本中心,需要传递什么参数到函数?
Setnr是什么参数?Table是不是需要从中取数据的表?Class是什么?fieldname是什么意思?是不是要在table这个参数传递的表理取数据的字段?set_values是什么?是不是函数运行后生产的数据? --------------------编程问答-------------------- 怎么没有高手回复呢?
高手取哪里了?? --------------------编程问答-------------------- ****以下仅供参考
REPORT test01 .
** by wanghp 2010-02-02
** 依据成本中组获取成本中心
** 参考 RCOPCA56 和 RCOPCA55
TYPE-POOLS: GSETC. "Setklassen 4.0 "RDI_SETS_4.0
DATA: SET_ID LIKE RGSMH-SETNR. "SetID "RDI_SETS_4.0
DATA: t_set_values TYPE TABLE OF rgsb4 with header line.
DATA: BEGIN OF T_KOSTL OCCURS 0,
KOSTL LIKE CSKS-KOSTL.
DATA: END OF T_KOSTL.
DATA: SET_CLASS LIKE SETHIER-SETCLASS.
PARAMETERS: KOGRP LIKE RKMAH-HNAME "CO-Setname 成本中心组名。
MEMORY ID HNA OBLIGATORY, "WK - note 337416
KOKRS like csks-kokrs OBLIGATORY default 'KDCA'. "控制范围
* MEMORY ID HNA OBLIGATORY, "WK - note 337416
* GROUP LIKE APQI-GROUPID OBLIGATORY. "WK - note 337416
**********************
TOP-OF-PAGE.
* ....
INITIALIZATION.
* ...
AT SELECTION-SCREEN ON VALUE-REQUEST FOR KOGRP.
PERFORM PF4 USING KOKRS
CHANGING KOGRP.
START-OF-SELECTION.
CALL FUNCTION 'G_SET_ENCRYPT_SETID' "RDI_SETS_4.0
EXPORTING
SETCLASS = GSETC_COSTCENTER_SETCLASS "类别为成本中心
SHORTNAME = KOGRP "成本中心组名
KOKRS = KOKRS "控制范围
IMPORTING
SETID = SET_ID.
CALL FUNCTION 'G_SET_GET_ALL_VALUES'
EXPORTING
SETNR = SET_ID "RDI_SETS_4.0
TABLES
SET_VALUES = t_set_values
EXCEPTIONS
SET_NOT_FOUND = 1
OTHERS = 2.
**********************
if sy-subrc ne 0.
write : / 'An error occured.',sy-subrc.
stop.
else.
write : / 'The result is :'.
endif.
loop at t_set_values.
t_kostl-kostl = t_set_values-FROM.
append t_kostl.
endloop.
loop at t_kostl.
write : / t_kostl-kostl.
endloop.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form PF4
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-> SETNAME Setname f黵 Kostenstellengruppe "RDI_SETS_4.0
* (15-stellig)
*----------------------------------------------------------------------*
FORM PF4 USING KOKRS
CHANGING SETNAME.
DATA: SEARCHFLD LIKE T800S-SEARCHFLD,
SET_SNAME LIKE SETHIER-SHORTNAME. "Setname (24) "RDI_SETS_4.0
SEARCHFLD = KOKRS.
CALL FUNCTION 'K_GROUP_SELECT'
EXPORTING
FIELD_NAME = 'KOSTL'
CRUSER = '*'
SEARCHFLD = SEARCHFLD
SEARCHFLD_INPUT = ' '
TABLE = 'CCSS' "RDI_SETS_4.0
TYPELIST = 'BS'
UPDUSER = '*'
IMPORTING
CLASS_NAME = SET_CLASS "RDI_SETS_4.0
* set_name = setname "RDI_SETS_4.0
SET_NAME = SET_SNAME "Setname (24-stellig) "
EXCEPTIONS
NO_SET_PICKED = 01.
* da CO-Gruppen 15-stellig bzw. Standardhierarchie-Sets 12-stellig,
* werden 9 bzw 12 Stellen abgeschnitten! "RDI_SETS_4.0
IF SY-SUBRC NE 0 OR SET_CLASS NE GSETC_COSTCENTER_SETCLASS. "
CLEAR SETNAME. "RDI_SETS_4.0
ELSE. "RDI_SETS_4.0
SETNAME = SET_SNAME. "RDI_SETS_4.0
ENDIF. "RDI_SETS_4.0
ENDFORM. " PF4
补充:企业软件 , ERP/CRM