2010年11月15日

用K_GROUP_SELECT查詢Cost Object Group

寫CO的報表時,用到Cost Object的選擇條件時常會加上Group來查詢,在處理VALUE-REQUEST時可以用FM K_GROUP_SELECT處理,以下是範例:

1 Profit Center Group
CALL FUNCTION 'K_GROUP_SELECT'
EXPORTING
CLASS = '0106'
FIELD_NAME = 'RPRCTR '
TABLE = 'GLPCT '
IMPORTING
SET_NAME = P_PCGRU
EXCEPTIONS
NO_SET_PICKED = 1.

2 Cost Center Group
CALL FUNCTION 'K_GROUP_SELECT'
EXPORTING
FIELD_NAME = 'KOSTL'
IMPORTING
SET_NAME = P_KSGRU
EXCEPTIONS
NO_SET_PICKED = 1

3 Internal Order Group
CALL FUNCTION 'K_GROUP_SELECT'
EXPORTING
FIELD_NAME = 'AUFNR'
IMPORTING
SET_NAME = P_AUFGR
EXCEPTIONS
NO_SET_PICKED = 1.

4 Cost Element Group
CALL FUNCTION 'K_GROUP_SELECT'
EXPORTING
FIELD_NAME = 'KSTAR'
KTOPL = 'XXX'
IMPORTING
SET_NAME = P_GRP
EXCEPTIONS
NO_SET_PICKED = 1.

沒有留言:

張貼留言