Skip to Content
Technical Articles

Use BDC and BAPI CCAP_ECN_MAINTAIN at the same time to update Engineer Change Number (Change Master)

Introduction:

When you create an ECN by BAPI  CCAP_ECN_MAINTAIN, you can see there are some different comparing with when you create an ECN by Tcode SC01. The object types list looks not the same.

So you can combine BDC technique and BAPI to correct this error.

First you create ECN by BDC, then use BAPI to update Long Text and other fields.

Problem:

Create Change master by SC01:

Create ECN by BAPI “CCAP_ECN_MAINTAIN”

        You can see they are not exactly the same.

Scenario:

You need to create an ECN (Change Master) use a default Profile to define Object Types based on that profile.

Solution:

You need to follow these steps below to create an ECN Change Master:

  1. Create an BDC to run Tcode SC01 (Create Change Master)
  2. Call FM “CCAP_ECN_MAINTAIN” to maintain Long Text

Details:

  1. Use Tcode SHDB to record BDC
  2. Create a form or a FM to process BDC
  3. Fill relevant values to BDC, then call Transaction SC01
  PERFORM BDC_NODATA      USING NODATA.

  PERFORM OPEN_GROUP      USING GROUP USER KEEP HOLDDATE CTU.

  PERFORM BDC_DYNPRO      USING 'SAPMC29C' '0100'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'RC29A-AENNR'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '/00'.
  PERFORM BDC_FIELD       USING 'RC29A-AENNR'
                                IM_CHANGENO-CHANGE_NO.
  PERFORM BDC_FIELD       USING 'RAD_AEFUN-OHFR'
                                'X'.
  PERFORM BDC_FIELD       USING 'RC29A-AEPRO'
                                IM_PROFILE.
  PERFORM BDC_DYNPRO      USING 'SAPMC29C' '0010'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '=VWND'.
  PERFORM BDC_FIELD       USING 'RC29A-AETXT'
                                IM_MAT-AETXT.
  PERFORM BDC_FIELD       USING 'RC29A-DATUV'
                                IM_CHANGENO-VALID_FROM.
  PERFORM BDC_FIELD       USING 'RC29A-AENST'
                                LW_STATUS.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'CI_AENR-ZZPROPOSE'.
  PERFORM BDC_FIELD       USING 'CI_AENR-ZZAENNR'
                                IM_CHANGE_CI-ZZAENNR.
  PERFORM BDC_FIELD       USING 'CI_AENR-ZZCHG_TYPE'
                                IM_CHANGE_CI-ZZCHG_TYPE.
  PERFORM BDC_FIELD       USING 'CI_AENR-ZZCOOR'
                                IM_CHANGE_CI-ZZCOOR.
  PERFORM BDC_FIELD       USING 'CI_AENR-ZZDISPOSAL'
                                IM_CHANGE_CI-ZZDISPOSAL.
  PERFORM BDC_FIELD       USING 'CI_AENR-ZZMODELYR'
                                IM_CHANGE_CI-ZZMODELYR.
  PERFORM BDC_FIELD       USING 'CI_AENR-ZZPROPOSE'
                                LW_PROPOSE.
  PERFORM BDC_DYNPRO      USING 'SAPMC29C' '0020'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '/00'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'RC29A-AENNR'.
  PERFORM BDC_DYNPRO      USING 'SAPMC29C' '0020'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '=FCBU'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'RC29A-AENNR'.


  PERFORM BDC_TRANSACTION TABLES MESSTAB
  USING                         'CC01'
                                CTU
                                MODE
                                UPDATE.

4. Prepare data for BAPI “CCAP_ECN_MAINTAIN”, fill Long Text to update, then call BAPI to update Change Master

* Longtext processing
  "Text key
  LS_TEXTHEADER-TEXTKEY = '00000001'.
  "Name
  LS_TEXTHEADER-TDNAME  = SY-MANDT &&
                          IM_CHANGENO-CHANGE_NO.
  "ID
  LS_TEXTHEADER-TDID    = 'AENR'.
  "Language
  LS_TEXTHEADER-TDSPRAS = 'E'.
  APPEND LS_TEXTHEADER TO LT_TEXTHEADER.

  "Text key
  LS_TEXTLINES-TEXTKEY  = '00000001'.
  "Format
  LS_TEXTLINES-TDFORMAT = '*'.
  "Text
  LS_TEXTLINES-TDLINE   = IM_MAT-AETXT.
  APPEND LS_TEXTLINES TO LT_TEXTLINES.

  LV_LEN = STRLEN( IM_MAT-Z_COMMENT ).

