Skip to Content
0
Former Member
Jun 18, 2008 at 08:26 AM

BAPI_COSTCENTER_CHANGEMULTIPLE

159 Views

Hi,

I have a problem with BAPI_COSTCENTER_CHANGEMULTIPLE.

I have begin to create a costcenter with this code :

DATA: str_costcenter type table of BAPI0012_CCINPUTLIST with header line.
DATA: str_costcenter_act type table of BAPI0012_CCLIST with header line.
DATA: str_result TYPE TABLE OF BAPIRET2  with header line.
DATA: str_result_act TYPE TABLE OF BAPIRET2  with header line.

DATA: BEGIN OF it_costcenter_act occurs 0,
        co_area TYPE bapi0012_cclist-co_area,
        costcenter TYPE bapi0012_cclist-costcenter,
        name TYPE bapi0012_cclist-name,
        descript TYPE bapi0012_cclist-descript,
        act_state TYPE bapi0012_cclist-act_state,
      END OF it_costcenter_act.

DATA: BEGIN OF it_costcenter occurs 0,
        costcenter TYPE bapi0012_ccinputlist-costcenter,
        valid_from TYPE bapi0012_ccinputlist-valid_from,
        valid_to TYPE bapi0012_ccinputlist-valid_to,
        person_in_charge TYPE bapi0012_ccinputlist-person_in_charge,
        department TYPE bapi0012_ccinputlist-department,
        costcenter_type TYPE bapi0012_ccinputlist-costcenter_type,
        costctr_hier_grp TYPE bapi0012_ccinputlist-costctr_hier_grp,
        comp_code TYPE bapi0012_ccinputlist-comp_code,
        bus_area TYPE bapi0012_ccinputlist-bus_area,
        currency TYPE bapi0012_ccinputlist-currency,
        currency_iso TYPE bapi0012_ccinputlist-currency_iso,
        profit_ctr TYPE bapi0012_ccinputlist-profit_ctr,
        record_quantity TYPE bapi0012_ccinputlist-record_quantity,
        lock_ind_actual_primary_costs TYPE bapi0012_ccinputlist-lock_ind_actual_primary_costs,
        lock_ind_plan_primary_costs TYPE bapi0012_ccinputlist-lock_ind_plan_primary_costs,
        lock_ind_act_secondary_costs TYPE bapi0012_ccinputlist-lock_ind_act_secondary_costs,
        lock_ind_plan_secondary_costs TYPE bapi0012_ccinputlist-lock_ind_plan_secondary_costs,
        lock_ind_actual_revenues TYPE bapi0012_ccinputlist-lock_ind_actual_revenues,
        lock_ind_plan_revenues TYPE bapi0012_ccinputlist-lock_ind_plan_revenues,
        lock_ind_commitment_update TYPE bapi0012_ccinputlist-lock_ind_commitment_update,
        condition_table_usage TYPE bapi0012_ccinputlist-condition_table_usage,
        application TYPE bapi0012_ccinputlist-application,
        cstg_sheet TYPE bapi0012_ccinputlist-cstg_sheet,
        acty_indep_template TYPE bapi0012_ccinputlist-acty_indep_template,
        acty_dep_template TYPE bapi0012_ccinputlist-acty_dep_template,
        addr_title TYPE bapi0012_ccinputlist-addr_title,
        addr_name1 TYPE bapi0012_ccinputlist-addr_name1,
        addr_name2 TYPE bapi0012_ccinputlist-addr_name2,
        addr_name3 TYPE bapi0012_ccinputlist-addr_name3,
        addr_name4 TYPE bapi0012_ccinputlist-addr_name4,
        addr_street TYPE bapi0012_ccinputlist-addr_street,
        addr_city TYPE bapi0012_ccinputlist-addr_city,
        addr_district TYPE bapi0012_ccinputlist-addr_district,
        addr_country TYPE bapi0012_ccinputlist-addr_country,
        addr_country_iso TYPE bapi0012_ccinputlist-addr_country_iso,
        addr_taxjurcode TYPE bapi0012_ccinputlist-addr_taxjurcode,
        addr_po_box TYPE bapi0012_ccinputlist-addr_po_box,
        addr_postl_code TYPE bapi0012_ccinputlist-addr_postl_code,
        addr_pobx_pcd TYPE bapi0012_ccinputlist-addr_pobx_pcd,
        addr_region TYPE bapi0012_ccinputlist-addr_region,
        telco_langu TYPE bapi0012_ccinputlist-telco_langu,
        telco_langu_iso TYPE bapi0012_ccinputlist-telco_langu_iso,
        telco_telephone TYPE bapi0012_ccinputlist-telco_telephone,
        telco_telephone2 TYPE bapi0012_ccinputlist-telco_telephone2,
        telco_telebox TYPE bapi0012_ccinputlist-telco_telebox,
        telco_telex TYPE bapi0012_ccinputlist-telco_telex,
        telco_fax_number TYPE bapi0012_ccinputlist-telco_fax_number,
        telco_teletex TYPE bapi0012_ccinputlist-telco_teletex,
        telco_printer TYPE bapi0012_ccinputlist-telco_printer,
        telco_data_line TYPE bapi0012_ccinputlist-telco_data_line,
        jv_venture TYPE bapi0012_ccinputlist-jv_venture,
        jv_rec_ind TYPE bapi0012_ccinputlist-jv_rec_ind,
        jv_equity_typ TYPE bapi0012_ccinputlist-jv_equity_typ,
        jv_otype TYPE bapi0012_ccinputlist-jv_otype,
        jv_jibcl TYPE bapi0012_ccinputlist-jv_jibcl,
        jv_jibsa TYPE bapi0012_ccinputlist-jv_jibsa,
        name TYPE bapi0012_ccinputlist-name,
        descript TYPE bapi0012_ccinputlist-descript,
        func_area TYPE bapi0012_ccinputlist-func_area,
        acty_dep_template_alloc_cc TYPE bapi0012_ccinputlist-acty_dep_template_alloc_cc,
        acty_indep_template_alloc_cc TYPE bapi0012_ccinputlist-acty_indep_template_alloc_cc,
        func_area_long TYPE bapi0012_ccinputlist-func_area_long,
        person_in_charge_user TYPE bapi0012_ccinputlist-person_in_charge_user,
      END OF it_costcenter.

DATA: BEGIN OF it_result occurs 0,
        type TYPE bapiret2-type,
        id TYPE bapiret2-id,
        number TYPE bapiret2-number,
        message TYPE bapiret2-message,
        log_no TYPE bapiret2-log_no,
        log_msg_no TYPE bapiret2-log_msg_no,
        message_v1 TYPE bapiret2-message_v1,
        message_v2 TYPE bapiret2-message_v2,
        message_v3 TYPE bapiret2-message_v3,
        message_v4 TYPE bapiret2-message_v4,
        parameter TYPE bapiret2-parameter,
        row TYPE bapiret2-row,
        field TYPE bapiret2-field,
        system TYPE bapiret2-system,
      END OF it_result.

DATA: BEGIN OF it_result_act occurs 0,
        type TYPE bapiret2-type,
        id TYPE bapiret2-id,
        number TYPE bapiret2-number,
        message TYPE bapiret2-message,
        log_no TYPE bapiret2-log_no,
        log_msg_no TYPE bapiret2-log_msg_no,
        message_v1 TYPE bapiret2-message_v1,
        message_v2 TYPE bapiret2-message_v2,
        message_v3 TYPE bapiret2-message_v3,
        message_v4 TYPE bapiret2-message_v4,
        parameter TYPE bapiret2-parameter,
        row TYPE bapiret2-row,
        field TYPE bapiret2-field,
        system TYPE bapiret2-system,
      END OF it_result_act.


*"----------------------------------------------------------------------
*"*"*              CREATION - COSTCENTER (Transaction KS01)
*"----------------------------------------------------------------------


str_costcenter-costcenter            = str_image_table-pernr.
        str_costcenter-valid_from            = it_data-begda .
        str_costcenter-valid_to              = it_data-endda .
        str_costcenter-person_in_charge      = name_responsable.
        str_costcenter-costcenter_type       = 'C'.
        str_costcenter-costctr_hier_grp      = 'A_BSBI'.
        str_costcenter-comp_code             = 'FR01'. "it_p0001-bukrs.
        str_costcenter-bus_area              = it_p0001-gsber.
        str_costcenter-currency              = it_devise-waers.
        str_costcenter-profit_ctr            = ''.
        str_costcenter-name                  = name_responsable .
        str_costcenter-descript              = name_responsable .
        str_costcenter-profit_ctr            = 'P10000001'.
        APPEND str_costcenter to it_costcenter.


        str_costcenter_act-co_area  = it_p0001-kokrs.
        str_costcenter_act-costcenter	= str_image_table-pernr.
        str_costcenter_act-name	       = name_responsable.
        str_costcenter_act-descript	= name_responsable.
        str_costcenter_act-act_state  = 'X'.
        APPEND str_costcenter_act to it_costcenter_act.

CALL FUNCTION 'BAPI_COSTCENTER_CREATEMULTIPLE'
  EXPORTING
    controllingarea            = it_p0001-kokrs
*    TESTRUN                   = ''
*   MASTER_DATA_INACTIVE       = ' '
*   LANGUAGE                   =
  tables
    costcenterlist             = it_costcenter
    return                     = str_result.
*   EXTENSIONIN                =
*   EXTENSIONOUT               =

CALL FUNCTION 'BAPI_CTR_ACTIVATE_MULTIPLE'
  EXPORTING
    controllingarea       = it_p0001-kokrs
*   TESTRUN                = ''
  tables
    costcenterlist        = it_costcenter_act
    return                = str_result_act
*   EXTENSIONIN           =
*   EXTENSIONOUT          =
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

The creation is successfull.

-


I want do the same but in modification with BAPI_COSTCENTER_CHANGEMULTIPLE but he don't change anything.

I use this code :

        str_costcenter-costcenter            = '0010000001'.
        str_costcenter-valid_from            = '20080101' .
        str_costcenter-valid_to              = '99991231' .
        str_costcenter-person_in_charge      = 'name_responsable'.
        str_costcenter-costcenter_type       = 'C'.
        str_costcenter-costctr_hier_grp      = 'A_BSBI'.
        str_costcenter-comp_code             = it_p0001-bukrs.
        str_costcenter-bus_area              = it_p0001-gsber.
        str_costcenter-currency              = 'GBP'.
        str_costcenter-name                  = 'name_responsable' .
        str_costcenter-descript              = 'name_responsable' .
        str_costcenter-profit_ctr            = 'P10000001'.
        APPEND str_costcenter to it_costcenter.


        str_costcenter_act-co_area  = it_p0001-kokrs.
        str_costcenter_act-costcenter  = '0010000001'.
        str_costcenter_act-name         = 'name_responsable' .
        str_costcenter_act-descript  = 'name_responsable' .
        str_costcenter_act-act_state  = 'X'.
        APPEND str_costcenter_act to it_costcenter_act.


CALL FUNCTION 'BAPI_COSTCENTER_CHANGEMULTIPLE'
  EXPORTING
    controllingarea            = it_p0001-kokrs
*   TESTRUN                    = ' '
*   MASTER_DATA_INACTIVE       = ' '
*   LANGUAGE                   =
  tables
   costcenterlist             = it_costcenter
    return                     = str_result.
*   EXTENSIONIN                =
*   EXTENSIONOUT               =


CALL FUNCTION 'BAPI_CTR_ACTIVATE_MULTIPLE'
  EXPORTING
    controllingarea       = it_p0001-kokrs
*   TESTRUN                = ''
  tables
    costcenterlist        = it_costcenter_act
    return                = str_result_act
*   EXTENSIONIN           =
*   EXTENSIONOUT          = 
.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Appreciate your help on this regards.

Spawnrad