How can we create cost centres in SAP B1

please advise how we can create cost centres in SA P-B1 as we do in tally.

Hi
You can Download the e-learning File in SAP Customer portal regarding cost Accounting
Go to [http://service.sap.com]
Customer portal =>Education=>Release 2007 => Finance=> cost and Budgeting
Regards
Balaji

Similar Messages

  • How can we creat web-dynpro in SAP 4.6c?

    Hi Gurus,
    I'm new to the Web-dynpro technology, please help me in creating a simple web-dynpro.
    My questions are:
    1. can we create web-dynpro in SAP version 4.6c?
    2. If yes then how?

    Hi Manjesh,
    You cannt develop Web Dynpro's in 4.6C version. Web Dynpro's are introduced from ECC6.0 onwords.
    Check this document about Web Dynpro for ABAP
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/77/3545415ea6f523e10000000a155106/content.htm
    Edited by: suman kumar chinnam on Oct 17, 2008 12:51 PM

  • How can i create orgnsiation structure in sap

    Hi Guys
        Can anybody tell me how to craete an organsation strucuture first when first implimenting the sap in your company...step by step answer
    thankx
    Edited by: madhubabu rao on Jun 12, 2008 1:10 PM

    Hi,
    I have some code which I developed.
    *&      Form  Create_operation_unit
    *       This subroutine is for creation of Operating Unit
    FORM create_operation_unit .
    *  DATA:lv_valto TYPE datab.
      DATA:
    *  lv_desc TYPE bapiset_hier-descript,
           lv_gpname TYPE bapiset_hier-groupname,
          lv_legno TYPE cepc-zzleg_no.
      TYPES : BEGIN OF st_dept,
              ww007 TYPE t25f4-ww007,
              bezek TYPE t25f4-bezek,
              END OF st_dept.
      DATA: lt_dept TYPE TABLE OF st_dept.
      DATA: wa_dept LIKE LINE OF lt_dept,
            lv_lock_ind type cepc-lock_ind,
            lv_segment  type cepc-segment.
      DATA: lv_index TYPE sy-tabix.
      DATA: lv_index1 TYPE sy-tabix,
            lv_prctr  TYPE cepc-prctr,
            lv_zsgid TYPE zfpasgid,
            lv_zsgid_prev TYPE zfpasgid.
      DATA: lv_indicators TYPE bapi0015_8.
      IF p_sd_pct IS NOT INITIAL.                                           "For Profit Center Group.
        CLEAR: gt_hierarchy,gt_hierarchy[].
        CLEAR: gt_hierarchy1,gt_hierarchy1[].
        CLEAR: gt_value,gt_value[].
        CLEAR: gt_value1,gt_value1[].
        GET PARAMETER ID 'CAC' FIELD gv_p_kokrs.
        IF gv_p_kokrs IS INITIAL.
          CALL TRANSACTION 'OKKS'.
          GET PARAMETER ID 'CAC' FIELD gv_p_kokrs.
        ENDIF.
        lv_index = 1.
        lv_index1 = 2.
    * Get deatils of lower levels group from target.
        CALL FUNCTION 'BAPI_PROFITCENTERGRP_GETDETAIL'
          EXPORTING
            controllingarea = gv_p_kokrs
            groupname       = p_sd_pct
          TABLES
            hierarchynodes  = gt_hierarchy
            hierarchyvalues = gt_value.
    ***Get company code for profit center.
        IF gt_value[] IS NOT INITIAL.
          SELECT bukrs
                   FROM csks INTO TABLE gt_csks1
                   FOR ALL ENTRIES IN gt_value
                   WHERE prctr = gt_value-valfrom.
        ENDIF.
        LOOP AT gt_csks1 INTO wa_csks1.
          wa_co_code-comp_code = wa_csks1-bukrs.
          wa_co_code-assign_to_prctr = 'X'.
          APPEND wa_co_code TO gt_co_code.
        ENDLOOP.
        SELECT ww007 bezek FROM t25f4 INTO TABLE lt_dept
                          WHERE spras = sy-langu.
        LOOP AT lt_dept INTO wa_dept.
          READ TABLE gt_hierarchy INTO wa_hierarchy WITH KEY groupname+7(3) = wa_dept-ww007+5(3).
          IF ( wa_dept-ww007(4) = p_sd_pct AND wa_dept-ww007+5(3) = wa_hierarchy-groupname+7(3) ).
            lv_gpname = wa_hierarchy-groupname.
            wa_hierarchy-descript = wa_dept-bezek.
            MODIFY gt_hierarchy FROM wa_hierarchy
                   TRANSPORTING descript
                 WHERE groupname = lv_gpname.
          ENDIF.
        ENDLOOP.
    *   Get the Lock indicator and segmant from source Operting unit.
          SELECT lock_ind
                 segment
            FROM cepc
            INTO (lv_lock_ind,
                   lv_segment)
            BYPASSING BUFFER
            WHERE datbi GE sy-datum
              AND kokrs = gv_p_kokrs
              AND KHINR = p_sd_pct.   "cepc values for source group
          endselect.
        READ TABLE gt_hierarchy INTO wa_hierarchy WITH KEY groupname = p_sd_pct.
    *  gv_tgt_level = wa_hierarchy-hierlevel - 1.                           "chain level
        gv_src_level = wa_hierarchy-hierlevel.                              "Operating unit level
        gv_dep_level = wa_hierarchy-hierlevel + 1.                          "department level.
        LOOP AT gt_hierarchy INTO wa_hierarchy.
          IF wa_hierarchy-hierlevel = gv_src_level.                         "Opearing Unit node
            wa_hierarchy1-groupname = p_dsno.
    *        wa_hierarchy1-descript = wa_hierarchy-descript.
            wa_hierarchy1-descript = p_name.
            wa_hierarchy1-hierlevel = wa_hierarchy-hierlevel.
            APPEND wa_hierarchy1 TO gt_hierarchy1.
          ENDIF.
          IF wa_hierarchy-hierlevel = gv_dep_level.                         "Department node
            CONCATENATE p_dsno wa_hierarchy-groupname+7(3) INTO gv_ngrname.
            wa_hierarchy1-groupname = gv_ngrname.
    *        wa_hierarchy1-descript = wa_hierarchy-descript.
            wa_hierarchy1-descript = wa_hierarchy-descript.
            wa_hierarchy1-hierlevel = wa_hierarchy-hierlevel.
            APPEND wa_hierarchy1 TO gt_hierarchy1.
          ENDIF.
          CLEAR wa_hierarchy1.
        ENDLOOP.
        DELETE ADJACENT DUPLICATES FROM gt_hierarchy1
                     COMPARING groupname.
    *---BEGIN Create profit center group
        CALL FUNCTION 'BAPI_PROFITCENTERGRP_CREATE'
          EXPORTING
            controllingareaimp = gv_p_kokrs
          IMPORTING
            return             = wa_message
          TABLES
            hierarchynodes     = gt_hierarchy1
            hierarchyvalues    = gt_value1.
        IF wa_message IS INITIAL.
          CONCATENATE p_dsno text-020
                      INTO wa_message-message
                      SEPARATED BY space.
          APPEND wa_message TO gt_message.
    * Add node only if PCGroup is created successfully
    *---BEGIN Add node to profit center group
          CALL FUNCTION 'BAPI_PROFITCENTERGRP_ADDNODE'
            EXPORTING
              controllingarea = gv_p_kokrs
              groupname       = p_tg_pct
              subgroupname    = p_dsno
            IMPORTING
              return          = wa_message.
          IF wa_message IS INITIAL.
            CONCATENATE p_dsno text-021 p_tg_pct
                        INTO wa_message-message
                        SEPARATED BY space.
            APPEND wa_message TO gt_message.
    *---Create Profit Center ONLY if PCgroup and ADD node created.
            gv_pcgroup_created = 'X'.                                       "flag used while Creating Profit Centers
    *---Cost center group cration based on successful PC group creation.
          ELSE.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
            APPEND wa_message TO gt_message.
          ENDIF.
          PERFORM output CHANGING gt_message.
          CLEAR: gt_message,gt_message[],wa_message.
    *---END Add node
        ELSE.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          APPEND wa_message TO gt_message.
        ENDIF.
        PERFORM output CHANGING gt_message.
        CLEAR: gt_message,gt_message[].
    *---END PC Group Create
      ENDIF.                                                                "end For Profit Center Group.
      IF p_sd_cct IS NOT INITIAL AND gv_pcgroup_created EQ 'X'.             "For Cost Center Group.ONLY when PC group creation is successful
        CLEAR: gt_hierarchy,gt_hierarchy[].
        CLEAR: gt_hierarchy1,gt_hierarchy1[].
        CLEAR: gt_value,gt_value[].
        CLEAR: gt_value1,gt_value1[].
    * Get deatils of lower levels group from target.
        CALL FUNCTION 'BAPI_COSTCENTERGROUP_GETDETAIL'
          EXPORTING
            controllingarea = gv_p_kokrs
            groupname       = p_sd_cct
          TABLES
            hierarchynodes  = gt_hierarchy
            hierarchyvalues = gt_value.
        READ TABLE gt_value INTO wa_value INDEX 1.
        IF sy-subrc = 0.
          SELECT SINGLE kokrs khinr bukrs kosar
                      FROM csks
                      INTO (gv_c_kokrs, gv_c_grpname, gv_c_bukrs, gv_kosar)
                      WHERE kokrs = gv_p_kokrs
                      AND   kostl = wa_value-valfrom
                      AND   datbi GE sy-datum.
        ENDIF.
        LOOP AT lt_dept INTO wa_dept.
          READ TABLE gt_hierarchy INTO wa_hierarchy WITH KEY groupname+7(3) = wa_dept-ww007+5(3).
          IF ( wa_dept-ww007(4) = p_sd_cct AND wa_dept-ww007+5(3) = wa_hierarchy-groupname+7(3) ).
            lv_gpname = wa_hierarchy-groupname.
            wa_hierarchy-descript = wa_dept-bezek.
            MODIFY gt_hierarchy FROM wa_hierarchy
                   TRANSPORTING descript
                 WHERE groupname = lv_gpname.
          ENDIF.
        ENDLOOP.
        READ TABLE gt_hierarchy INTO wa_hierarchy WITH KEY groupname = p_sd_cct.
    *  gv_tgt_level = wa_hierarchy-hierlevel - 1.                           "chain level
        gv_src_level = wa_hierarchy-hierlevel.                              "Operating unit level
        gv_dep_level = wa_hierarchy-hierlevel + 1.                          "department level.
        LOOP AT gt_hierarchy INTO wa_hierarchy.
          IF wa_hierarchy-hierlevel = gv_src_level.                         "Operating Unit node
            wa_hierarchy1-groupname = p_dsno.
    *        wa_hierarchy1-descript = wa_hierarchy-descript.
            wa_hierarchy1-descript = p_name.
            wa_hierarchy1-hierlevel = wa_hierarchy-hierlevel.
            APPEND wa_hierarchy1 TO gt_hierarchy1.
          ENDIF.
          IF wa_hierarchy-hierlevel = gv_dep_level.                         "Department node
            CONCATENATE p_dsno wa_hierarchy-groupname+7(3) INTO gv_ngrname.
            wa_hierarchy1-groupname = gv_ngrname.
    *        wa_hierarchy1-descript = wa_hierarchy-descript.
            wa_hierarchy1-descript = wa_hierarchy-descript.
            wa_hierarchy1-hierlevel = wa_hierarchy-hierlevel.
            APPEND wa_hierarchy1 TO gt_hierarchy1.
          ENDIF.
          CLEAR wa_hierarchy1.
        ENDLOOP.
    *Create Cost Center Group
    *---BEGIN of COSTCENTER Group CREATE
        CALL FUNCTION 'BAPI_COSTCENTERGROUP_CREATE'
          EXPORTING
    *dinesh
            controllingareaimp = gv_p_kokrs
          IMPORTING
            return             = wa_message
          TABLES
            hierarchynodes     = gt_hierarchy1
            hierarchyvalues    = gt_value1.
        IF wa_message IS INITIAL.
          CONCATENATE p_dsno text-022
                      INTO wa_message-message
                      SEPARATED BY space.
          APPEND wa_message TO gt_message.
    *Add node to cost center group ONLY if Cost Center Group creation is successful
    *---BEGIN of ADDNODE
          CALL FUNCTION 'BAPI_COSTCENTERGROUP_ADDNODE'
            EXPORTING
    *dinesh
              controllingarea = gv_p_kokrs
              groupname       = p_tg_cct
              subgroupname    = p_dsno
            IMPORTING
              return          = wa_message.
          IF wa_message IS INITIAL.
            CONCATENATE p_dsno text-023 p_tg_cct
                        INTO wa_message-message
                        SEPARATED BY space.
            APPEND wa_message TO gt_message.
    * Cost Center is created ONLY if Cost Center group and add node is successful
            gv_ccgroup_created = 'X'.                                       "flag used while crateing cost center
          ELSE.
    *Rollback if BAPI fails in Adding Node
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
            APPEND wa_message TO gt_message.
          ENDIF.
          PERFORM output CHANGING gt_message.
          CLEAR: gt_message,gt_message[],wa_message.
    *---END of ADDNODE
        ELSE.
    *Rollback if BAPI fails in creating group
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          APPEND wa_message TO gt_message.
        ENDIF.
        PERFORM output CHANGING gt_message.
        CLEAR: gt_message,gt_message[],wa_message.
    *---END of COSTCENTER CREATE
      ENDIF.                                                                "End of Cost Center Group
      LOOP AT gt_hierarchy1 INTO wa_hierarchy1.
        CLEAR: wa_profitcenterid,wa_basicdata,wa_address.
        CLEAR: wa_costcenterlist,gt_costcenterlist,gt_costcenterlist[].
    ***Call function get_next_numbers to generate profit center no.
        CALL FUNCTION 'NUMBER_GET_NEXT'
          EXPORTING
            nr_range_nr             = '02'
            object                  = 'COPCA_OBJ'
          IMPORTING
            number                  = gv_number
          EXCEPTIONS
            interval_not_found      = 1
            number_range_not_intern = 2
            object_not_found        = 3
            quantity_is_0           = 4
            quantity_is_not_1       = 5
            interval_overflow       = 6
            buffer_overflow         = 7
            OTHERS                  = 8.
        IF sy-subrc <> 0.
          IF sy-subrc = 8.
            wa_message-id = sy-msgid.
            wa_message-type = sy-msgty.
            wa_message-number = sy-msgno.
            wa_message-message_v1 = sy-msgv1.
            wa_message-message_v2 = sy-msgv2.
            wa_message-message_v3 = sy-msgv3.
            wa_message-message_v4 = sy-msgv4.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[],wa_message.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSEIF sy-subrc = 1.
            wa_message-message_v1 = text-043.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[],wa_message.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSEIF sy-subrc = 2.
            wa_message-message_v1 = text-044.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[],wa_message.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSEIF sy-subrc = 3.
            wa_message-message_v1 = text-045.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[],wa_message.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSEIF sy-subrc = 4.
            wa_message-message_v1 = text-046.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[],wa_message.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSEIF sy-subrc = 5.
            wa_message-message_v1 = text-047.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[],wa_message.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSEIF sy-subrc = 6.
            wa_message-message_v1 = text-048.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[].
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSEIF sy-subrc = 7.
            wa_message-message_v1 = text-049.
            APPEND wa_message TO gt_message.
            PERFORM output CHANGING gt_message.
            CLEAR: gt_message,gt_message[],wa_message.
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ENDIF.
        ELSE.
          IF p_sd_pct IS NOT INITIAL.                                       "For Profit Center create.
    *Create Profit Center only when Profit center group creation and add node is successful
            IF gv_pcgroup_created = 'X'.                                    "PCG flag check
              clear: wa_profitcenterid,
                     wa_basicdata,
                     wa_address,
                     lv_indicators.
              wa_profitcenterid-co_area = gv_p_kokrs.
              wa_profitcenterid-profit_ctr = gv_number.
              wa_basicdata-prctr_name = wa_hierarchy1-groupname.
              wa_basicdata-long_text = wa_hierarchy1-descript.
              wa_basicdata-in_charge = sy-uname.
              wa_basicdata-prctr_hier_grp = wa_hierarchy1-groupname.
              wa_basicdata-segment        = lv_segment.
              IF wa_hierarchy1-hierlevel = gv_src_level.                    "Address and locking only in Op.Unit
                lv_indicators-LOCK_IND = lv_lock_ind.
                wa_address-name       = p_name.
                wa_address-street     = p_strt.
                wa_address-city       = p_city.
                wa_address-postl_code = p_pcod.
                wa_address-country    = p_cont.
                wa_address-region     = p_reg.
              ENDIF.
    * Create Profit Center
    *          WAIT UP TO 2 SECONDS.
              CALL FUNCTION 'BAPI_PROFITCENTER_CREATE'
                EXPORTING
                  profitcenterid = wa_profitcenterid
                  validfrom      = p_date
                  validto        = c_validto
                  basicdata      = wa_basicdata
                  address        = wa_address
                  indicators     = lv_indicators
                IMPORTING
                  return         = wa_message
                TABLES
                  companycodes   = gt_co_code.
    *          WAIT UP TO 2 SECONDS.
              IF wa_message-type NE 'E' OR wa_message-type NE 'A'.
                CONCATENATE wa_profitcenterid-profit_ctr text-024
                            INTO wa_message-message
                            SEPARATED BY space.
                APPEND wa_message TO gt_message.
              ELSE.
                CLEAR gv_pcgroup_created.                                    "CEPC updation is based on this
                CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
                APPEND wa_message TO gt_message.
              ENDIF.
              PERFORM output CHANGING gt_message.
              CLEAR: gt_message,gt_message[],wa_message.
            ENDIF .                                                         "end of flag check
          ENDIF.                                                            "end of profitcenter create
          IF p_sd_cct IS NOT INITIAL.                                       "For Cost Center Create.
    *Create Cost Center only when Cost center group creation and add node is successful
            IF gv_ccgroup_created = 'X'.                                    "CCG flag check
              IF wa_hierarchy1-hierlevel = gv_dep_level.                    "Cost Center only in Dept level
                READ TABLE gt_value INTO wa_value INDEX lv_index1.
                SELECT kostl kosar FROM csks
                        INTO TABLE gt_csks_cat
                        WHERE kostl = wa_value-valfrom.
                lv_index1 =  lv_index1 + 1.
                READ TABLE gt_csks_cat INTO wa_csks_cat WITH KEY kostl = wa_value-valfrom.
                wa_costcenterlist-costcenter       = gv_number.
                wa_costcenterlist-valid_from       = p_date.
                wa_costcenterlist-valid_to         = c_validto. "31.12.9999
                wa_costcenterlist-person_in_charge = sy-uname.
                wa_costcenterlist-comp_code        = gv_c_bukrs .
                wa_costcenterlist-costcenter_type  = wa_csks_cat-kosar.
                wa_costcenterlist-costctr_hier_grp = wa_hierarchy1-groupname.
                wa_costcenterlist-descript         = wa_hierarchy1-descript.
                wa_costcenterlist-name             = wa_hierarchy1-groupname.
                wa_costcenterlist-profit_ctr       = gv_number.
                APPEND wa_costcenterlist TO gt_costcenterlist.
    *---BEGIN Create Cost Center
                CALL FUNCTION 'BAPI_COSTCENTER_CREATEMULTIPLE'
                  EXPORTING
                    controllingarea = gv_p_kokrs
                  TABLES
                    costcenterlist  = gt_costcenterlist
                    return          = gt_message.
                READ TABLE gt_message INTO wa_message INDEX 1.
                CLEAR gt_message[].
                IF wa_message-type = 'E' OR wa_message-type = 'A'.
                  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
                  CONCATENATE wa_message-message wa_message-message_v1 text-050 p_dsno text-051
                      INTO wa_message-message
                      SEPARATED BY space.
                  APPEND wa_message TO gt_message.
                  CLEAR: gt_message,gt_message[],wa_message.
                ELSE.
    * Activate only if Cost center is created successfully
    *---BEGIN of ACTIVATION
                  CLEAR : wa_costcenterlist_act,gt_costcenterlist_act[].
                  wa_costcenterlist_act-co_area     = gv_p_kokrs.
                  wa_costcenterlist_act-costcenter     = gv_number.
                  wa_costcenterlist_act-name            = p_name.
                  wa_costcenterlist_act-descript     = wa_hierarchy1-descript.
                  wa_costcenterlist_act-act_state     = 'X'.
                  APPEND wa_costcenterlist_act TO gt_costcenterlist_act.
                  CALL FUNCTION 'BAPI_CTR_ACTIVATE_MULTIPLE'
                    EXPORTING
                      controllingarea = gv_p_kokrs
                    TABLES
                      costcenterlist  = gt_costcenterlist_act
                      return          = gt_message.
                  READ TABLE gt_message INTO wa_message INDEX 1.
                  IF wa_message-type = 'E' OR wa_message-type = 'A'.
                    CLEAR gv_ccgroup_created.                                 "CEPC updation is based on this condition
                    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
                    CONCATENATE p_dsno text-050
                                INTO wa_message-message
                                SEPARATED BY space.
                    APPEND wa_message TO gt_message.
                  ELSE.
                    CONCATENATE wa_profitcenterid-profit_ctr text-025 text-026
                                INTO wa_message-message
                                SEPARATED BY space.
                    APPEND wa_message TO gt_message.
                    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.                "COMMIT CC activation
                  ENDIF.
                  PERFORM output CHANGING gt_message.
                  CLEAR: gt_message,gt_message[],wa_message.
    *---END of ACTIVATION
                ENDIF.
                PERFORM output CHANGING gt_message.
                CLEAR: gt_message,gt_message[],wa_message.
    *---END Create Cost Center
              ENDIF.
            ENDIF.                                                          "end of CCG flag check
          ENDIF.                                                            "end of cost center create
    *--Updating CEPC Append Structure ZDSG_DATA and sales group table ZFPASALESGROUP
          IF gv_ccgroup_created = 'X' AND gv_pcgroup_created = 'X'.
            READ TABLE gt_hierarchy
                       INTO wa_hierarchy
                       WITH KEY hierlevel = wa_hierarchy1-hierlevel.          "source group
            IF sy-subrc = 0.
    *CEPC values for source group
              READ TABLE gt_value INTO wa_value INDEX lv_index.
              SELECT SINGLE * FROM cepc
                        INTO wa_cepc BYPASSING BUFFER
                        WHERE  kokrs   = gv_p_kokrs
                        AND datbi      GE sy-datum
                        AND prctr      = wa_value-valfrom.
    * For updating CEPC
              IF sy-subrc = 0.
                READ TABLE gt_hierarchy INDEX lv_index
                         INTO wa_hierarchy.
                lv_index = lv_index + 1.
                IF wa_hierarchy-hierlevel = 1.
                  CONCATENATE p_legacy wa_hierarchy-groupname+7(3) INTO lv_legno.
                  p_ztype = '05'.
                  p_zstype = ' '.
                ELSE.
                  lv_legno = p_legacy.
                ENDIF.
                wa_cepc-prctr        = gv_number.
                wa_cepc-datbi        = c_validto.
                wa_cepc-kokrs        = gv_p_kokrs.
                wa_cepc-zzleg_no  = lv_legno.
                wa_cepc-zztype        = p_ztype.
                wa_cepc-zzstype   = p_zstype.
                wa_cepc-zzfsdate  = p_sal_da.
                wa_cepc-zzdist        = p_zdist.
                wa_cepc-zzsvat    = p_zsvat.
                APPEND wa_cepc TO gt_cepc.
                PERFORM update_append_cepc TABLES gt_cepc.
                CLEAR:wa_cepc,gt_cepc[],gt_cepc,lv_prctr.
    * For updating ZFPASALESGROUP
                SELECT SINGLE prctr
                  INTO lv_prctr
                  FROM cepc
                 WHERE khinr = wa_hierarchy-groupname.
                IF sy-subrc = 0.
                  SELECT  * FROM zfpasalesgroup
                            INTO TABLE gt_salesgrp
                           WHERE zvalid_from GE p_date
                             AND zvalid_to LE c_validto
                             AND prctr = lv_prctr
                             AND zdeactive = ''.
                  IF sy-subrc = 0.
                    SELECT MAX( zsgid ) INTO lv_zsgid FROM  zfpasalesgroup.
                    IF lv_zsgid IS INITIAL.
                      lv_zsgid = '1000000000'.
                    ENDIF.
                    SORT gt_salesgrp BY zsgid zvalid_from.
                    LOOP AT gt_salesgrp INTO wa_salesgrp.
                      IF lv_zsgid_prev NE wa_salesgrp-zsgid OR lv_zsgid_prev IS INITIAL.
    *                      wa_salesgrp-zsgid = lv_zsgid.
    *                  else.
                        lv_zsgid = lv_zsgid + 1.
                        lv_zsgid_prev = wa_salesgrp-zsgid.
                        wa_salesgrp-zsgid = lv_zsgid.
                      ELSE.
    *                  lv_zsgid_prev = lv_zsgid.
                        wa_salesgrp-zsgid = lv_zsgid.
                      ENDIF.
                      wa_salesgrp-prctr = gv_number.
                      IF wa_salesgrp-zvalid_from LT p_date.
                        wa_salesgrp-zvalid_from = p_date.
                      ENDIF.
    *              wa_salesgrp-zvalid_to = c_validto.
    *                insert new entry in zfpasalesgroup for data entered on screen.
                      INSERT into zfpasalesgroup values wa_salesgrp.
    *                MODIFY zfpasalesgroup FROM TABLE gt_salesgrp .
    *                Message for output
                      IF sy-subrc = 0.
                        CONCATENATE  wa_salesgrp-zsgid text-102 'ZFPASALESGROUP'
                                    INTO wa_message-message
                                    SEPARATED BY space.
                        wa_message-type = 'S'.
                        APPEND wa_message TO gt_message.
                        PERFORM output CHANGING gt_message.
                        CLEAR: gt_message,gt_message[],wa_message.
                      ELSE.
    *                Message for output if its not successful
                        CONCATENATE text-103 'ZFPASALESGROUP'
                                    INTO wa_message-message
                                    SEPARATED BY space.
                        wa_message-type = 'E'.
                        APPEND wa_message TO gt_message.
                        PERFORM output CHANGING gt_message.
                        CLEAR: gt_message,gt_message[],wa_message.
                      ENDIF.
                      CLEAR wa_salesgrp.
                    ENDLOOP.
                    CLEAR: wa_salesgrp, gt_salesgrp[], gt_salesgrp,lv_zsgid_prev .
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
      PERFORM display_log CHANGING gt_log.
      PERFORM clear_variables.
      gv_active_tab = 'SOS_TAB1'.
    ENDFORM.                    " Create_operation_unit
    <REMOVED BY MODERATOR>
    Regards
    Susheel
    Code Formatted by: Alvaro Tejada Galindo on Jun 12, 2008 4:31 PM

  • How can i create Organization Structure in sap

    Hi Abaper/Basis Guys...
       I want To Create An Simple Basic Organization Structure for my  small Company..iam Abaper no basic guy is there in my office.
       pls send me step by step guidlines
    Thank You.
    Madhu Rao
    Edited by: madhubabu rao on Jun 19, 2008 8:01 AM

    Hi Madhu,
    Kindly check the following links.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/4b/6a43cccafe11d2b49d006094b9c9b4/content.htm
    http://help.sap.com/bestpractices/BBLibrary/html/J02_OrgStructure_EN_UK.htm
    Dont forget to reward points if found useful.
    Thanks,
    Satyesh

  • How can i see cost centre wise employee level salary breakdown for each month ? can anybody help me.

    plz anyone help me.

    thanks, Nguyen. can i get a employee salary breakdown for each month with this tcode.

  • How can we create web shop in sap crm 4.0 version

    hi, crm gurus, plz anser my question.
    thanks in advance

    Hi!
    A good step-by-step guide is the Best Practices guides.
    The BP for CRM4 is available at help.sap.com or
    <a href="http://help.sap.com/bp_crmv340/CRM_DE/index.htm">here</a>
    rollo

  • Delete cost centre in SAP

    Dear all,
    I have created a cost centre incorrectly, can I ask how to delete this cost centre  in SAP? there areNO transactions posted to this cost centre .
    Many Thanks
    Sunny
    Moderator: Please, search before posting

    Try with KS04 ..
    BR,
    David Sindhu

  • How to Add the cost centre  in the KSBB report

    Hi Experts,
    How can we add cost centre in KSBB report. Is it possible to add? if yes could any one guide me how to add the cost centre in KSBB report?
    waiting for your replies,
    Regards

    Hi,
    I see only three possible explanations:
    a) no data on this cost centre
    b) authorizations
    c) 'hard-coded' filter in the relevant report (only if it's user-developed report)
    Regards,
    Eli

  • How can mass creating production orders???

    In SAP ,we can use CO01,CO09,CO07 to create production order. But by these TOCDES,we only can create one production order for one finished product once a time.
    But we now need to create more then one ,may be more then 50 production orders once a time?
    It is possible in SAP?
    I know we could conver the production orders from plan orders after MRP run.But sometimes
    for some reasons we must create produciton orders manually.And I also know in SAP some TCODE can process many production orders once a time ,like COHV,CORM, can release ,TECO many production orders once a time.
    But how can mass creating production orders once a time,not by mrp run?
    How can batch create produciton orders in SAP?
    Thanks for any reply!

    Hi,
    Use the BAPI - BAPI_PRODORD_CREATE or for internal orders BAPI_INTERNALORDER_CREATE
    Take the help of your abaper, he / she can use the above BAPI to write a custom program to mass create production order.
    Hope the above helps.
    Regards,
    Vivek
    Added
    You can also use the below BAPI's in your custom program:
    BAPI_PRODORD_RELEASE to release the orders
    BAPI_PRODORD_CHECK_MAT_AVAIL for carrying out material availability
    Edited by: Vivek on Mar 22, 2009 8:27 PM

  • How to created cost centre

    hi all how to create cost centre
    regards
    JK rao

    Hi,
    look here
    http://help.sap.com/saphelp_47x200/helpdata/en/f7/399b394bdb056de10000000a11402f/frameset.htm
    pls reward useful answers
    thank you
    Andreas

  • How can I create more than one main window in a page of SAP SCRIPT?

    How can I create more than one main window in a page of SAP SCRIPT? If anybody helps me I will be obliged.
    Regards,
    Subhasish

    Hi Ganguly,
    It is possible to have more than one main window in a same page.
    You create a main window and simply you copy and past it in the same page.. it will create first main window name as MAIN and other main windows as MAIN01,MAIN02.... up to MAIN99.
    Contets flow from MAIN , MAIN01, MAIN02.......................MAIN99. contents after filling the current window it flows to next window(by default, you skip as well with some keyword not sure could be NEW-WINDOW)
    you want print the main window data twice? or you want to create two main window in the same page ?
    1. give two copies in the no of copies in the output type screen ( Which pop up is coming after excute the program ).
    2. create two page with the same script form.
    3. you can write the coding inside the program to print twice the same page.
    Hope this information use full to you..

  • How can I create a Commercial Invoice or similar document in SAP ByD?

    How can I create a Commercial Invoice or similar document in SAP ByD?
    Our company has recently implemented ByD, but we can't figure out how to create a commercial invoice for shipping/customs purposes. I know that the German version of ByD allows for "Export Declarations" which is pretty much the same as a commercial invoice, but the U.S. version doesn't have this document/function.
    Any suggestions? I would appreciate any help.
    By the way, a commercial invoice contains:
    1. The shipperu2019s complete information: Contact name, company name, complete address and tax identification number.
       2. The recipientu2019s complete information: Contact name, company name, complete address and phone number.
       3. The buyeru2019s information (the person to whom the goods are sold by the seller) if different from the recipient: Contact name, company name, complete address and phone number.
       4. The shipment tracking number, air waybill number or bar-code label number.
       5. An accurate description of the contents in your shipment that includes the following details:
    What the product is
    What material the product is made of
    What the productu2019s Schedule B or HTS code is
    What the productu2019s intended use is
    What the productu2019s country of manufacture is
    What the productu2019s parts or serial numbers are (if applicable)
    What the productu2019s quantity and unit of measure are
    What the productu2019s value is, per unit and in total
    Thanks,
    Chris

    May I suggest that you ask this question in the customer forums in the Business Center at [http://sme.sap.com|http://sme.sap.com]
    Best regards, Christian

  • How can I create a new sales order template in SAP CRM 7.0

    Hello,
    how can I create a new sales order template in SAP CRM 7.0 (Web UI)? I want to use this sales order template in scenario ´'Mass Generation of Sales Orders via Marketing Projects'.
    Thanks for your support in advance.
    Best regards,
    anvan

    Hi,
    Did you set up this scenario? I want something similar, but I want an ERP order to be created. Do you know if that is possible? Do you have som tips?
    regards Camilla

  • How can i create a Laptop like the ones use in SAP TecEd?

    How can i create a Laptop like the ones use in SAP TecEd hands on labs? with all the NW products install on it.

    Hi,
    Vague question, but to create a laptop with the solution installed - you need to order the solution and and then install it on the laptop. Or download trial versions from SCN and install those as well.
    Regards,
    Srikishan

  • How can define the cost center (department) manager?

    We are on 11.5.0.10
    Financials implementation is done(GL,AP,AR,FA,IA)
    In iAssets System, we want to set up the approval method to use "cost center-based approvals". (For cost center-based approvals to work properly, each cost center must have a manager defined.)
    How can define the cost center (department) manager? Thanks.

    I believe this is done in the organization definition screen. For each organization, we attach a classification "Company Cost Centre" (the same place where we attach the classification operating unit, inv org etc). In the others section, there are 2 additional information - GL company cost centre and reporting information. In the GL company cost, you need to attach the balancing segment value and the cost centre value. In the reporting information, you need to attach the manager for that organization. This ay the relationship between the cost centre and manager is created.
    Hope this clarifies.
    Vinit

Maybe you are looking for