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

Update the BOM

HI ABAP Guru's,

How to Update the BOM Using Below function Modules.

CSAP_MAT_BOM_OPEN CSAP_BOM_ITEM_MAINTAIN CSAP_MAT_BOM_CLOSE.

My Requremnet is For any components contains Issued storage location's .. I need to delete that storage location.

But it is not updating see the below code.

Can you please give me the Proper Reason why it is not get updated .

Afetr Maintain BOM I have tried with COMMIT statemnet also but helpless.

call function 'CONVERSION_EXIT_PDATE_OUTPUT'
      exporting
        input  = sy-datum
      importing
        output = date.

*Enquee Exceptions
    call function 'CALO_INIT_API'
      exceptions
        log_object_not_found     = 1
        log_sub_object_not_found = 2
        others                   = 3.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

*BOM Open
    call function 'CSAP_MAT_BOM_OPEN'
      exporting
        material   = 'matnr'
        plant      = 'werks'
        bom_usage  = '1'
                valid_from = date
      importing
        o_stko     = gt_stko
        fl_warning = fl_warning
      tables
        t_stpo     = gt_stpo
      exceptions
        error      = 1
        others     = 2.
    
    
    loop at gt_stpo.
      gt_stpo-issue_loc = '  '.

*change BOM Contents
      call function 'CSAP_BOM_ITEM_MAINTAIN'
        exporting
          i_stpo     = gt_stpo
        importing
               fl_warning = fl_warning
        exceptions
          error      = 1
          others     = 2.
      if sy-subrc <> 0.
      commit work.
    endloop.

*Close BOM
    call function 'CSAP_MAT_BOM_CLOSE'
      exporting
        fl_commit_and_wait = ' X'
      importing
        fl_warning         = fl_warning
      exceptions
        error              = 1
        others             = 2.

Thanks in advance,

<<Thread unlocked, Urgency normalized>>

Edited by: kishan P on Jan 17, 2012 1:38 PM

Edited by: kishan P on Jan 17, 2012 5:47 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2012 at 12:48 PM

    Can you check the following code.

    call function 'CALO_INIT_API'

    exceptions

    log_object_not_found = 1

    log_sub_object_not_found = 2

    other_error = 3

    others = 4.

    data v_datun type CSAP_MBOM-DATUV.

    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

    EXPORTING

    DATE_INTERNAL = SY-DATUM

    IMPORTING

    DATE_EXTERNAL = v_datun.

    *- Eröffnen der Stückliste für Änderungen

    call function 'CSAP_MAT_BOM_OPEN'

    exporting

    material = 'CG0012'

    plant = '0002'

    bom_usage = '1'

    valid_from = v_datun

    ALTERNATIVE = '03'

    importing

    o_stko = tstk2

    fl_warning = flg_warning

    tables

    t_stpo = tstp2

    exceptions

    error = 1.

    clear: tdep2_data,

    tdep2_source,

    tdep2_descr,

    tdep2_order,

    tdep2_doc.

    refresh: tdep2_data,

    tdep2_source,

    tdep2_descr,

    tdep2_order,

    tdep2_doc.

    data v_date type char10 .

    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

    EXPORTING

    DATE_INTERNAL = SY-DATUM

    IMPORTING

    DATE_EXTERNAL = v_date

    • EXCEPTIONS

    • DATE_INTERNAL_IS_INVALID = 1

    • OTHERS = 2

    .

    loop at tstp2.

    if tstp2-COMPONENT = '61065A'.

    tstp2-FLDELETE = 'X'.

    tstp2-CHANGED_BY = SY-UNAME.

    modify tstp2.

    endif.

    clear tstp2.

    endloop.

    perform item_maintain.

    call function 'CSAP_MAT_BOM_CLOSE'

    importing

    fl_warning = flg_warning

    exceptions

    error = 1.

    *- Unterroutine

    Form item_maintain.

    call function 'CSAP_BOM_ITEM_MAINTAIN'

    exporting

    i_stpo = tstp2

    importing

    fl_warning = flg_warning

    • tables

    • t_dep_data =

    • t_dep_descr =

    • t_dep_order =

    • t_dep_source = tdep2_source

    • t_dep_doc =

    exceptions

    error = 1

    others = 2.

    if sy-subrc = 0.

    endif.

    endform.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2012 at 07:55 AM

    Hi,

    thank you for you reply.

    It is working for deletion of componenet.

    But my reqiremnet waas delete the Default storage location 's .. I hope this is not possible because i have chenged the stpo sturcrure value issu_loc = '' .. but the FM:CSAP_BOM_ITEM_MAINTAIN gaing going back to stpo table and aging it is putting the storage location value.

    So i am directlu updating data base table like below

    update stpo set lgort = ' '

    where stlnr = gt_stko-bom_no and

    idnrk = gt_stpo-component and

    posnr = gt_stpo-item_no.

    Any body tell me is there any another way to achive that.. i know directly updating the data base table is wrong way ..

    thanks,

    kandulaw's

    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.