SAP Function Modules

Share |

CSAP_MAT_BOM_MAINTAIN SAP Function module - CSAP MAT BOM MAINTAIN

CSAP_MAT_BOM_MAINTAIN is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below are the pattern details for this FM showing its interface including any import, export parameters etc and for your convenience any standard documentation available. All this information and more can be viewed if you enter the function module name CSAP_MAT_BOM_MAINTAIN into the relevant SAP transaction such as SE37 or SE80.

Within the comments section below there is also an opportunity for you to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name CSAP_MAT_BOM_MAINTAIN or its description.

Pattern for FM CSAP_MAT_BOM_MAINTAIN - CSAP MAT BOM MAINTAIN
Associated Function Group: CSAP
Released Date: Not Released
CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN' "
  EXPORTING
    material =                  " csap_mbom-matnr  Material
*   plant =                     " csap_mbom-werks  Plant
    bom_usage =                 " csap_mbom-stlan  BOM usage
*   alternative =               " csap_mbom-stlal  Alternative BOM
*   valid_from =                " csap_mbom-datuv  Valid-from date
*   change_no =                 " csap_mbom-aennr  Change number
*   revision_level =            " csap_mbom-revlv  Revision level
    i_stko =                    " stko_api01    BOM header data
*   fl_no_change_doc = SPACE    " capiflag-no_chg_doc  Do not write change documents
*   fl_bom_create = SPACE       " csdata-xfeld  Create BOM if it does not exist
*   fl_new_item = SPACE         " csdata-xfeld  Create item if it does not exist
  IMPORTING
    fl_warning =                " capiflag-flwarning  Log contains warning messages
    o_stko =                    " stko_api02    BOM header data
* TABLES
*   t_stpo =                    " stpo_api03    BOM items
*   t_dep_data =                " csdep_dat     Object dependencies: basic data
*   t_dep_descr =               " csdep_desc    Object dependencies: description
*   t_dep_order =               " csdep_ord     Object dependencies: sort sequence
*   t_dep_source =              " csdep_sorc    Object dependencies: source code
*   t_dep_doc =                 " csdep_doc     Object dependencies: documentation
  EXCEPTIONS
    ERROR = 1                   "               Terminate processing
    .  "  CSAP_MAT_BOM_MAINTAIN

SAP Documentation for FM 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.
    Documentation extract taken from SAP system, Copyright (c) SAP AG






    Terms of Service     Contact Us     Privacy Policy     Useful SAP related sites