Ansicht
Dokumentation

CSAP_MAT_BOM_CREATE - NOTRANSL: API Stücklisten: Materialstückliste anlegen

CSAP_MAT_BOM_CREATE - NOTRANSL: API Stücklisten: Materialstückliste anlegen

CPI1466 during Backup   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

You can use this function module to create simple material BOMs.
You cannot add alternatives or variants to a BOM, as in transaction CS01.

Current restrictions:

  • You cannot create long texts.
  • You cannot create sub-items.
  • You cannot classify BOM items for batches.

You can only save your BOM if no errors occur, because it is not yet possible to change a BOM. Both header data and all item data must be correct.

Please note:

  • Fields where no entry can be made because they were not selected are initialized. The log does not contain information on initialized fields.
  • The BOM default values defined in the control data and any user-specific defaults are handled in the same way as in the online transaction.
  • Default values that are dependent on BOM usage (for example, indicators for relevancy to production, costing, and so on) are not processed.
  • If you create items with object dependencies, the dependency must have basic data, a description, and source code entered.
    The fields OBJECT_ID and IDENTIFIER identify the object to which a dependency belongs.
    (OBJECT_ID = '2' => BOM item)
    Dependencies are identified by internal or external names. When you create a dependency, you must enter an external name, because an internal name is not assigned until you save.
  • Recursiveness in class items is recognized, but no information is available on which objects in the class caused the recursiveness. You cannot define recursiveness as allowed for these objects.

Example

*---- Feldleiste Stücklistenkopfdaten
data: begin of tstko.
include structure stko_api01.
data: end of tstko.
*---- Tabelle Stücklistenpositionen
data: begin of tstpo occurs 0.
include structure stpo_api01.
data: end of tstpo.

*---- Tabellen für Beziehungswissen:
* Basisdaten
data: begin of tdep_data occurs 0.
include structure csdep_dat.
data: end of tdep_data.
* Beschreibung
data: begin of tdep_descr occurs 0.
include structure csdep_desc.
data: end of tdep_descr.
* Source
data: begin of tdep_source occurs 0.
include structure csdep_sorc.
data: end of tdep_source.
* Reihenfolge
data: begin of tdep_order occurs 0.
include structure csdep_ord.
data: end of tdep_order.
* Dokumentation
data: begin of tdep_doc occurs 0.
include structure csdep_doc.
data: end of tdep_doc.

data: flg_warning like capiflag-flwarning.


*- Datenbankprotokoll eröffnen
call function 'CALO_INIT_API'
exceptions
log_object_not_found = 1
log_sub_object_not_found = 2
other_error = 3
others = 4.


*- Kopfdaten füllen
tstko-base_quan = '1.000'.
tstko-bom_text = 'Stücklistentext'.

