REPORT ZTEST_PP01.
*---- BOM header data structure
data: begin of tstk2.
include structure stko_api02.
data: end of tstk2.
data: begin of tstko.
include structure stko_api01.
data: end of tstko.
*---- BOM items table
data: begin of tstp3 occurs 0.
include structure stpo_api03.
data: end of tstp3.
*---- Object dependencies table
* Basis data
data: begin of tdep2_data occurs 0.
include structure dep_data.
data: end of tdep2_data.
* Description
data: begin of tdep2_descr occurs 0.
include structure dep_descr.
data: end of tdep2_descr.
* Source
data: begin of tdep2_source occurs 0.
include structure dep_source.
data: end of tdep2_source.
* Sequence
data: begin of tdep2_order occurs 0.
include structure dep_order.
data: end of tdep2_order.
* Documentation
data: begin of tdep2_doc occurs 0.
include structure dep_doc.
data: end of tdep2_doc.
data: flg_warning like capiflag-flwarning.
*- 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
* 1. Item 0010: change quantity
clear tstp3.
tstp3-id_item_no = '0010'. "Item identification
tstp3-comp_qty = '222.000'.
append tstp3.
* 2. Item 0020: delete
* clear tstp3.
* tstp3-id_item_no = '0020'. "Item identification.
* tstp3-fldelete = 'X'.
* append tstp3.
**- 3. New item 0030 (stock material)
** For new items, the ID_ fields, BOM nodes, and BOM item counters are
** initial unless they use
** FLG_NEW_ITEM
* clear tstp3.
* tstp3-item_no = '0030'.
* tstp3-component = 'MAT200'.
* tstp3-item_categ = 'L'.
* tstp3-comp_qty = '1'.
* tstp3-rel_prod = 'X'.
* tstp3-sortstring = 'A1'.
* append tstp3.
** 3. Item 0040: change component
* clear tstp3.
* tstp3-id_item_no = '0040'. "Item identification
* tstp3-component = 'MAT500'.
* append tstp3.
*- Change BOM
call function 'CSAP_MAT_BOM_MAINTAIN'
exporting
material = 'DC-M321'
plant = '1000'
bom_usage = '1'
valid_from = '2009.07.01'
fl_bom_create = ' '
fl_new_item = ' '
i_stko = tstko
* importing
* fl_warning = flg_warning
* o_stko = tstk2
tables
t_stpo = tstp3
exceptions
others = 1.
if sy-subrc eq 1.
*---- Error
* Please see log
endif.
if flg_warning eq 'X'.
*---- Please see log for information, warning messages, and success
* messages.
Endif.
'SAP > PP' 카테고리의 다른 글
MFBF – 예비원가 추정일 이전 날짜로 Posting 하고자 한다면 (0) | 2009.09.06 |
---|---|
REM – 제품생성부터 실적처리 테스트를 위한 순서 (0) | 2009.09.02 |
PP 오더의 자재 가용성 점검 규칙 수정 (1) | 2009.07.07 |
MFBF Backflush 유형 정리 (0) | 2009.06.17 |
생산오더 헤더에 Customer Field 추가 하기 (0) | 2009.06.17 |