* If text length greater than 72 characters then split it
  IF LV_LEN > 72.
    LV_COMMENT = IM_MAT-Z_COMMENT.

    WHILE LV_LEN > 72.
      LV_LINE = SUBSTRING( VAL = LV_COMMENT OFF = 0 LEN = 72 ).
      SHIFT LV_COMMENT BY 72 PLACES LEFT.
      LS_TEXTLINES-TEXTKEY  = '00000001'.
      LS_TEXTLINES-TDFORMAT = '*'.
      LS_TEXTLINES-TDLINE   = LV_LINE.
      APPEND LS_TEXTLINES TO LT_TEXTLINES
      .
      LV_LEN = STRLEN( LV_COMMENT ).
    ENDWHILE.
  ELSE.
    LS_TEXTLINES-TEXTKEY    = '00000001'.
    LS_TEXTLINES-TDFORMAT   = '*'.
    LS_TEXTLINES-TDLINE     = IM_MAT-Z_COMMENT.
    APPEND LS_TEXTLINES TO LT_TEXTLINES.
    CLEAR LS_TEXTLINES.
  ENDIF.

* Profile Status
  WA_OBJMGREC-CHG_OBJTYP      = '7'.
  WA_OBJMGREC-OBJ_CHGLOCK     = ABAP_TRUE.
  WA_OBJMGREC-STATUS_PROF_OBJ = IM_PROFILE.
  APPEND WA_OBJMGREC TO LT_OBJMGREC.

  " Object type
  SELECT * FROM TCC18
    INTO TABLE LT_TCC18
    WHERE OBTPR = IM_PROFILE.

  LOOP AT LT_TCC18 INTO DATA(LS_TCC18).
    CASE LS_TCC18-AETYP.
      WHEN 02.
        OBJECT_BOM_MAT-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_BOM_MAT-LOCKED         = LS_TCC18-AENSP.
        OBJECT_BOM_MAT-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_BOM_MAT-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_BOM_MAT-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_BOM_MAT-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 03.
        OBJECT_BOM_EQUI-ACTIVE        = LS_TCC18-AEERL.
        OBJECT_BOM_EQUI-LOCKED        = LS_TCC18-AENSP.
        OBJECT_BOM_EQUI-OBJ_REQU      = LS_TCC18-INDFL.
        OBJECT_BOM_EQUI-MGTREC_GEN    = LS_TCC18-OIGEN.
        OBJECT_BOM_EQUI-GEN_NEW       = LS_TCC18-GENAN.
        OBJECT_BOM_EQUI-GEN_DIALOG    = LS_TCC18-GENDI.
      WHEN 04.
        OBJECT_BOM_DOC-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_BOM_DOC-LOCKED         = LS_TCC18-AENSP.
        OBJECT_BOM_DOC-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_BOM_DOC-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_BOM_DOC-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_BOM_DOC-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 05.
        OBJECT_BOM_LOC-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_BOM_LOC-LOCKED         = LS_TCC18-AENSP.
        OBJECT_BOM_LOC-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_BOM_LOC-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_BOM_LOC-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_BOM_LOC-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 06.
        OBJECT_BOM_STD-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_BOM_STD-LOCKED         = LS_TCC18-AENSP.
        OBJECT_BOM_STD-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_BOM_STD-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_BOM_STD-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_BOM_STD-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 07.
        OBJECT_BOM_CUS-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_BOM_CUS-LOCKED         = LS_TCC18-AENSP.
        OBJECT_BOM_CUS-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_BOM_CUS-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_BOM_CUS-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_BOM_CUS-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 08.
        OBJECT_BOM_PSP-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_BOM_PSP-LOCKED         = LS_TCC18-AENSP.
        OBJECT_BOM_PSP-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_BOM_PSP-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_BOM_PSP-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_BOM_PSP-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 12.
        OBJECT_TLIST_N-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_N-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_N-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_N-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_N-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_N-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 13.
        OBJECT_TLIST_S-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_S-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_S-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_S-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_S-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_S-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 21.
        OBJECT_TLIST_Q-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_Q-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_Q-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_Q-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_Q-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_Q-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 22.
        OBJECT_TLIST_A-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_A-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_A-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_A-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_A-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_A-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 23.
        OBJECT_TLIST_E-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_E-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_E-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_E-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_E-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_E-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 24.
        OBJECT_TLIST_2-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_2-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_2-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_2-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_2-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_2-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 25.
        OBJECT_TLIST_R-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_R-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_R-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_R-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_R-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_R-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 26.
        OBJECT_TLIST_M-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_M-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_M-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_M-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_M-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_M-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 27.
        OBJECT_TLIST_T-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_TLIST_T-LOCKED         = LS_TCC18-AENSP.
        OBJECT_TLIST_T-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_TLIST_T-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_TLIST_T-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_TLIST_T-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 31.
        OBJECT_DOC-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_DOC-LOCKED         = LS_TCC18-AENSP.
        OBJECT_DOC-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_DOC-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_DOC-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_DOC-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 41.
        OBJECT_MAT-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_MAT-LOCKED         = LS_TCC18-AENSP.
        OBJECT_MAT-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_MAT-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_MAT-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_MAT-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 51.
        OBJECT_CHAR-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_CHAR-LOCKED         = LS_TCC18-AENSP.
        OBJECT_CHAR-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_CHAR-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_CHAR-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_CHAR-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 52.
        OBJECT_CLS_MAINT-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_CLS_MAINT-LOCKED         = LS_TCC18-AENSP.
        OBJECT_CLS_MAINT-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_CLS_MAINT-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_CLS_MAINT-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_CLS_MAINT-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 53.
        OBJECT_CLS-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_CLS-LOCKED         = LS_TCC18-AENSP.
        OBJECT_CLS-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_CLS-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_CLS-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_CLS-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 54.
        OBJECT_DEP-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_DEP-LOCKED         = LS_TCC18-AENSP.
        OBJECT_DEP-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_DEP-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_DEP-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_DEP-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 55.
        OBJECT_CONF_PROF-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_CONF_PROF-LOCKED         = LS_TCC18-AENSP.
        OBJECT_CONF_PROF-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_CONF_PROF-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_CONF_PROF-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_CONF_PROF-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 60.
        OBJECT_SUBSTANCE-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_SUBSTANCE-LOCKED         = LS_TCC18-AENSP.
        OBJECT_SUBSTANCE-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_SUBSTANCE-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_SUBSTANCE-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_SUBSTANCE-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 61.
        OBJECT_PHRASE-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_PHRASE-LOCKED         = LS_TCC18-AENSP.
        OBJECT_PHRASE-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_PHRASE-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_PHRASE-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_PHRASE-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 62.
        OBJECT_HAZMAT-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_HAZMAT-LOCKED         = LS_TCC18-AENSP.
        OBJECT_HAZMAT-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_HAZMAT-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_HAZMAT-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_HAZMAT-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 63.
        OBJECT_VAR_TAB-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_VAR_TAB-LOCKED         = LS_TCC18-AENSP.
        OBJECT_VAR_TAB-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_VAR_TAB-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_VAR_TAB-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_VAR_TAB-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 71.
        OBJECT_PVS_VAR-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_PVS_VAR-LOCKED         = LS_TCC18-AENSP.
        OBJECT_PVS_VAR-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_PVS_VAR-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_PVS_VAR-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_PVS_VAR-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 72.
        OBJECT_PVS_ALT-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_PVS_ALT-LOCKED         = LS_TCC18-AENSP.
        OBJECT_PVS_ALT-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_PVS_ALT-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_PVS_ALT-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_PVS_ALT-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 73.
        OBJECT_PVS_REL-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_PVS_REL-LOCKED         = LS_TCC18-AENSP.
        OBJECT_PVS_REL-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_PVS_REL-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_PVS_REL-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_PVS_REL-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 75.
        OBJECT_O75-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_O75-LOCKED         = LS_TCC18-AENSP.
        OBJECT_O75-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_O75-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_O75-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_O75-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 77.
        OBJECT_O77-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_O77-LOCKED         = LS_TCC18-AENSP.
        OBJECT_O77-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_O77-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_O77-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_O77-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 79.
        OBJECT_O79-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_O79-LOCKED         = LS_TCC18-AENSP.
        OBJECT_O79-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_O79-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_O79-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_O79-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 81.
        OBJECT_O81-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_O81-LOCKED         = LS_TCC18-AENSP.
        OBJECT_O81-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_O81-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_O81-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_O81-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 82.
        OBJECT_O82-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_O82-LOCKED         = LS_TCC18-AENSP.
        OBJECT_O82-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_O82-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_O82-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_O82-GEN_DIALOG     = LS_TCC18-GENDI.
      WHEN 83.
        OBJECT_O83-ACTIVE         = LS_TCC18-AEERL.
        OBJECT_O83-LOCKED         = LS_TCC18-AENSP.
        OBJECT_O83-OBJ_REQU       = LS_TCC18-INDFL.
        OBJECT_O83-MGTREC_GEN     = LS_TCC18-OIGEN.
        OBJECT_O83-GEN_NEW        = LS_TCC18-GENAN.
        OBJECT_O83-GEN_DIALOG     = LS_TCC18-GENDI.
    ENDCASE.
  ENDLOOP.

