Application Development and Automation 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: 
Read only

Add a material to Change Master function module

Former Member
0 Likes
1,368

Does anyone know of a function module that will add a material to a change master?.

I'm refering to the type of document you create/change with transaction CC01/CC02.

Table reference AEOI-AENNR.

2 REPLIES 2
Read only

Former Member
0 Likes
708

Use the function module 'CCAP_ECN_MAINTAIN'

CALL FUNCTION 'CCAP_ECN_HEADER_READ'

EXPORTING

CHANGE_NO = ECN_NUMBER

IMPORTING

CHANGE_HEADER = ls_aennr_head_output

EXCEPTIONS

NO_RECORD_FOUND = 1

ERROR = 2

OTHERS = 3 .

IF SY-SUBRC <> 0.

  • -> Systemlog

ELSE.

CLEAR ls_aennr_head_input.

MOVE-CORRESPONDING ls_aennr_head_output TO ls_aennr_head_input.

ENDIF.

CLEAR ls_aennr_head_input-INDATE_RULE.

CLEAR ls_aennr_head_input-OUTDATE_RULE.

objetct_mat-ACTIVE = 'X'.

objetct_mat-MGTREC_GEN = 'X'.

objetct_mat-OBJ_REQU = 'X'.

CALL FUNCTION 'CALO_INIT_API'

EXPORTING

data_reset_sign = '!'

EXCEPTIONS

log_object_not_found = 1

log_sub_object_not_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • -> Systemlog ENDIF.

endif.

ls_object_for_aennr-chg_objtyp = '4'.

  • CALL FUNCTION 'CONVERSION_EXIT_CCMAT_OUTPUT'

*EXPORTING

  • INPUT = MATERIAL

  • IMPORTING

  • OUTPUT = ls_object_for_aennr-material .

ls_object_for_aennr-material = MATERIAL.

REFRESH lt_object_for_aennr.

APPEND ls_object_for_aennr TO lt_object_for_aennr.

CALL FUNCTION 'CCAP_ECN_MAINTAIN'

EXPORTING

CHANGE_HEADER = ls_aennr_head_input

OBJECT_MAT = objetct_mat

FL_COMMIT_AND_WAIT = 'X'

FL_SYNCH = ' '

TABLES

OBJMGREC = lt_object_for_aennr

EXCEPTIONS

ERROR = 1

OTHERS = 2 .

IF SY-SUBRC <> 0.

  • -> Systemlog

ENDIF.

Read only

0 Likes
708

Hello ,

I tried these codes and activated the program after correcting the errors but it does not add the material to the ECN. What could be the problem? I debug but t cannot see the fault. Please help.