*- Positionsdaten füllen
* 1. Position (Lagerteil)
clear tstpo.
tstpo-item_no = '0010'.
tstpo-item_categ = 'L'. "Mußeingabe
tstpo-component = 'MAT200'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
append tstpo.
* 2. Position (Rohmaßposition)
2 Stück a 4 m X 3 m => 2 St a 12 m2
clear tstpo.
tstpo-item_no = '0020'.
tstpo-item_categ = 'R'. "Mußeingabe
tstpo-component = 'MAT300'. "Mußeingabe
tstpo-comp_qty = '2.000'. "Mußeingabe
tstpo-vsi_size1 = '4.000'. "Mußeingabe
tstpo-vsi_size2 = '3.000'.
tstpo-vsi_szunit = 'M'.
tstpo-comp_unit = 'M2'.
append tstpo.
* 3. Position (Textposition)
clear tstpo.
tstpo-item_no = '0030'.
tstpo-item_categ = 'T'. "Mußeingabe
tstpo-item_text1 = 'Positionstext'. "Mußeingabe
append tstpo.
* 4. Position (Dokumentposition)
clear tstpo.
tstpo-item_no = '0040'.
tstpo-item_categ = 'D'. "Mußeingabe
tstpo-document = 'DOK1'. "Mußeingabe
tstpo-doc_type = 'DRW'. "Mußeingabe
tstpo-comp_qty = '1.000'.
tstpo-comp_unit = 'ST'.
* 5. Position (Klassenposition)
clear tstpo.
tstpo-item_no = '0050'.
tstpo-item_categ = 'K'. "Mußeingabe
tstpo-res_itm_ct = 'L'.
tstpo-class = 'CLS1'. "Mußeingabe
tstpo-class_type = '200'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
6. Position (Lagerteil) mit Beziehungswissen
clear tstpo.
tstpo-item_no = '0060'.
tstpo-item_categ = 'L'. "Mußeingabe
tstpo-component = 'MAT200'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
tstpo-identifier = 'P1'. "Mußeingabe beim Anlegen von BezWissen
append tstpo.
* Beziehungswissen zu Position 0060
clear tdep_data.
tdep_data-object_id = '2'.
tdep_data-identifier = 'P1'.
tdep_data-dep_extern = 'B1'.
tdep_data-dep_type = '5'.
tdep_data-status = '1'.
append tdep_data.
clear tdep_source.
tdep_source-object_id = '2'.
tdep_source-identifier = 'P1'.
tdep_source-dep_extern = 'B1'.
tdep_source-line_no = '1'.
tdep_source-line = 'Farbe = ''rot'''.
append tdep_source.
clear tdep_descr.
tdep_descr-object_id = '2'.
tdep_descr-identifier = 'P1'.
tdep_descr-dep_extern = 'B1'.
tdep_descr-language = 'D'.
tdep_descr-descript = 'Beziehung B1 zu Position P1'.
append tdep_descr.
* 7. Position (Lagerteil) mit Beziehungswissen
clear tstpo.
tstpo-item_no = '0070'.
tstpo-item_categ = 'L'. "Mußeingabe
tstpo-component = 'MAT400'. "Mußeingabe
tstpo-comp_qty = '1.000'. "Mußeingabe
tstpo-comp_unit = 'ST'.
tstpo-identifier = 'P2'. "Mußeingabe beim Anlegen von BezWissen
append tstpo.
* Beziehungswissen zu Position 0070
clear tdep_data.
tdep_data-object_id = '2'.
tdep_data-identifier = 'P2'.
tdep_data-dep_extern = 'B2'.
tdep_data-dep_type = '5'.
tdep_data-status = '1'.
append tdep_data.
clear tdep_source.
tdep_source-object_id = '2'.
tdep_source-identifier = 'P2'.
tdep_source-dep_extern = 'B2'.
tdep_source-line_no = '1'.
tdep_source-line = 'Farbe = ''rot'''.
append tdep_source.
clear tdep_descr.
tdep_descr-object_id = '2'.
tdep_descr-identifier = 'P2'.
tdep_descr-dep_extern = 'B2'.
tdep_descr-language = 'D'.
tdep_descr-descript = 'Beziehung B1 zu Position P1'.
append tdep_descr.


*- Materialstückliste anlegen
call function 'CSAP_MAT_BOM_CREATE'
exporting
material = 'MAT100'
plant = '0001'
bom_usage = '1'
valid_from = '01.01.1995'
i_stko = tstko
importing
fl_warning = flg_warning
tables
t_stpo = tstpo
t_dep_data = tdep_data
t_dep_descr = tdep_descr
t_dep_source = tdep_source
t_dep_order = tdep_order
t_dep_doc = tdep_doc
exceptions
error = 1.

if sy-subrc eq 1.
*---- Fehler aufgetreten (Stückliste kann nicht angelegt werden)
* Bitte Protokoll auswerten
endif.
if flg_warning eq 'X'.
*---- Bitte Protokoll auswerten. Dieses enthält Informationen, War-
* nungen und Erfolgsmeldungen
Endif.

Notes

Further information





Parameters

ALTERNATIVE
BOM_NO
BOM_USAGE
CHANGE_NO
FL_CAD
FL_COMMIT_AND_WAIT
FL_DEFAULT_VALUES
FL_NO_CHANGE_DOC
FL_RECURSIVE
FL_WARNING
I_STKO
MATERIAL
PLANT
REVISION_LEVEL
T_DEP_DATA
T_DEP_DESCR
T_DEP_DOC
T_DEP_ORDER
T_DEP_SOURCE
T_FSH_BOMD
T_LTX_LINE
T_SGT_BOMC
T_STPO
T_STPU
VALID_FROM

Exceptions

ERROR

Function Group

CSAP

ROGBILLS - Synchronize billing plans   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 9785 Date: 20240523 Time: 085703     sap01-206 ( 71 ms )