BAPI to change a BOM copmonent

Hi gurus,
    I am using a BAPI named by BAPI_BOM_UPLOAD_SAVE.
With this BAPI i could create a new BOM. But i am not able to change a specific component in the BOM. Is there any indicators to imply the change or is there any BAPI to change the existing BOM component without having the whole structure to be used.
Regards,
Nehru.

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

Similar Messages

  • BAPI to change a BOM

    Hi friends,
             Can anybody let me to know how to change a bom component in a existing BOM with the use of BAPI. Say for example i am having a bom structure for A. I want to change a line item named A1 which is a component without having the whole BOM structure.
    Regards,
    Sankar.

    Hi Sankar,
    Check:
    CS_BOM_EXPL_MAT_V2
    Check these :
    BAPI_MATERIAL_BOM_GROUP_CREATE -- Creation of a material BOM group
    BAPI_MAT_BOM_EXISTENCE_CHECK --Check whether BOM for material exists
    Hope this helps you.
    Regards,
    Chandra Sekhar

  • Change a BOM using BAPI_MATERIAL_BOM_GROUP_CREATE

    Hi All,
    Can I change an existing BOM Group with the BAPI BAPI_MATERIAL_BOM_GROUP_CREATE. or is there any other BAPI to change the BOMs.
    Thanks in advance.
    Regards,
    Anju

    sorry
    i found out the answer

  • Bapi/FM to get bom change info

    hi!
    i need to get one bapi/FM to get bom change info with ECN!
      the function like S_ALR_87012976 (tcode).
    thank you very much!

    thank you !
    i need one function which using ECN number to get all change info about BOM!
    Best Regard!

  • BAPIs to create and change the BOM

    Hi experts,
    Is there any BAPI to Create or to Change the BOM
    Thanks,
    kruthik.

    Hi ,
    For Routing Create 'BAPI_ROUTING_CREATE'.
    For char change BAPI_CHARACT_CHANGE.
    Edited by: Selva M on Feb 24, 2010 11:38 AM

  • While trying to change a BOM with transaction CS02, a runtime error appears

    While trying to change a BOM with transaction CS02, a runtime error appears.
    In intial screen he entered material ,plant BOM usage and date valid from  after executed then id displayed item list in that he wantu2019s delete one item, he has been deleted selected item after that when he was saving he is getting runtime error
    Developer trace
    ABAP Program SAPLKED1_WRITE_CE4_BPS1                 .
    Source LKED1_WRITE_CE4_BPS1U01                  Line 30.
    Error Code SAPSQL_ARRAY_INSERT_DUPREC.
    Module  $Id: //bas/640_REL/src/krn/runt/absapsql.c#17 $ SAP.
    Function HandleRsqlErrors Line 775.
    RABAX: level LEV_RX_STDERR completed.
    RABAX: level LEV_RX_RFC_ERROR entered.
    RABAX: level LEV_RX_RFC_ERROR completed.
    RABAX: level LEV_RX_RFC_CLOSE entered.
    RABAX: level LEV_RX_RFC_CLOSE completed.
    RABAX: level LEV_RX_IMC_ERROR entered.
    RABAX: level LEV_RX_IMC_ERROR completed.
    RABAX: level LEV_RX_DATASET_CLOSE entered.
    RABAX: level LEV_RX_DATASET_CLOSE completed.
    RABAX: level LEV_RX_RESET_SHMLOCKS entered.
    RABAX: level LEV_RX_RESET_SHMLOCKS completed.
    RABAX: level LEV_RX_ERROR_SAVE entered.
    RABAX: level LEV_RX_ERROR_SAVE completed.
    RABAX: level LEV_RX_ERROR_TPDA entered.
    RABAX: level LEV_RX_ERROR_TPDA completed.
    RABAX: level LEV_RX_PXA_RELEASE_RUDI entered.
    RABAX: level LEV_RX_PXA_RELEASE_RUDI completed.
    RABAX: level LEV_RX_LIVE_CACHE_CLEANUP entered.
    RABAX: level LEV_RX_LIVE_CACHE_CLEANUP completed.
    RABAX: level LEV_RX_END entered.
    RABAX: level LEV_RX_END completed.
    RABAX: end RX_RFC
    In sm21
    Perform rollback
    Run-time error "SAPSQL_ARRAY_INSERT_DUPREC" occurred
         Short dump "090618 110101 donalda 11557 " generated
    Runtime Error          SAPSQL_ARRAY_INSERT_DUPREC
    Exception              CX_SY_OPEN_SQL_DB
           Occurred on     18.06.2009 at   11:01:01
    The ABAP/4 Open SQL array insert results in duplicate database records.
    What happened?
    Error in ABAP application program.
    The current ABAP program "SAPLKED1_WRITE_CE4_BPS1" had to be terminated because
    one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    What can you do?
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    Error analysis
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was
    neither
    caught nor passed along using a RAISING clause, in the procedure
    "RKE_WRITE_CE4__BPS1" "(FUNCTION)"
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.
    The reason for the exception is:
    If you use an ABAP/4 Open SQL array insert to insert a record in
    the database and that record already exists with the same key,
    this results in a termination.
    (With an ABAP/4 Open SQL single record insert in the same error
    situation, processing does not terminate, but SY-SUBRC is set to 4.)
    How to correct the error
    The exception must either be prevented, caught within the procedure
    "RKE_WRITE_CE4__BPS1"
    "(FUNCTION)", or declared in the procedure's RAISING clause.
    To prevent the exception, note the following:
    Use an ABAP/4 Open SQL array insert only if you are sure that none of
    the records passed already exists in the database.
    You may able to find an interim solution to the problem
    in the SAP note system. If you have access to the note system yourself,
    use the following search criteria:
    "SAPSQL_ARRAY_INSERT_DUPREC" CX_SY_OPEN_SQL_DBC
    "SAPLKED1_WRITE_CE4_BPS1" or "LKED1_WRITE_CE4_BPS1U01"
    "RKE_WRITE_CE4__BPS1"
    If you cannot solve the problem yourself, please send the
    following documents to SAP:
    1. A hard copy print describing the problem.
       To obtain this, select the "Print" function on the current screen.
    2. A suitable hardcopy prinout of the system log.
       To obtain this, call the system log with Transaction SM21
       and select the "Print" function to print out the relevant
       part.
    3. If the programs are your own programs or modified SAP programs,
       supply the source code.
       To do this, you can either use the "PRINT" command in the editor or
       print the programs using the report RSINCL00.
    4. Details regarding the conditions under which the error occurred
       or which actions and input led to the error.

    Hi ,
    you are getting beacuse u are trying to do mass update to database.
    Please check that below note are applicable to your system.
    Note 453313 - DBIF_RSQL_ERROR_INTERNAL for mass insert
    Note 869534 - AFS MRP doesn't work properly with all BOM item categories
    Thanks Rishi Abrol

  • BAPI for changing delivery date and delivery time fields in LIKP table

    Hi All,
         Is there any BAPI or function module to change the delivery date and delivery time in LIKP table ?
    Please tell me experts if exists.
    Thank you,
    Raghu.

    try these:
    BAPI/FM to update LIKP and VTTK tables
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi-for-changing-sales-headertable-likp-662800

  • Transfer of changed order BOM from quotation to sales order

    Good morning!
    Please consider the following scenario involving variant configuration:
    A quotation is raised in the system, and the values of the characteristics are assigned. Therefore a order BOM is generated (for the quotation), and that order BOM is changed manually using tcode CU51 (for cost estimates purposes). When it is saved, the system updates the BOM in the quotation automatically (ok, this is a desired behavior).
    Although when we create an sales order with reference to that quotation, the newly chnaged order BOM is not copied to this new order, the order BOM is redetermined instead.
    How can I make the system to copy it from the quotation properly?
    Thanks in advance!
    Adriano Cardoso

    Thanks for the reply. I have verified this note and it seems more toward the BOM explosion in the sales documents themselves than for the modifications made afterwards (CU51 changes in BOM, for example).
    After realizing that, I´ve made a little research and found the Order Engineering Workbench possibility, which seems to fulfill all our requirements regarding this point. I looked all over SDN and haven't found too much input about it. In the SAP VC book, says it is not part of the SAP ERP, but a add-on.
    So, you don't happen to have any idea of how can we check if it is activated / installed  in our system or not? We are on version 5.0.
    Thanks!
    Adriano Cardoso

  • Error in bapi while  changing  and add items in transparant table

    data : t_poitems type standard table of bapimepoitem,
           t_poitemx type standard table of bapimepoitemx,
           w_poitems type bapimepoitem,
           w_poitemx type bapimepoitemx,
           t_return type standard table of bapiret2,
           w_return type bapiret2.
    loop at t_modify_detail into w_modify_detail-ebeln.       * populating changing data
    *--&modifying fields
    w_poitems-po_item = w_modify_detail-ebelp.
    w_poitems-material = w_modify_detail-matnr.
            append w_poitems to t_poitems.
    w_poitemx-po_item = w_modify_detail-ebelp.
    w_poitemx-po_itemx = 'X'.
    w_poitems-material = 'X'.
            append w_poitemx to t_poitemx.
    endloop.
          call function 'BAPI_PO_CHANGE'
            exporting
              purchaseorder                =  w_header-ebeln
            POHEADER                     =
            POHEADERX                    =
            POADDRV
           tables
             return                        =     t_return
              poitem                       =    t_poitems
             poitemx                      =     t_poitemx
            POADDRDELIVERY               =      
    call function 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT  
    ERROR IS:
    giving error : cl_po_item_handle_mm.................cp
    function in which error showing: mepo docitem_get

    Check this sample code
    http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm
    BAPI PO CHANGE with MENGE
    Hope it helps to identify your requirement and fix accordingly.
    ashish

  • Can u tell me any predefined BAPI for change and creation of Material

    Hi,
        Can anybody tell me  predefined BAPI for change and creation of Materialmasterand Pricing?
    Thanks & regards,
    Gopianne.

    you can use the BAPI to BAPI_MATERIAL_SAVEDATA create as well as to change material master.
    When changing material master data, you need enter only the material
    number.
    In the header data, you must select at least one view for which data is
    to be created. Depending on the view selected, you must maintain other
    required parameters. If you do not enter values for all of the required
    parameters, the method is ended with an error message.
    The corresponding fields in the tables (such as CLIENTDATA) must first
    be supplied with data by the calling program. An indicator must also be
    set for each of these fields so that the data is written to the database
    by the method. This requires the calling program to supply the
    corresponding field with the indicator in a checkbox table (for example,
    CLIENTDATAX). Checkbox tables exist for tables that do not contain any
    language-dependent texts (MAKT, MLTX), International Article Numbers
    (MEAN), or tax classifications (MLAN). Several data records for a
    material can be created in these tables.
    regards
    vivek
    reward points if it helps

  • Function Module to Change / Update BOM Line Items

    Hi,
    I need a Function Module to Change / Update BOM Line Items.
    Please help.
    Thanks.

    Try this FM - CSAP_MAT_BOM_MAINTAIN

  • BAPI to Create a BOM .

    Hi All,
    my requirement is i wll be getting the BOM data through a file interface and we need to create BOM using the data in the file.
    we are planning to use BAPI to create BOM.
    Can some one plz tell me is there any BAPI available to create BOM by coping from existing BOM.
    can we use BDC if there is no BAPI available.
    thanks
    Chindam.

    thanks for your response but unfortunately did not solve my issue.
    Yes the above 2 FM can be used to create a BOM but i want to know what are the various fields used to create BOM by copying from the existing BOM (Copy as).
    thanks

  • Function Module or BAPI for Change Customer Master in Background

    Hi,
    I would like to ask is there any Function Module or BAPI to change the Customer Master in the Background
    Thanks.

    Hi
    Please check the following link
    [FM|http://help.sap.com/saphelp_nw04/helpdata/EN/8f/53b67ad30be445b0ccc968d69bc6ff/content.htm]
    [FM for BAPI|Is there a BAPI or Function module can create a Customer Master record?]
    Hope this link helps you
    Regards,
    Rajani

  • Change No & BOM

    Hi PP Gurus,
    I am using change numbers for BOM. My requirement is while changing BOM system should ask the reason or some description where I can enter the reason. How this is possible?
    Also User should not change the quantity is subcontracting Purchase order or in production order until it is changed in BOM.
    Please guide me on this issues.
    Mayur
    Edited by: Mayur Phalak on Jan 25, 2009 12:47 PM

    Hi,
    While creating the Engg change number in Tcode : CC01 itself you will be maintaining the description for the change, which in turn is used to modify the BOM / Routing etc if the Change Management is active.
    So if you want to know the description of the Change Number you can view the same in Tcode : CC03.
    As required the BOM changes should not be allowed while creating the Sub-contract Order / Production order can be controlled either using the authorisation or Using User Exit in the transaction code : ME31L /ME32L and CO01 & CO02 where you can write the code in the exit to check the BOM qty with the Item reqd qty in the above transactions.
    Hope this will help you.
    regards
    radhak mk

  • FM or BAPI to change Operation data

    Hi,
    Is there any BAPI to change operation data? BAPI_ALM_ORDER_MAINTAIN is not useful in my case. I want to use   IBAPI_ORDER_OPERATION_CHANGE but not able to get proper documentation for same.Can anyone give me a sample code about how to use IBAPI_ORDER_OPERATION_CHANGE?
    My requirement is to tick check box 'Required Splitting' in operation if some conditions are met. I am planning to do this using cuatomer exit. Everything is working fine only i need to know how to use above BAPI. If this doesn't work then as a last option i will go with BDC.
    Regards,
    Kamal

    Hi Kamal,
    Unfortunately I can not see any BAPI which changes operation data of a production order.
    BAPI_PRODORD_CHANGE is available only for changing header details.
    BAPI_ALM_ORDER_MAINTAIN and IBAPI_ORDER_OPERATION_CHANGE are used for changing maintenance or service orders, and not production orders, most probablty this won't work or cause issues.
    I'm afraid BDC is the only option in this case.
    Regards,
    Marcelo Pacheco

Maybe you are looking for

  • Creation of archiving objects in AFX_WB

    Hi, I am trying to create an archiving object in AFX_WB. I assigned a custom package which I created to the archiving object. The transaction generates the programs for the archiving object by itself with the inputs given. In one of the steps, I am g

  • I Phone Freezes with Mailbox and CD Logo-Help Please

    My Iphone freezes with a Mailbox logo with an arrow pointing to an I-tunes CD logo. It will not allow me to re-set. It does allow me to turn on and off, but this same mailbox logo with an arrow pointing upward to the i-tunes logo is constant. I have

  • Syncing songs to my new ipod

    My ipod touch was not working for I took it to the apple store and ultimately received a new ipod since they did not know what was wrong. Its the same iPod touch I originally had. 8 GB first gen one. Well for some reason when I tried connecting it to

  • Can I make wrapped pictures move relative to text?

    I really like the controls Pages gives about how images are treated in the document text (text wrapped around, text above/below, etc.) But, I run into a problem when I add text above the image, and it moves the text that was related to the embedded i

  • I am unable to delete my email from my outlook account from my ipad.

    I receive a message stating unable to move to trash.  I no longer view it in my inbox, but have to log in to outlook on my computer to delete all my emails.  This is a gross waste of time.  How can I delete these from my ipad?  I have no problem dele