Ansicht
Dokumentation

/DSCSAG/MAT_BOM_MAINTAIN - RFC enabled wrapper for CSAP_MAT_BOM_MAINTAIN with errorhandling

/DSCSAG/MAT_BOM_MAINTAIN - RFC enabled wrapper for CSAP_MAT_BOM_MAINTAIN with errorhandling

ROGBILLS - Synchronize billing plans   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

You can use function module CSAP_MAT_BOM_MAINTAIN to process simple material BOMs.
This function module is intended mainly as a tool for changing BOMs. However, it can also be used to create BOMs.

If you only want to create BOMs, use function module CSAP_MAT_BOM_CREATE.

To change BOMs, you can also use the following function modules:
CSAP_MAT_BOM_OPEN
CSAP_BOM_ITEM_MAINTAIN
CSAP_MAT_BOM_CLOSE

For more information and examples, see the documentation of the individual function modules.

Restrictions:

  • To date, you can only process one alternative or variant with this function module. This means that, if you do not enter an alternative for function module CSAP_MAT_BOM_MAINTAIN, the system assumes that you want to process alternative 01.
  • To date, changes to the BOM header are not yet supported.

Please note:

  • The item to be changed can be identified in two ways:
  • via the fields item category, item number, sort string, and object (depending on the item category, this can be material, document data, or class data).
    The names of these identifying fields begin with 'ID_' and are contained in structure CSIDENT_02. Structure CSIDENT_02 is part of structure STPO_API03.
    You can use any combination of these fields to identify the item, provided the fields identify the item uniquely. Otherwise you see the error message 'Item cannot be identified uniquely'.

  • via the BOM node and BOM item counter
    These fields are only known to the system if you have read the BOM before. If you identify the item in this way, you should therefore use function modules CSAP_MAT_BOM_OPEN, CSAP_BOM_ITEM_MAINTAIN, or CSAP_MAT_BOM_CLOSE to change the BOM.

  • If the error message 'Item cannot be changed' appears in the log, this can be for the following reasons:
    - The item is not valid on the valid-from date - it becomes valid at a
    later date.
    - The item has already been changed on the same valid-from date
    with a different change number.
  • You cannot change the item category of an item that exists already in the system.
  • To delete an item, you must identify it as described above for the change function and set the deletion indicator.
  • FL_BOM_CREATE (default ' ')
    If you set this indicator to 'X', the system creates a new BOM if it cannot find the BOM you want to change and there is no other error.
    Items can only be created if sufficient data exists to do this.
    The system ignores items with a deletion indicator when creating a BOM.
  • FL_NEW_ITEM (default ' ')
    If you set this indicator to 'X', the system creates a new item if it cannot find the item with the identification entered.
    The system ignores items with a deletion indicator.

Example

*---- 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.

*---- 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-warning.


*- 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.

*- Fill item data
* Exception: items that can be identified uniquely via their item
* number
* 1. Item 0010: change quantity
clear tstp3.
tstp3-id_item_no = '0010'. "Item identification
tstp3-comp_qty = '5.000'.
append tstp3.
* 2. Item 0020: delete
clear tstp3.
tstp3-id_item_no = '0020'. "Item identification.
tstp3-fldelete = 'X'.
append tstp3.
*- 3. New item 0030 (stock material)
* For new items, the ID_ fields, BOM nodes, and BOM item counters are
* initial unless they use
* FLG_NEW_ITEM
clear tstp3.
tstp3-item_no = '0030'.
tstp3-component = 'MAT200'.
tstp3-item_categ = 'L'.
tstp3-comp_qty = '1'.
tstp3-rel_prod = 'X'.
tstp3-sortstring = 'A1'.
append tstp3.
* 3. Item 0040: change component
clear tstp3.
tstp3-id_item_no = '0040'. "Item identification
tstp3-component = 'MAT500'.
append tstp3.

*- Change BOM
call function 'CSAP_MAT_BOM_MAINTAIN'
exporting
material = 'MAT100'
plant = '0001'
bom_usage = '1'
valid_from = '14.10.1996'
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
endif.
if flg_warning eq 'X'.
*---- Please see log for information, warning messages, and success
* messages.
Endif.



Notes

Further information





Parameters

ALTERNATIVE
BOM_RETURNS
BOM_USAGE
CHANGE_NO
FL_BOM_CREATE
FL_CAD
FL_COMMIT_AND_WAIT
FL_COMPLETE
FL_DEFAULT_VALUES
FL_IDENTIFY_BY_GUID
FL_NEW_ITEM
FL_NO_CHANGE_DOC
FL_WARNING
IV_CLIENT_VERSION
I_STKO
MATERIAL
O_STKO
PLANT
RETURN
REVISION_LEVEL
RUNTIME
T_DEP_DATA
T_DEP_DESCR
T_DEP_DOC
T_DEP_ORDER
T_DEP_SOURCE
T_DMU_TMX
T_DOC_LINK
T_STPO
T_STPU
VALID_FROM
VERSION_ID

Exceptions

Function Group

SAG/SAPLMATERIAL

General Material Data   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 7259 Date: 20240426 Time: 043222     sap01-206 ( 80 ms )