cancel
Showing results for 
Search instead for 
Did you mean: 

FM/BAPI for replacing existing BOM components with new components

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Flavio
Active Contributor
0 Kudos

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

Answers (1)

Answers (1)

ameya_beri
Active Contributor
0 Kudos

Hello,

What is the error message that you get ?

Best Regards,

Ameya B.

Former Member
0 Kudos

Hii Ameya,

Thanks for your reply.

I couldn't find any error in importing parameters and unable to sort out the issue with the help of my ABAPer.

Please guide.

Thanks

Kiran Subudhi