2012 Jan 17 7:37 AM
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
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
2012 Jan 17 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.
2012 Jan 19 7: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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |