Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_COSTCENTER_CHANGEMULTIPLE - Issue

Former Member
0 Kudos

Dear all,

I have enhanced the CSKS table (ie. Custom field is included through one structure (CI_CSKS)). Now i need to update the custom field via one Z-program. so i am trying to use the BAPI (BAPI_COSTCENTER_CHANGEMULTIPLE) for updating cost center details.

When i am using the BAPI, custom field is not updated. I'm passing the custom field value in EXTENSIONIN. For ref.

Ls_EXTENSIONIN type BAPIPAREX

Ls_EXTENSIONIN-STRUCTURE = 'CI_CSKS'.

Ls_EXTENSIONIN-VALUEPART1 = gs_csks-ZZUSER2.

APPEND Ls_EXTENSIONIN TO LT_EXTENSIONIN.

I have seen thread related to my issue, but i couldn't get the solution

As per above thread i have implemented the badi (K_CCA_CUSTOMER_FIELD) which contains method (COSTCENTER_CREATE)

data : ls_extension type BAPIPAREX,

ls_ex_tcsks_ci type CSKS_CI.

loop at IM_EXTENSION into ls_extension.

ls_ex_tcsks_ci-DUMMY_FIELD = 'X'.

ls_ex_tcsks_ci-ZZUSER2 = ls_extension-VALUEPART1.

APPEND ls_ex_tcsks_ci TO EX_TCSKS_CI.

endloop.

Let me know how to update custom field details through above bapi or is any other fm or bapi is available.

3 REPLIES 3

Former Member
0 Kudos

Hi all

Anyone help me.

Former Member
0 Kudos

Use below code:

This is from a standard Include LKWEB_CCTRF01

DATA: ls_cctr             TYPE isr_costcenter_change,
           lt_extin            TYPE TABLE OF bapiparex WITH HEADER LINE.

*.move user fields in ls_cctr-ci_csks in EXTENSIONIN
  PERFORM move_ci_csks_to_extin TABLES lt_extin
                                USING ls_cctr.

*&---------------------------------------------------------------------*
*&      Form  move_ci_csks_to_extin
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      <-- PT_EXTIN  text
*      --> PS_CCTR
*----------------------------------------------------------------------*
FORM move_ci_csks_to_extin
*----------------------------------------------------------------------
TABLES
   pt_extin STRUCTURE bapiparex
USING
   value(ps_cctr) TYPE isr_costcenter_change.
*----------------------------------------------------------------------
  DATA: ls_bapi_te_csks     TYPE bapi_te_csks,
        ld_length_bapiparex TYPE sytfill.

  CALL FUNCTION 'DDIF_FIELDINFO_GET'
    EXPORTING
      tabname   = 'CI_CSKS'                                 "#EC NOTEXT
    EXCEPTIONS
      not_found = 1.
  IF sy-subrc = 0.                     " user defined extension found
    DESCRIBE FIELD pt_extin LENGTH ld_length_bapiparex
                   in byte mode.
    DESCRIBE FIELD pt_extin-structure LENGTH sy-tfill
                   in byte mode.
    ld_length_bapiparex = ld_length_bapiparex - sy-tfill.
    DESCRIBE FIELD ls_bapi_te_csks LENGTH sy-tfill
                   in byte mode.
    IF sy-tfill > ld_length_bapiparex.
      MESSAGE x003.   " Customer Include structure too long!!
    ENDIF.
    pt_extin-structure = 'BAPI_TE_CSKS'.                    "#EC NOTEXT
    MOVE-CORRESPONDING ps_cctr TO ls_bapi_te_csks.
    DESCRIBE FIELD pt_extin-structure LENGTH sy-tfill
                   in character mode.
    MOVE ls_bapi_te_csks TO pt_extin+sy-tfill.
    APPEND pt_extin.
  ENDIF.

ENDFORM.

Thanks and Regards,

0 Kudos

HI chandra madapati

Its not working. Same issue. values is not updating. Let me know shall i activate K_CCA_CUSTOMER_FIELD BADI.