0% found this document useful (0 votes)
391 views4 pages

BOM Maintenance and Change Functions

This document provides instructions on using function module CSAP_MAT_BOM_MAINTAIN to create and modify material bills of materials (BOMs). It can be used to change existing BOMs and create new ones. The function module allows processing a single BOM alternative or variant. It also describes required input parameters, tables, and potential error messages.

Uploaded by

DIVAKAR RANE
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
391 views4 pages

BOM Maintenance and Change Functions

This document provides instructions on using function module CSAP_MAT_BOM_MAINTAIN to create and modify material bills of materials (BOMs). It can be used to change existing BOMs and create new ones. The function module allows processing a single BOM alternative or variant. It also describes required input parameters, tables, and potential error messages.

Uploaded by

DIVAKAR RANE
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
  • Function Module Overview
  • Data Structures and Declarations
  • Code Implementation

FU CSAP_MAT_BOM_MAINTAIN

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

MATERIAL

PLANT

BOM_USAGE

ALTERNATIVE

VALID_FROM

CHANGE_NO

REVISION_LEVEL

I_STKO

FL_NO_CHANGE_DOC
FL_COMMIT_AND_WAIT

FL_CAD

FL_BOM_CREATE

FL_NEW_ITEM

FL_COMPLETE

FL_DEFAULT_VALUES

FL_IDENTIFY_BY_GUID

FL_WARNING

O_STKO

T_STPO

T_DEP_DATA

T_DEP_DESCR

T_DEP_ORDER

T_DEP_SOURCE

T_DEP_DOC

T_DOC_LINK

T_DMU_TMX

T_LTX_LINE

T_STPU

Exceptions

ERROR

Function Group

CSAP

Common questions

Powered by AI

Structure STKO_API02 contains BOM header data, crucial for defining the overall attributes of a BOM, such as validity and usage terms. This distinction is vital as the header encompasses the overarching parameters influencing all BOM items and dependencies, ensuring consistency and coherency in BOM processing. Its accurate use is fundamental for ensuring integral and reliable BOM management across related structures .

Exceptions in the CSAP_MAT_BOM_MAINTAIN function module handle errors such as items not being found or other failures in the maintenance process. They are identified by exception codes like "other_error" and should be handled by checking system return codes (e.g., sy-subrc) to determine appropriate corrective actions, as seen in coding practices where logs and flags are used to assess module operation outcomes .

When creating a BOM using the CSAP_MAT_BOM_MAINTAIN function module, items that are marked with a deletion indicator are ignored. This mechanism ensures that only relevant and intended items are created, thus maintaining the accuracy and integrity of the BOM being processed .

The function module CSAP_MAT_BOM_MAINTAIN can only process one alternative or variant at a time, and if no alternative is specified, it defaults to alternative 01. Changes to the BOM header are not supported by this module. Furthermore, items are identified for changes using specific fields, and errors occur if an item cannot be identified uniquely or if conditions such as validity dates are not met. Deleting an item requires setting a deletion indicator after identifying the item correctly .

The CSAP_MAT_BOM_MAINTAIN function module requires parameters such as MATERIAL, PLANT, BOM_USAGE, ALTERNATIVE, VALID_FROM, and others like FL_BOM_CREATE and FL_NEW_ITEM. These parameters determine the scope and context of BOM operations, such as the specific material BOM being processed and whether new BOMs or items are created when not found. Proper configuration of these parameters is crucial for the correct execution of BOM maintenance tasks .

A user might choose CSAP_MAT_BOM_CREATE instead of CSAP_MAT_BOM_MAINTAIN when exclusively aiming to create new BOM entries. The create function is specifically geared towards the initialization of BOMs, offering efficiencies and simplifying the process compared to the more complex CSAP_MAT_BOM_MAINTAIN, which is designed for both creation and changes .

The error message 'Item cannot be changed' indicates impediments in processing, such as the item not being valid on the specified date or being altered previously with a different change number. This situation requires strategizing on alternative dates or change numbers to successfully modify the BOM, emphasizing the importance of temporal considerations and item history in BOM processing .

Data tables such as dep_order and dep_source are part of the object dependencies in BOM management. The integration of these tables involves structuring data within including sequences and sources that affect BOM operations. These tables store hierarchical and relationship data essential for dependencies, ensuring that BOM management considers all related object attributes when processing functions, contributing to comprehensive and accurate BOM configurations .

Items can be identified for changes either via fields such as item category, item number, sort string, and object in structure CSIDENT_02 or via BOM node and BOM item counter. The first method requires unique identification to avoid errors; the second method requires prior reading of the BOM, necessitating the use of related function modules like CSAP_MAT_BOM_OPEN or CSAP_MAT_BOM_CLOSE for item changes .

To change the component quantity, the item must be uniquely identified by setting the item number in structure tstp3. After identifying the item, its component quantity field (comp_qty) is updated with the new value. This approach is documented in specific programming lines for the function use, where the item is cleared, its ID set, and the new quantity appended .

FU CSAP_MAT_BOM_MAINTAIN
Functionality
You can use function module CSAP_MAT_BOM_MAINTAIN to process simple material BOMs.
Thi
data: begin of tstk2.
          include structure stko_api02.
data: end of tstk2.
*---- BOM items table
data: begin of tstp3
tstp3-item_no    = '0030'.
   tstp3-component  = 'MAT200'.
   tstp3-item_categ = 'L'.
   tstp3-comp_qty   = '1'.
   tstp3-
FL_COMMIT_AND_WAIT
FL_CAD
FL_BOM_CREATE
FL_NEW_ITEM
FL_COMPLETE
FL_DEFAULT_VALUES
FL_IDENTIFY_BY_GUID
FL_WARNING
O_STKO
T_STP

You might also like