Skip to Content
author's profile photo Former Member
Former Member

FM/BAPI for replacing existing BOM components with new components

Hello Experts,

I have a requirement for replacing the existing BOM components with new components in uniform period automatically.

I have tried FM CSAP_MAT_BOM_MAINTAIN & CSAP_MAT_ITEM_MAINTAIN and asked my ABAPer to execute the same by using syntax for commit work but still i am unable to find the required result.

Please help me with a possible solution.

Thanks & Regards

Kiran Subudhi

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Dec 09, 2015 at 08:30 PM

    Hi Kiran,

    the documentation provided with CSAP_MAT_BOM_MAINTAIN function module is quoting an example (ABAP code) that is, among other things, also performing a component change in the BOM.

    I have just give it a try, slightly modifying the AM example code to adapt it to my sandbox system peculiarities (materials code, plant, etc) and indeed it's working properly.

    Here is the code I used:

    REPORT zflatest.

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

    DATA: BEGIN OF tstko OCCURS 0.

    INCLUDE STRUCTURE stko_api01.

    DATA: END OF tstko.

    *- 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

    * 3. Item 0010: change component

    CLEAR tstp3.

    tstp3-id_item_no = '0010'. "Item identification

    tstp3-component = '000000000000200149'.

    APPEND tstp3.

    *- Change BOM

    CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'

    EXPORTING

    material = '000000000004001280'

    plant = '4000'

    bom_usage = '1'

    valid_from = '09.12.2015'

    fl_bom_create = ' '

    fl_new_item = ' '

    i_stko = tstko

    IMPORTING

    o_stko = tstk2

    TABLES

    t_stpo = tstp3

    EXCEPTIONS

    OTHERS = 1.

    IF sy-subrc EQ 1.

    *---- Error

    * Please see log

    ENDIF.

    Please go through it with your ABAPer and adjust it to your needs.

    I do hope it will be of some help.

    Thanks and regards,

    Flavio

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2015 at 08:34 AM

    Hello,

    What is the error message that you get ?

    Best Regards,

    Ameya B.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.