Modifying a WBS BOM with Csai_bom_maintain

Source: Internet
Author: User

Note Read the BOM data with ' csai_bom_re ad 'before modifying it.

Can realize the BOM line items to do additions and deletions of the operation, and can bring the change number.


ReportZTEST5.

DataWa_csintypeCsin.

DataTab_stpobtypeTable ofStpob.
DataTab_stkobtypeTable ofStkob.
DataTab_dep_datatypeTable ofCsdep_dat.
DataTab_dep_descrtypeTable ofCsdep_desc.
DataTab_dep_ordertypeTable ofCsdep_ord.
DataTab_dep_sourcetypeTable ofCsdep_sorc.
DataTab_dep_doctypeTable ofCsdep_doc.

DataG_warn_stlnrtypeStzub-Stlnr.

DataG_flwarningtypeCapiflag-Flwarning.
CLEARWa_csin.

Wa_csin-Matnr= ' 000000000000001040 '.
Wa_csin-Emeng= 2.
Wa_csin-Datuv= Sy-Datum.
Wa_csin-Pspnr= ' 00065061 '.
Wa_csin-Werks= ' + '.
Wa_csin-Stlan= ' 1 '. "4
Wa_csin-Stlnr= ' 00001548 '.
Wa_csin-Stlty= ' P '.


Data: L_texttypeString.


PagerFUNCTION' Csai_bom_read '
Exporting
Ecsin= Wa_csin
Importing
Fl_warning= G_flwarning
TABLES
T_stpob= Tab_stpob
T_stkob= Tab_stkob
T_dep_data= Tab_dep_data
T_dep_descr= Tab_dep_descr
T_dep_order= Tab_dep_order
T_dep_source= Tab_dep_source
T_dep_doc= Tab_dep_doc
EXCEPTIONS
ERROR= 1
OTHERS= 2
.
IFSy-SUBRC <>0.
MESSAGEIDSy-MSGIDTYPE' I ' NumberSy-Msgno intoL_text
withSy-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
WriteL_text.
Else.



DataWa_stpob likeStpob.
DataWa_stzub likeStzub.

DataWa_stkob likeStkob.


* Wa_csin-aennr = ' 009900159470 '.


ReadTableTab_stkob intoWa_stkobIndex1.
Wa_stkob-Stlst= ' 1 '.
Wa_stkob-Bmeng= 3.
Wa_stkob-Aennr= ' A-4008057012 '.
CLEARWa_stzub.
Wa_stzub-Stlty= ' P '.



Loop atTab_stpob intoWa_stpob.
IFWa_stpob-Idnrk=' 000000000000001090 '.
* wa_stpob-vbkz = ' D '. "Related to delete
* Wa_stpob-aennr = ' A-4008057012 '.
* MODIFY tab_stpob from WA_STPOB.
ElseIFWa_stpob-Idnrk= ' 000000000000001080 '.
Wa_stpob-Menge=  Max.
Wa_stpob-Aennr= ' A-4008057012 '.
ModifyTab_stpob fromWa_stpob.
ENDIF.
CLEARWa_stpob.
Endloop.

The New line item
*clear Wa_stpob.
*wa_stpob-stlty = ' P '.
*wa_stpob-idnrk = ' 000000000000001201 '.
*WA_STPOB-POSTP = ' L '.
*wa_stpob-posnr = ' 0418 '.
*wa_stpob-menge = 6.
*wa_stpob-aennr = ' A-4008057012 '.
*wa_stpob-potx1 = ' Liu '.
*wa_stpob-potx2 = ' Jin '.
*wa_stpob-datuv = sy-datum.
*append Wa_stpob to Tab_stpob.


*clear Wa_stpob.
*wa_stpob-stlty = ' P '.
*wa_stpob-idnrk = ' 000000000000001060 '.
*WA_STPOB-POSTP = ' L '.
*wa_stpob-posnr = ' 0016 '.
*wa_stpob-menge = 3.
*wa_stpob-potx1 = ' liu2 '.
*wa_stpob-potx2 = ' jin3 '.
*wa_stpob-datuv = sy-datum.
*append Wa_stpob to Tab_stpob.
*clear Wa_stpob.

DataTaB2 likeTab_stpob.

Wa_csin-Aennr= ' A-4008057012 '.

PagerFUNCTION' Csai_bom_maintain '
Exporting
* fl_bom_create = "
* Fl_new_item = "
* Fl_complete = "
Ecsin= Wa_csin
Estkob= Wa_stkob
Estzub= Wa_stzub
* 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= ' X '
* Importing
* fl_warning = g_flwarning
* Astkob =
* Astzub =
TABLES
T_stpob=  Tab_stpob
* Et_stpob = tab2
* t_stpub =
* T_ltx_itm =
* T_ltx_bom =
EXCEPTIONS
ERROR= 1
OTHERS= 2
.
IFSy-SubrcNE0. "Here SY-SUBRC is 1
MESSAGEIDSy-MSGIDTYPE' I ' NumberSy-Msgno intoL_text
withSy-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
WriteL_text.

Else.
Write' OK '.

PagerFUNCTION' Bapi_transaction_commit '
Exporting
WAIT= ' X '
* Importing
* RETURN =
.

ENDIF.




ENDIF.

Modifying a WBS BOM with Csai_bom_maintain

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.