*   Update ECN
  CALL FUNCTION 'CCAP_ECN_MAINTAIN'
    EXPORTING
      CHANGE_HEADER     = IM_CHANGENO
      CHANGE_HEADER_CUS = IM_CHANGE_CI
      OBJECT_BOM_MAT    = OBJECT_BOM_MAT
      OBJECT_BOM_EQUI   = OBJECT_BOM_EQUI
      OBJECT_BOM_DOC    = OBJECT_BOM_DOC
      OBJECT_BOM_LOC    = OBJECT_BOM_LOC
      OBJECT_BOM_STD    = OBJECT_BOM_STD
      OBJECT_BOM_CUS    = OBJECT_BOM_CUS
      OBJECT_BOM_PSP    = OBJECT_BOM_PSP
*     object_tlist      = object_tlist
      OBJECT_TLIST_A    = OBJECT_TLIST_A
      OBJECT_TLIST_E    = OBJECT_TLIST_E
      OBJECT_TLIST_M    = OBJECT_TLIST_M
      OBJECT_TLIST_N    = OBJECT_TLIST_N
      OBJECT_TLIST_Q    = OBJECT_TLIST_Q
      OBJECT_TLIST_R    = OBJECT_TLIST_R
      OBJECT_TLIST_S    = OBJECT_TLIST_S
      OBJECT_TLIST_T    = OBJECT_TLIST_T
      OBJECT_TLIST_2    = OBJECT_TLIST_2
      OBJECT_DOC        = OBJECT_DOC
      OBJECT_MAT        = OBJECT_MAT
