10-18-2007 3:55 AM
Hello Experts
Here is the requirement. I want to delete BOM component and not the entire BOM.
Is there any FM which can be used to delete component by giving posnr, component number, etc......The BOM maintain with FLDELETE = X is not working for deleting the component. I guess, it is used only for flagging for deletion from a specific date (Valid_FROM) rather than deleting entirely.Any help with example source code is really appreciated.
Thanks
10-18-2007 3:59 AM
10-18-2007 4:33 AM
Dear Ricky,
If you want to delete a single component for only one BOM means,you can delete
directly using T code CS02,enter the material part number(BOM Header) in which
one of it component has to be deleted.
Select the item row which you want to delete and hit on the delet button which will
be in the top & save the datas.
Regards
Mangal
10-18-2007 5:06 AM
Hi Ashish,
Thanks for the reply. For me, itz not working through CSAP_MAT_BOM_MAINTAIN fm. It says No active name tab exists for CI_STPO
CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
EXPORTING
material = lv_matnr
PLANT =
bom_usage = '3'
ALTERNATIVE =
VALID_FROM = '20060910'
change_no = lch_no
REVISION_LEVEL =
i_stko = i_stko
FL_NO_CHANGE_DOC = ' '
FL_COMMIT_AND_WAIT = 'X'
FL_CAD = ' '
fl_bom_create = ''
fl_new_item = ''
fl_complete = ' '
fl_default_values = ' '
FL_IDENTIFY_BY_GUID = ' '
IMPORTING
fl_warning = flg_warning
o_stko = o_stko
TABLES
t_stpo = 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 = 1
OTHERS = 2.
.
Thanks
10-18-2007 5:09 AM
And wondering when we set the deletion indicator, after how long it gets deleted from the database. Why can't we eliminate the BOM component immediately using this function module CSAP_mat_bom_maintain
Thanks
10-18-2007 5:09 AM
Hi ricky,
You can use CSAI_BOM_MAINTAIN function module.
in it you have to pass the stko, csin and stpob structure.
In stpob, for the record to be deleted, pass a 'D' in the column VBKZ.
Hope it helps.
Regards,
Himanshu
10-18-2007 5:11 AM
See this sample working code here -
gt_stpo_api03-id_item_no = '0010'.
gt_stpo_api03-FLDELETE = 'X'.
gt_stpo_api03-component = 'Pass componet'.
APPEND gt_stpo_api03.
CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
EXPORTING
material = tbl_mat_centro-matnr
plant = tbl_mat_centro-werks
bom_usage = stlan
valid_from = datuv
fl_bom_create = ' '
fl_new_item = ' '
FL_COMPLETE = ' '
i_stko = gs_stko_api01
IMPORTING
fl_warning = fl_warning
o_stko = o_stko
TABLES
t_stpo = gt_stpo_api03
EXCEPTIONS
error = 1
OTHERS = 2.
Also use COMMIT after successful call to fm.
Hope this helps.
ashish
10-18-2007 6:25 AM
Thanks. Any examples for CSAI_BOM_MAINTAIN?
The other one Ashish has suggested is not working for me
Is it mandatory to pass stko structure values in both these FMs?
Thanks
10-18-2007 6:32 AM
Hi, The example is as follows:
*Fill CSIN
wgt_csin-aennr = rmmg1-aennr.
wgt_csin-matnr = mara-matnr.
wgt_csin-stlan = '1'.
wgt_csin-stlty = 'M'. "Material BOM
wgt_csin-werks = rc29n-werks.
wgt_csin-stlnr = rc29n-stlnr.
wgt_csin-trtyp = 'B'. "Update
*Fill STKOB
Read data for the existing BOM from table STKO and pass it to wgt_stkob.
Then also pass
wgt_stkob-vbkz = 'U'.
*Fill STPOB.
Read data from table STPO for the current BOM. Pass it to STPOB and pass VBKZ field as 'D'.
Then call the FM.
CALL FUNCTION 'CSAI_BOM_MAINTAIN'
EXPORTING
FL_BOM_CREATE = ' '
FL_NEW_ITEM = ' '
FL_COMPLETE = ' '
ecsin = wgt_csin
estkob = wgt_stkob
estzub = wgt_astzub
FL_NO_CHANGE_DOC = ' '
fl_commit_and_wait = 'X'
fl_no_commit_work = ' '
fl_ale = ' '
FL_DEFAULT_VALUES = 'X'
FL_NEW_ROMEN = 'X'
FL_RECURSIVE = ' '
FL_IMPLICIT_SUBITEM_DELETION =
IMPORTING
fl_warning = gv_fl_warning
ASTKOB =
ASTZUB = wgt_astzub
TABLES
t_stpob = gt_stpob
et_stpob = gt_stpob
T_STPUB =
T_LTX_ITM =
T_LTX_BOM =
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
rollback work.
endif.
Hope it will help u.
Please reward points for useful answer
Regards,
Himanshu.
10-18-2007 7:17 AM
Thanks a bunch Himanshu for the code. It worked without error in a test program for deleting one component of a BOM. But when I went to CS03, surprisingly the component still exists without any changes...What is this FM actually doin?
Is it deleting immediately or marked for deletion later? I am novice in the idea of deletion and archiving of BOM
Thanks
10-18-2007 7:38 AM
10-18-2007 7:41 AM
Hi Ricky,
CS03 has a property to display even the deleted items. Just try going to CS02 and see the BOM. Hope the deleted item is not displayed there.
Regards,
Himanshu
10-18-2007 8:02 AM
No luck! I wanna get a feature through the BOM FM to delete the material immediately as we do through Material BOM->Delete. Is it doable thru FM?
Thanks
10-18-2007 10:12 PM
Hi Ricky,
Checkout this <a href="http://help.sap.com/erp2005_ehp_01/helpdata/en/8d/3e6694462a11d189000000e8323d3a/content.htm">link</a>
Hope this helps
Cheers!
Samanjay
08-02-2019 4:36 PM
Altenatively, my company has a BOM Management solution that utilizes an ALV with a Delete BOM Item icon.