Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Program to update BOM by CSAP_MAT_BOM_CREATE as error KEY_INCOMPLETE coming

Hi to all,

Can any one provide me sample program to update BOM via Function Module CSAP_MAT_BOM_CREATE.

As i already have created the program , but run time error is coming KEY_INCOMPLETE for CSAP_MAT_BOM_CREATE.

as i have already search the SDN , but cant get any specific answer for that.

Note: itab_bom_header and itab_bom_item_details are of same line type as

i_stko and t_stpo with data.

DATA: wa_bom_header TYPE zia_str_bom_header,

wa_itab_bom_item_details TYPE zia_str_bom_item_details.

IF itab_bom_header[] IS NOT INITIAL .

READ TABLE itab_bom_header INTO wa_bom_header INDEX 1 .

ENDIF.

*---- BOM header data structure

DATA: BEGIN OF tstko OCCURS 0.

INCLUDE STRUCTURE stko_api01.

DATA: END OF tstko.

DATA: wa_tstko LIKE LINE OF tstko.

*---- BOM items table

DATA: BEGIN OF tstpo OCCURS 0.

INCLUDE STRUCTURE stpo_api01.

DATA: END OF tstpo.

DATA: wa_tstpo LIKE LINE OF tstpo.

**---- Object dependencies table

*

    • Basis data

*data: begin of tdep_data occurs 0.

*include structure csdep_dat.

*data: end of tdep_data.

*

    • Description

*data: begin of tdep_descr occurs 0.

*include structure csdep_desc.

*data: end of tdep_descr.

*

    • Source

*data: begin of tdep_source occurs 0.

*include structure csdep_sorc.

*data: end of tdep_source.

*

    • Sequence

*data: begin of tdep_order occurs 0.

*include structure csdep_ord.

*data: end of tdep_order.

*

    • Documentation

*data: begin of tdep_doc occurs 0.

*include structure csdep_doc.

*data: end of tdep_doc.

CALL FUNCTION 'CALO_INIT_API'

  • EXPORTING

  • FLAG_DB_LOG_ON = 'X'

  • FLAG_MSG_ON = 'X'

  • FLAG_API_API_CALL_ON = ' '

  • FLAG_COLLECT_MSG_ON = ' '

  • EXTERNAL_LOG_NO = 'API'

  • DEL_LOG_AFTER_DAYS = '10'

  • DATA_RESET_SIGN = '!'

EXCEPTIONS

LOG_OBJECT_NOT_FOUND = 1

LOG_SUB_OBJECT_NOT_FOUND = 2

OTHERS = 3

.

LOOP AT itab_bom_header INTO wa_bom_header.

wa_tstko-BASE_QUAN = wa_bom_header-base_qty.

wa_tstko-BASE_UNIT = wa_bom_header-BASE_UOM.

wa_tstko-BOM_STATUS = wa_bom_header-BOM_STATUS.

ENDLOOP.

LOOP AT itab_bom_item_details INTO wa_itab_bom_item_details.

wa_tstpo-item_categ = wa_itab_bom_item_details-item_category.

wa_tstpo-item_no = wa_itab_bom_item_details-bom_itm_number.

wa_tstpo-component = wa_itab_bom_item_details-component.

wa_tstpo-comp_unit = wa_itab_bom_item_details-uom.

wa_tstpo-comp_qty = '10'.

wa_tstpo-valid_from = wa_itab_bom_item_details-valid_from.

wa_tstpo-itm_ident = wa_itab_bom_item_details-item_id .

APPEND wa_tstpo TO tstpo .

ENDLOOP.

  • FM to create BOM

CALL FUNCTION 'CSAP_MAT_BOM_CREATE'

EXPORTING

material = wa_bom_header-material

plant = wa_bom_header-plant

bom_usage = wa_bom_header-bom_usage

  • VALID_FROM = wa_bom_header-VALID_FROM

  • CHANGE_NO =

  • REVISION_LEVEL =

i_stko = tstko " bom header

  • FL_NO_CHANGE_DOC = ' '

  • FL_COMMIT_AND_WAIT = ' '

  • FL_CAD = ' '

  • fl_default_values = 'X'

IMPORTING

fl_warning = fl_warning

bom_no = bom_no

TABLES

t_stpo = tstpo " bom item

  • T_DEP_DATA = tdep_data

  • T_DEP_DESCR = tdep_descr

*

  • T_DEP_ORDER = tdep_source

  • T_DEP_SOURCE = tdep_order

  • T_DEP_DOC = tdep_doc

  • T_LTX_LINE =

  • T_STPU =

EXCEPTIONS

error = 1

  • OTHERS = 2

.

IF sy-subrc <> 1.

WRITE 'error'.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF fl_warning EQ 'X'.

WRITE 'done'.

ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

please can any one provide me the solution for that.

i shall be thankfull to you for this.

Regards

Pavneet Rana

Edited by: pavneet rana on Aug 18, 2011 3:01 PM

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question