09-02-2008 12:25 PM
Hi,
I try to maintain BOM data by CSAP_MAT_BOM_MAINTAIN bapi. Everthing works ok when I use example code of this function module. But when it comes to terms deleting an item from BOM, I always get error :
"No active nametab exists for CI_STPO".
But it also deletes the item. Do you have any idea?
*---- BOM header data structure
data: begin of tstk2.
include structure stko_api02.
data: end of tstk2.
*---- BOM items table
data: begin of tstp3 occurs 0.
include structure stpo_api03.
data: end of tstp3.
DATA tstko TYPE stko_api01.
*---- Object dependencies table
* Basis data
data: begin of tdep2_data occurs 0.
include structure dep_data.
data: end of tdep2_data.
* Description
data: begin of tdep2_descr occurs 0.
include structure dep_descr.
data: end of tdep2_descr.
* Source
data: begin of tdep2_source occurs 0.
include structure dep_source.
data: end of tdep2_source.
* Sequence
data: begin of tdep2_order occurs 0.
include structure dep_order.
data: end of tdep2_order.
* Documentation
data: begin of tdep2_doc occurs 0.
include structure dep_doc.
data: end of tdep2_doc.
data: flg_warning like capiflag-flwarning.
*data : error_code type BAPI_MSG.
*- Initialize database log
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
other_error = 3
others = 4.
clear tstp3.
tstp3-id_item_no = '0050'. "Item identification.
tstp3-fldelete = 'X'.
append tstp3.
*- Change BOM
call function 'CSAP_MAT_BOM_MAINTAIN'
exporting
material = MATNR
plant = PLANT
bom_usage = BOM_USAGE
valid_from = VALID_FROM
fl_bom_create = ' '
fl_new_item = ' '
i_stko = tstko
importing
fl_warning = flg_warning
o_stko = tstk2
tables
t_stpo = tstp3
exceptions
others = 1.
if sy-subrc eq 1.
*---- Error
* Please see log
ERROR_CODE = 'Tanu0131msu0131z hata. Baku0131m ekranu0131 açu0131k olmasu0131n?'.
endif.
if flg_warning eq 'X'.
*---- Please see log for information, warning messages, and success
* messages.
* MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = sy-msgid
msgnr = sy-msgno
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
IMPORTING
message_text_output = ERROR_CODE.
Endif.
09-02-2008 12:58 PM
CI_STPO is a customer include in which you can put some specific fields
probably you call a user-exit that is used to maintain fields of this customer include and it does try to find the structure of it (which does not exist)
09-02-2008 1:59 PM
11-27-2020 9:47 PM
I had the same problem and it was caused by the Valid From field. If you pass a value, you will get an error. Instead, create a Change Number with your desired Valid From and Valid To dates, then pass the Change Number to the function module.