*     object_char       = object_char
      OBJECT_CLS_MAINT  = OBJECT_CLS_MAINT
      OBJECT_CLS        = OBJECT_CLS
      OBJECT_DEP        = OBJECT_DEP
      OBJECT_CONF_PROF  = OBJECT_CONF_PROF
      OBJECT_SUBSTANCE  = OBJECT_SUBSTANCE
      OBJECT_PHRASE     = OBJECT_PHRASE
      OBJECT_HAZMAT     = OBJECT_HAZMAT
      OBJECT_VAR_TAB    = OBJECT_VAR_TAB
      OBJECT_PVS_VAR    = OBJECT_PVS_VAR
      OBJECT_PVS_ALT    = OBJECT_PVS_ALT
      OBJECT_PVS_REL    = OBJECT_PVS_REL
      OBJECT_O75        = OBJECT_O75
      OBJECT_O77        = OBJECT_O77
      OBJECT_O79        = OBJECT_O79
      OBJECT_O81        = OBJECT_O81
      OBJECT_O82        = OBJECT_O82
      OBJECT_O83        = OBJECT_O83
      FL_NO_COMMIT_WORK = PPET_TRUE
      FL_SYNCH          = PPET_TRUE
    IMPORTING
      CHANGE_NO         = LV_ECN
    TABLES
      OBJMGREC          = LT_OBJMGREC[]
      TEXTHEADER        = LT_TEXTHEADER
      TEXTLINES         = LT_TEXTLINES
    EXCEPTIONS
      OTHERS            = 2.

  IF IM_TEST = ABAP_TRUE .
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT = 'X'.
  ENDIF.

 

Conclusion:

It is ok if you run BAPI “CCAP_ECN_MAINTAIN” to update ECN, but when you create ECN by using that BAPI, somehow program ran incorrect. Therefore, you can combine BDC and BAPI to fulfill the requirement.

If you have any question, please leave your comment below. Thank you.

3 Comments
You must be Logged on to comment or reply to a post.
    • Thanks Rossi. That’s why i use both BDC and that FM to make it works. If you create a BDC for SC02, it’s very difficult to update object types because of its order and its values change all the time. But do you have any suggestion for this situation? Do you use another FM?