블로그 이미지
모에샹동

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

  • total
  • today
  • yesterday

2009. 8. 3. 13:50 SAP/PP

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.

posted by 모에샹동