SAP Function Modules

CSAP_MAT_BOM_CREATE SAP Function module







CSAP_MAT_BOM_CREATE is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name CSAP_MAT_BOM_CREATE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: CSAP
Released Date: Not Released
Processing type: Remote-Enabled
remote enabled module settings


Pattern for FM CSAP_MAT_BOM_CREATE - CSAP MAT BOM CREATE





CALL FUNCTION 'CSAP_MAT_BOM_CREATE' "
  EXPORTING
    material =                  " csap_mbom-matnr  Material
*   plant =                     " csap_mbom-werks  Plant
    bom_usage =                 " csap_mbom-stlan  BOM usage
*   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_commit_and_wait = SPACE  " capiflag-comm_wait
*   fl_cad = SPACE              " csdata-char1
*   fl_default_values = 'X'     " csdata-xfeld  Default Values for New Items
  IMPORTING
    fl_warning =                " capiflag-flwarning  Log contains warning messages
    bom_no =                    " stko_api02-bom_no
* TABLES
*   t_stpo =                    " stpo_api01    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
*   t_ltx_line =                " csltx_line
*   t_stpu =                    " stpu_api01    BOM sub-items
  EXCEPTIONS
    ERROR = 1                   "               Terminate processing
    .  "  CSAP_MAT_BOM_CREATE

ABAP code example for Function Module CSAP_MAT_BOM_CREATE





The ABAP code below is a full code listing to execute function module CSAP_MAT_BOM_CREATE including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_fl_warning  TYPE CAPIFLAG-FLWARNING ,
ld_bom_no  TYPE STKO_API02-BOM_NO ,
it_t_stpo  TYPE STANDARD TABLE OF STPO_API01,"TABLES PARAM
wa_t_stpo  LIKE LINE OF it_t_stpo ,
it_t_dep_data  TYPE STANDARD TABLE OF CSDEP_DAT,"TABLES PARAM
wa_t_dep_data  LIKE LINE OF it_t_dep_data ,
it_t_dep_descr  TYPE STANDARD TABLE OF CSDEP_DESC,"TABLES PARAM
wa_t_dep_descr  LIKE LINE OF it_t_dep_descr ,
it_t_dep_order  TYPE STANDARD TABLE OF CSDEP_ORD,"TABLES PARAM
wa_t_dep_order  LIKE LINE OF it_t_dep_order ,
it_t_dep_source  TYPE STANDARD TABLE OF CSDEP_SORC,"TABLES PARAM
wa_t_dep_source  LIKE LINE OF it_t_dep_source ,
it_t_dep_doc  TYPE STANDARD TABLE OF CSDEP_DOC,"TABLES PARAM
wa_t_dep_doc  LIKE LINE OF it_t_dep_doc ,
it_t_ltx_line  TYPE STANDARD TABLE OF CSLTX_LINE,"TABLES PARAM
wa_t_ltx_line  LIKE LINE OF it_t_ltx_line ,
it_t_stpu  TYPE STANDARD TABLE OF STPU_API01,"TABLES PARAM
wa_t_stpu  LIKE LINE OF it_t_stpu .


DATA(ld_material) = some text here

DATA(ld_plant) = some text here

DATA(ld_bom_usage) = some text here

DATA(ld_valid_from) = some text here

DATA(ld_change_no) = some text here

DATA(ld_revision_level) = some text here
DATA(ld_i_stko) = 'Check type of data required'.

DATA(ld_fl_no_change_doc) = some text here

DATA(ld_fl_commit_and_wait) = some text here

DATA(ld_fl_cad) = some text here

DATA(ld_fl_default_values) = some text here

"populate fields of struture and append to itab
append wa_t_stpo to it_t_stpo.

"populate fields of struture and append to itab
append wa_t_dep_data to it_t_dep_data.

"populate fields of struture and append to itab
append wa_t_dep_descr to it_t_dep_descr.

"populate fields of struture and append to itab
append wa_t_dep_order to it_t_dep_order.

"populate fields of struture and append to itab
append wa_t_dep_source to it_t_dep_source.

"populate fields of struture and append to itab
append wa_t_dep_doc to it_t_dep_doc.

"populate fields of struture and append to itab
append wa_t_ltx_line to it_t_ltx_line.

