Skip to Content
author's profile photo Former Member
Former Member

Cost center group

what is the easiest way to get the cost centers from cost center group(setname in SETLEAF) from table SETLEAF.

As i need to check if a PO (ekkn-kostl) is in the COST CENTER GROUP for a report.

appreciate any help. thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 11:22 PM

    I've used FM K_HIERARCHY_TABLES_READ

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 03:03 AM

    data wa_setname like setleaf-setname.

    data wa_subclass like setleaf-subclass.

    data wa_valfrom like setleaf-valfrom.

    MOVE EKKO-BUKRS TO WA_SUBCLASS.

    MOVE EKKN-KOSTL TO WA_VALFROM.

    select single setname into wa_setname

    from setleaf

    where setcalss = '0106'

    and subclass = wa_subclass

    and valfrom = wa_valfrom.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 06:14 AM

    Hi ..

    Each cost center group is a separate set. if p_short is the cost center group name. Then this logic is useful for u.

    DATA : OLD_SET LIKE RGSBS-SETNR.

    CALL FUNCTION 'G_SET_GET_ID_FROM_NAME'

    EXPORTING

    SHORTNAME = P_SHORT

    OLD_SETID = OLD_SET

    IMPORTING

    NEW_SETID = OLD_SET.

    CALL FUNCTION 'G_SET_GET_INFO'

    EXPORTING

    SETNAME = OLD_SET

    IMPORTING

    INFO = ITAB1

    EXCEPTIONS

    SET_NOT_FOUND = 1

    ILLEGAL_FIELD_REPLACEMENT = 2

    OTHERS = 3.

    IF SY-SUBRC = 0.

    CALL FUNCTION 'G_SET_TREE_IMPORT'

    EXPORTING

    CLIENT = SY-MANDT

    LANGU = SY-LANGU

    SETID = OLD_SET

    MAX_HIER_LEVEL = 99

    TABLES

    SET_VALUES = ITAB2

    EXCEPTIONS

    SET_NOT_FOUND = 1

    ILLEGAL_FIELD_REPLACEMENT = 2

    ILLEGAL_TABLE_REPLACEMENT = 3

    OTHERS = 4.

    IF SY-SUBRC = 0.

    LOOP AT ITAB2.

    P_KOSTL-SIGN = C_I.

    P_KOSTL-OPTION = C_EQ.

    P_KOSTL-LOW = ITAB2-FROM.

    APPEND P_KOSTL.

    ENDLOOP.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.