"populate fields of struture and append to itab
append wa_t_stpu to it_t_stpu. . CALL FUNCTION 'CSAP_MAT_BOM_CREATE' EXPORTING material = ld_material * plant = ld_plant bom_usage = ld_bom_usage * valid_from = ld_valid_from * change_no = ld_change_no * revision_level = ld_revision_level i_stko = ld_i_stko * fl_no_change_doc = ld_fl_no_change_doc * fl_commit_and_wait = ld_fl_commit_and_wait * fl_cad = ld_fl_cad * fl_default_values = ld_fl_default_values IMPORTING fl_warning = ld_fl_warning bom_no = ld_bom_no * TABLES * t_stpo = it_t_stpo * t_dep_data = it_t_dep_data * t_dep_descr = it_t_dep_descr * t_dep_order = it_t_dep_order * t_dep_source = it_t_dep_source * t_dep_doc = it_t_dep_doc * t_ltx_line = it_t_ltx_line * t_stpu = it_t_stpu EXCEPTIONS ERROR = 1 . " CSAP_MAT_BOM_CREATE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_fl_warning  TYPE CAPIFLAG-FLWARNING ,
ld_material  TYPE CSAP_MBOM-MATNR ,
it_t_stpo  TYPE STANDARD TABLE OF STPO_API01 ,
wa_t_stpo  LIKE LINE OF it_t_stpo,
ld_bom_no  TYPE STKO_API02-BOM_NO ,
ld_plant  TYPE CSAP_MBOM-WERKS ,
it_t_dep_data  TYPE STANDARD TABLE OF CSDEP_DAT ,
wa_t_dep_data  LIKE LINE OF it_t_dep_data,
ld_bom_usage  TYPE CSAP_MBOM-STLAN ,
it_t_dep_descr  TYPE STANDARD TABLE OF CSDEP_DESC ,
wa_t_dep_descr  LIKE LINE OF it_t_dep_descr,
ld_valid_from  TYPE CSAP_MBOM-DATUV ,
it_t_dep_order  TYPE STANDARD TABLE OF CSDEP_ORD ,
wa_t_dep_order  LIKE LINE OF it_t_dep_order,
ld_change_no  TYPE CSAP_MBOM-AENNR ,
it_t_dep_source  TYPE STANDARD TABLE OF CSDEP_SORC ,
wa_t_dep_source  LIKE LINE OF it_t_dep_source,
ld_revision_level  TYPE CSAP_MBOM-REVLV ,
it_t_dep_doc  TYPE STANDARD TABLE OF CSDEP_DOC ,
wa_t_dep_doc  LIKE LINE OF it_t_dep_doc,
ld_i_stko  TYPE STKO_API01 ,
it_t_ltx_line  TYPE STANDARD TABLE OF CSLTX_LINE ,
wa_t_ltx_line  LIKE LINE OF it_t_ltx_line,
ld_fl_no_change_doc  TYPE CAPIFLAG-NO_CHG_DOC ,
it_t_stpu  TYPE STANDARD TABLE OF STPU_API01 ,
wa_t_stpu  LIKE LINE OF it_t_stpu,
ld_fl_commit_and_wait  TYPE CAPIFLAG-COMM_WAIT ,
ld_fl_cad  TYPE CSDATA-CHAR1 ,
ld_fl_default_values  TYPE CSDATA-XFELD .


ld_material = some text here

"populate fields of struture and append to itab
append wa_t_stpo to it_t_stpo.

ld_plant = some text here

"populate fields of struture and append to itab
append wa_t_dep_data to it_t_dep_data.

ld_bom_usage = some text here

"populate fields of struture and append to itab
append wa_t_dep_descr to it_t_dep_descr.

ld_valid_from = some text here

"populate fields of struture and append to itab
append wa_t_dep_order to it_t_dep_order.

ld_change_no = some text here

"populate fields of struture and append to itab
append wa_t_dep_source to it_t_dep_source.

ld_revision_level = some text here

"populate fields of struture and append to itab
append wa_t_dep_doc to it_t_dep_doc.
ld_i_stko = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_ltx_line to it_t_ltx_line.

ld_fl_no_change_doc = some text here

"populate fields of struture and append to itab
append wa_t_stpu to it_t_stpu.

ld_fl_commit_and_wait = some text here

ld_fl_cad = some text here

ld_fl_default_values = some text here

SAP Documentation for FM CSAP_MAT_BOM_CREATE


You can use this function module to create simple material BOMs.

You cannot add alternatives or variants to a BOM, as in transaction
...See here for full SAP fm documentati

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below 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_CREATE or its description.