ts mmv2.0反冲库差异分摊程序_第1页
ts mmv2.0反冲库差异分摊程序_第2页
ts mmv2.0反冲库差异分摊程序_第3页
ts mmv2.0反冲库差异分摊程序_第4页
ts mmv2.0反冲库差异分摊程序_第5页
已阅读5页,还剩81页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

总体信开发名称 TS_MM36_V2.0`反冲库的差异分 FS_MM36_V1.0反冲库差异分摊程序.doc作者: 最后修改日期 开发对象类型 报 接 √增 文档修改历未解决的Issue一、增强简单说1ZNA目前的生产由CATS系统管理,在CATS系统中每一车型的具体成本,而未来ZNA的成本将由SAP系统来管理,这样就存在SAP系统与CATS系统的集成处理。由于未来SAP系统中的BOM是一个月更新一次,而CATS系统中的BOM是动态的,这样就在反冲处理上出现了数量差异,即在SAP系统中必然产生数量上的差异,这主要体现在整车车间。冲压车间和树脂车间未纳入SAP管本程序功能将处理在这些环节所产生的差异是如何进行分摊的23456无71次/月(月末8二、输入页类工pt001w-YPY会计年pYsy-会计期PYsy-测X三、输出页略四、程序中使用的结构用于ALV的输Y3SAPY4Y4Y4Y2Y3调用BAPIY3SAPY4Y4Y4Y2Y3P(6位小数调用BAPI1程序中使用功能模块(FunctionModule)获取数据说1、 计算每月的最后一2、BAPI_GOODSMVT_CREATE进行发货CALLFUNCTION'BAPI_GOODSMVT_CREATE'goodsmvt_header=gw_header =c_codematerial=g_m =gt_item =gt_return.五、程序流程图<总体流程 通过frm_get_rev_stock_end取出期末库存。注:因为物料帐是允许在两个期0的物料,如果期间大于屏幕输入的期间,则取历史库存表MARDH0的物料作为期末库存,放入内表【gt_rev_stock_end】;并从表MSEG261262的当期所 通过frm_get_pcc_order取出所有含有PP订单的PCC【gt_pcc_order】,没有PP订单的PCC订单放入内表【gt_pcc_order_alv】并用ALV的形式输出到屏幕上由用户手工确认是否程序继续执行,如果继续执行,则数量不分摊到屏幕上显示的没有PP订单的PCC订单STEP0030通过frm_get_fentan计算分摊率、出库调整数量、剩余调整数量,未分摊的记录并调用BAPI执行分摊。张PCC订单上的消耗数量和金额放入内表【gt_pcc_order_amt】汇总同一物料的消耗数量并更新内表【gt_rev_stock_end计算分摊率=期末库存/本期消耗并更新内表【gt_rev_stock_end汇总未分摊物料的记录放到ALV的输出表000通过frm_cal_out_qtyFORMfrm_get_rev_stock_end_qty frm_call_bapi_rev_stockBAPI执行出库调整数量,通过frm_modify_bapi_dataBAPI0记录选出执行剩余数量的,通过frm_call_bapi_qty_sy执行剩余 通过frm_def_alv_rev_stock用ALV输出物料明细表, 通过frm_get_fentan_none_alv用ALV输出未分摊物料明细表 通过frm_get_wft_oder计算未分摊物料的分摊率注:该分摊率等于 frm_call_bapi_stock_weiBAPI执行未分摊物料的出库调整frm_call_bapi_qty_sy_wei执行未分摊物料的剩余调 开始 表格1、gt_rev_stock_end反冲库的期末库存表表格2、gt_mseg同一个物料的所有凭证汇总金额

表格3、gt_pcc_orderPCC订单和PP= 否判断反冲库存 放到表格1gt_rev_stock_end

否否

PERFORM是否PERFORMPERFORM出库数量出库数量/开始开始【MARA】中取出基本计量单 消息:没有找到合理数【MKPF】中取出输入的会计期间的所有凭证 【MSEG】中取出这些凭证号对应的移动类型取出凭证汇总金额放入内【gtmseg取出凭证汇总金额放入内【gtmseg只保留PCC订单的数移动类型为262,金额要乘存表【gtrevstockend】个物料的消耗金额并添加到存表【gtrevstockend】个物料的消耗金额并添加到循环表【gt_mseg】汇总同取出所有PCC订单放入【gt_pcc_order循环表【gt_mseg】移动类型【gt_mseg_1和金额给表【gt_pcc_order_amt汇总PCC订单中的物料消耗数和金额给表【gt_pcc_order_amt汇总PCC订单中的物料消耗数 否

分摊的对应的PP品可以有多个PCC订果更新表【gt_pcc_order_amt汇总库存作为未作为未分摊数据存在【gt_fentan_none】计算表【gt_rev_stock_end的剩余调整数调用BAPI执调用BAPI执行分是是是添加一 PI行项六、程序规物料同一物料同一订未分摊物料BAPI定义BAPI2;程序结构从反冲库中MARD中取出单位放入内表gt_rev_stock_end中,MKPF和MSEG中取出同一个物料在gt_mseg中,循环内表嵌套循环内表gt_mseggt_rev_stock_ed,从视图CAUFVPCgtpcc_ordergt_msg判断移动类型,如果是262,1,然后将数据赋值给内表gt_mseg_1循环内表gt_pcc_order嵌套循环内表gt_mseg_1汇总相同PCC和消耗数量并赋值给内表gt_pcc_orer_amt整数量出入库时产生的;出库调整数量的BAPI是否执行成功是通过重新反冲库中库存数量调用BAPI处理未分摊物料剩余调整数量的出入库。生成的物料凭证号和BAPI返回的错误信息是执行剩余调整数量出入库时产生的;出库调整数量是通过重新反冲库中库存数量来更新屏幕上的ALV的期末库存来判断BAPI是否执行成功,如果成功了,那么该物料的期末库0七、虚拟代码(VirtualPROGRAMID/NAME: DATEWRITTEN:2010-9-AUTHOR'S LASTPROGRAM PROJECT 郑州日产VERSION: INCLUDE: CALLS:(RFCAND TABLE: CHANGE REPORTzpvmme036MESSAGE-IDzpvmm01messageclass(381-NOSTANDARDPAGEHEADING"输出报表不使用标准的页标题LINE-SIZE193 LINE-COUNT40. CLASSlcl_event_receiver1DEFINITIONDEFERRED. CLASSlcl_event_receiver1 CLASSlcl_event_receiver1PUBLICFOREVENTdouble_clickOFcl_gui_alv_gridIMPORTINGe_rowe_column.PRIVATE "lcl_event_receiver1DEFINITIONCLASSlcl_event_receiver3DEFINITIONDEFERRED. CLASSlcl_event_receiver3 CLASSlcl_event_receiver3PUBLICFOREVENTdouble_clickOFcl_gui_alv_gridIMPORTINGe_rowe_column.PRIVATEINCLUDE:TYPE-POOLS:*CALLS:(RFC***-- "Goodsmovementfrom INTERNALTABLES 1、tableforDATA:BEGINOFgt_rev_stock_endOCCURS0,matnrLIKEmard- werksLIKEmard- lgortLIKEmard- meinsLIKEmara- lfgjaLIKEmard- lfmonLIKEmard- mtartLIKEmara- LIKEmard- labst_1LIKEmard- dmbtrLIKEmseg- mengeLIKEmseg- perctTYPEpDECIMALS meegeTYPEpDECIMALS mssgeTYPEpDECIMALS ENDOFDATA:gt_stock_mardLIKETABLEOFgt_rev_stock_endWITHHEADERLINE.DATA:gt_stock_mardhLIKETABLEOFgt_rev_stock_endWITHHEADERDATA:gt_rev_stock_end_traLIKETABLEOFgt_rev_stock_endWITHHEADERDATA:gt_rev_stock_end_pcc_detailLIKETABLEOFgt_rev_stock_endWITHHEADERDATA:gt_stockTYPETABLEOFzpv_s_mm36_1,wa_stockTYPEzpv_s_mm36_1.2、tableforBOChangedby*DATA: LIKETABLEOFmkpfWITHHEADER LIKETABLEOFmsegWITHHEADERLINE.DATA:BEGINOFgt_mkpfOCCURS0,mblnrLIKEmkpf-mblnr,mjahrLIKEmkpf-mjahr,ENDOFgt_mkpf.DATA:BEGINOFgt_msegOCCURSmblnrLIKEmseg-mblnr,mjahrLIKEmseg-mjahr,zeileLIKEmseg-zeile,bwartLIKEmseg-bwart,matnrLIKEmseg-matnr,werksLIKEmseg-werks,lgortLIKEmseg-lgort,dmbtrLIKEmseg-dmbtr,mengeLIKEmseg-menge,meinsLIKEmseg-meins,aufnr(12)TYPEc,ENDOFEOChangedbyDATA:gt_mbew LIKETABLEOFmbewWITHHEADERLINE.DATA:BEGINOFgt_mseg_1OCCURS0,werksLIKEmseg-werks,lgortLIKEmseg-lgort,matnrLIKEmseg-matnr,dmbtrLIKEmseg-dmbtr,mengeLIKEmseg-menge,meinsLIKEmseg-meins,aufnr(12)TYPEc,ENDOF3、tableforPCC订单物料消耗明细表DATA:BEGINOFgt_pcc_order_amtOCCURS0,werksLIKEmseg-werks,lgortLIKEmseg-lfgjaLIKEmard- lfmonLIKEmard-pufnr(12)TYPE PPaufnr(12)TYPEc, PCC订单matnrLIKEmseg-matnr,mengeLIKEmseg- meinsLIKEmseg-meins,dmbtrLIKEmseg-perctTYPEpDECIMALS meegeTYPEpDECIMALS ENDOF4、tableforPCC订单对应PP订单DATA:BEGINOFgt_pcc_orderOCCURS0, LIKEcaufv-pkosa, "PCC订单aufnr(12)TYPEc, "PP订单 LIKEcaufv-werks,ENDOFgt_pcc_order.DATA:BEGINOFgt_pcc_order_traOCCURS0, LIKEaufk-werks,aufnr(12)TYPEc,plnbezLIKEafko-plnbez, LIKEmara-mtart, LIKEmbew-bklas,ENDOFgt_pcc_order_tra.DATA:gt_pcc_order_1LIKETABLEOFgt_pcc_orderWITHHEADERLINE,gt_pcc_order_alvLIKETABLEOFgt_pcc_order_traWITHHEADERLINE.5、tableforDATA:BEGINOFgt_fentan_noneOCCURSmatnrLIKEmard- werksLIKEmard- lgortLIKEmard- meinsLIKEmara- lfgjaLIKEmard- lfmonLIKEmard- LIKEmard- labst_1LIKEmard- dmbtrLIKEmseg- mengeLIKEmseg- perctTYPEpDECIMALS aufnr(12)TYPE meegeTYPEpDECIMALS mssgeTYPEpDECIMALS zcboxTYPE "ENDOF*6、tableforPCCDATA:BEGINOFgt_pcc_ft_weiOCCURS0,werksLIKEmseg-werks,lgortLIKEmseg-lgort,lfgjaLIKEmard-lfgja,lfmonLIKEmard-lfmon,aufnr(12)TYPEc,pufnr(12)TYPEc,dmbtrLIKEmseg-dmbtr,perctTYPEpDECIMALS6,ENDOFgt_pcc_ft_wei.7、tableforBAPIDATA:BEGINOFgt_ft_wei_bapiOCCURSwerksLIKEmard- lgortLIKEmard- lfgjaLIKEmard- lfmonLIKEmard- pufnr(12)TYPE PPaufnr(12)TYPEc, PCC订单matnrLIKEmseg-matnr, LIKEmard- labst_1LIKEmard- meinsLIKEmseg-meins,dmbtrLIKEmseg-perctTYPEpDECIMALS meegeTYPEpDECIMALS mssgeTYPEpDECIMALS ENDOF*DATA:gt_ft_wei_bapi_traLIKETABLEOFgt_ft_wei_bapiWITHHEADERLINE.DATA:gt_fentan_weiTYPETABLEOFzpv_s_mm36_2,wa_fentan_weiTYPEzpv_s_mm36_2,gt_fentan_wei_syTYPETABLEOFzpv_s_mm36_2,wa_fentan_wei_syTYPEzpv_s_mm36_2,gt_fentan_wei_sy_traTYPETABLEOFzpv_s_mm36_2WITHHEADERLINE,gt_fentan_wei_sy_alvTYPETABLEOFzpv_s_mm36_2WITHHEADERDATA:gt_fentan_wei_bakTYPETABLEOFzpv_s_mm36_2WITHHEADERtableforDATA:gt_t001wLIKETABLEOFt001wWITHHEADERLINE,gt_mardLIKETABLEOFmardWITHHEADERtableforpcccostDATA:BEGINOFgt_pcc_cost_detailOCCURS0,aufnr(12)TYPEc,pufnr(12)TYPEc,dmbtrLIKEmseg-dmbtr,perctTYPEpDECIMALS6,ENDOFgt_pcc_cost_detail.DATA:BEGINOFgt_pcc_detailOCCURS0,werksLIKEmseg-werks,lgortLIKEmseg-aufnr(12)TYPE PCCpufnr(12)TYPE PPmatnrLIKEmseg- dmbtrLIKEmseg- mengeLIKEmseg- perctTYPEpDECIMALS meinsLIKEmseg-meins,ENDOFgt_pcc_detail.DATA:BEGINOFgt_pp_detailOCCURS0,werksLIKEmseg-werks,lgortLIKEmseg-aufnr(12)TYPE PCCmatnrLIKEmseg- pufnr(12)TYPE PPmeegeLIKEmseg- mssgeLIKEmseg-menge, shengyu数量meinsLIKEmseg-meins,ENDOFDATA:gt_pp_detail_iniLIKETABLEOFgt_pp_detailWITHHEADERLINE.DATA:gt_pp_detail_pcc_syLIKETABLEOFgt_pp_detailWITHHEADERLINE.DATA:gt_pp_detail_oth_syLIKETABLEOFgt_pp_detailWITHHEADERForselectall/cancelallcheckedDATA:g_sel_all_(1)TYPEc,g_button_text(10)TYPEg_button_ TYPEc,"''表示已经按下BUTTON1,需要显示凭g_titleTYPE CALLS:(RFCAND BAPItocreatetheACCDATA:gw_headerLIKEbapi2017_gm_head_01 LIKETABLEOFbapi2017_gm_item_createWITHHEADERgt_returnLIKETABLEOFbapiret2WITHHEADERLINE,g_mLIKEbapi2017_gm_head_ret-mat_doc.DATA:c_codeLIKEbapi2017_gm_codeVALUE'03'. "BAPI-GOODSMVT_CODEDATA:g_title_text(40)TYPEc.*功能说明:GRIDALV定 DATA:gt_grid_fieldcatTYPEslis_t_fieldcat_alvWITHHEADERLINE, TYPEslis_t_eventWITHHEADERLINE,gt_grid_top_of_pageTYPEslis_t_listheader, TYPEslis_t_sortinfo_alvWITHHEADERLINE, TYPEslis_layout_alv.*功能说明:MethodALV定 DATA:ok_codeLIKE g_cont_1TYPEscrfnameVALUE'BCALV_CONT1',grid1TYPEREFTOcl_gui_alv_grid,g_cust_cont_1TYPEREFTODATA:g_cont_2TYPEscrfnameVALUE'BCALV_CONT2',grid2TYPEREFTOcl_gui_alv_grid,g_cust_cont_2TYPEREFTODATA:g_cont_3TYPEscrfnameVALUE'BCALV_CONT3',grid3TYPEREFTOcl_gui_alv_grid,g_cust_cont_3TYPEREFTO 2_1TYPETABLEOFzpv_s_mm36_2WITHHEADERLINE,2_1_traLIKETABLEOF 2_1WITHHEADERLINE.DATA:gt_toolbar_exclud_2TYPEui_functions,gs_toolbar_exclud_2TYPEui_func.DATA:gt_ft_weiTYPETABLEOFzpv_s_mm36_2WITHHEADERLINE,gt_ft_cbxTYPETABLEOFzpv_s_mm36_2WITHHEADERLINE,gt_ft_wei_1TYPETABLEOFzpv_s_mm36_2WITHHEADERLINE,gt_ft_wei_syTYPETABLEOFzpv_s_mm36_2WITHHEADERLINE,gt_ft_wei_sy_traTYPETABLEOFzpv_s_mm36_2WITHHEADERLINE.DATAgt_fieldcat_1TYPElvc_t_fcatDATAwa_fieldcat_1LIKELINEOFgt_fieldcat_1.DATAgt_fieldcat_2TYPElvc_t_fcat.DATAwa_fieldcat_2LIKELINEOFgt_fieldcat_2.DATAgt_fieldcat_3TYPElvc_t_fcat.DATAwa_fieldcat_3LIKELINEOFDATA:gt_events TYPEslis_t_eventWITHHEADERLINE, TYPEslis_layout_alv.DATA:allfieldsTYPEDATA:gt_allfieldsTYPEDATA:wa_allfieldsTYPELINEOFslis_t_fieldcat_alv.DATA:myrepidLIKEsy-repid.DATA:gw_layout_1TYPElvc_s_layo,gw_layout_2TYPElvc_s_layo,gw_layout_3TYPEDATA:gt_t006LIKETABLEOFt006WITHHEADERBODATA:gt_t006_custLIKETABLEOFzpv_t_t006WITHHEADEREODATAgt_usnameLIKEzpv_t_usnamOCCURS0WITHHEADERLINE.DEFINEl_fieldcat.wa_fieldcat_1-fieldname=&1.wa_fieldcat_1-coltext=&2.wa_fieldcat_1-checkbox=&3.wa_fieldcat_1-edit=wa_fieldcat_1-no_zero=wa_fieldcat_1-just= =&7. =&8. =&9.appendwa_fieldcat_1togt_fieldcat_1.clearwa_fieldcat_1.END-OF-DEFINEwa_fieldcat_2-fieldname=&1.wa_fieldcat_2-coltext=&2.wa_fieldcat_2-checkbox=&3.wa_fieldcat_2-edit=wa_fieldcat_2-no_zero=wa_fieldcat_2-just= =&7. =&8.appendwa_fieldcat_2togt_fieldcat_2.clearwa_fieldcat_2.END-OF-DEFINEwa_fieldcat_3-fieldname=&1.wa_fieldcat_3-coltext=&2.wa_fieldcat_3-checkbox=&3.wa_fieldcat_3-edit=wa_fieldcat_3-no_zero=wa_fieldcat_3-just=wa_fieldcat_3-no_out= =&8. =&9.appendwa_fieldcat_3togt_fieldcat_3.clearwa_fieldcat_3.END-OF-DEFINEmacro_disable_function.gs_toolbar_exclud_2=&1.readtablegt_toolbar_exclud_2transportingnofieldswithtablekeytable_line=gs_toolbar_exclud_2.if(sy-subrcne0appendgs_toolbar_exclud_2togt_toolbar_exclud_2.END-OF-LOCALCLASSES:CLASSlcl_event_receiver1IMPLEMENTATION.METHODhandle_double_click1.DATA:ls_stockTYPEREADTABLEgt_stockINTOls_stockINDEXe_row-IFe_column-fieldname=SUBMITrmmmbestWITHms_matnr-low=ls_stock-WITHms_werks-low=ls_stock-WITHms_lgort-low=ls_stock-ANDIFe_column-fieldname='MELNR'ANDls_stock-melnrNESETPARAMETERID'MBN'FIELDls_stock-melnr.CALLTRANSACTION'MB03'ANDSKIPFIRSTSCREEN.IFe_column-fieldname='MBLNR'ANDls_stock-mblnrNESETPARAMETERID'MBN'FIELDls_stock-mblnr.CALLTRANSACTION'MB03'ANDSKIPFIRSTSCREEN. "lcl_event_receiver1 CLASSlcl_event_receiver3 CLASSlcl_event_receiver3METHODDATA:ls_gt_fentan_wei_syTYPEREADTABLEgt_fentan_wei_syINTOls_gt_fentan_wei_syINDEXe_row-IFe_column-fieldname=SUBMITrmmmbestWITHms_matnr-low=ls_gt_fentan_wei_sy-WITHms_werks-low=ls_gt_fentan_wei_sy-WITHms_lgort-low=ls_gt_fentan_wei_sy-ANDIFe_column-fieldname='MELNR'ANDls_gt_fentan_wei_sy-melnrNESETPARAMETERID'MBN'FIELDls_gt_fentan_wei_sy-melnr.CALLTRANSACTION'MB03'ANDSKIPFIRSTSCREEN.IFe_column-fieldname='MBLNR'ANDls_gt_fentan_wei_sy-mblnrNESETPARAMETERID'MBN'FIELDls_gt_fentan_wei_sy-mblnr.CALLTRANSACTION'MB03'ANDSKIPFIRSTSCREEN. "lcl_event_receiverIMPLEMENTATIONDATA:event_receiver1TYPEREFTOlcl_event_receiver1.DATA:event_receiver3TYPEREFTOGLOBALVARIANT DATA:g_date_firstLIKEsy-datum,g_date_lastLIKEsy-DATA:g_dmbtrLIKEmseg-dmbtr, LIKEsy-tabix.DATA:g_mmTYPEcVALUE'1',c_bapi(3)TYPEcVALUE'499',g_numLIKEsy-tabix,g_ty(13)TYPEn,g_flagTYPEc,g_cprog(4)TYPEcVALUE*DATA:G_year_last_mon(4)TYPE TYPERANGESgr_lgortFORmard-lgort.DEFINEmar_g_lgort. =&1.gr_lgort-option=&2. =&3. =&4.appendgr_lgort.cleargr_lgort.END-OF-SELECTION- SELECTION-SCREENBEGINOFBLOCKb01WITHFRAMETITLEtext-001.SELECTION-SCREENSKIP.*PARAMETERS:p_werksLIKEt001w-werksDEFAULT'8929'."p_lgortLIKEmard-lgortDEFAULT'1020'.SELECT-OPTIONS:s_werksFORt001w-werksDEFAULT'8929'NOINTERVALSOBLIGATORY.SELECT-OPTIONS:s_lgortFORmard- DEFAULT'1020'NOINTERVALSPARAMETERS:p_lfgjaLIKEmard-lfgjaOBLIGATORY,p_lfmonLIKEmard-lfmonSELECT-OPTIONS:s_bklasFORmbew-bklasNOINTERVALS.PARAMETERS:p_t_ftl(3)TYPEnDEFAULT'100'.SELECTION-SCREENSELECT-OPTIONS:s_matnrFORmara-matnr.SELECTION-SCREENSKIP.SELECTION-SCREENBEGINOFBLOCKb02WITHFRAMETITLEtext-002.SELECTION-SCREENSKIP.PARAMETERS:p_dmbtrLIKEmseg-dmbtr.PARAMETERS:p_labstLIKEmard-labst.SELECTION-SCREENENDOFBLOCKb02.SELECTION-SCREENPARAMETERS:p_cb_tASCHECKBOXDEFAULT'X'.SELECTION-SCREENENDOFBLOCKb01.PERFORMfrm_init_inttab.IFsy-datum+4(2)=p_lfmon=p_lfgja=sy-datum(4)-p_lfmon=sy-datum+4(2)-1.p_lfgja=sy-datum(4).PERFORMATSELECTION-SCREEN.PERFORMscreen_check.PERFORMauthority_check.Maing_button_=PERFORM PERFORM PERFORM PCC返回值为1,CHECKg_flagEQ**<BAPIPERFORMfrm_get_fentan.**<PERFORMfrm_get_fentan_none_alv. "未分摊物料明细表PERFORMfrm_get_fentan_wei_alv. "未分摊物料剩余调整表PERFORM "未分摊物料分摊率计算IFsy-batchIS CALLSCREENPERFORM "执行,直接显示结END-OF-PERFORM Form --> <-- FORMscreen_checkDATA:l_year(4) TYPEn,l_year_last_mon(4)TYPEn, TYPEl_mon_pre(2)TYPEn,l_bukrsLIKEt001k-bukrs.IFs_werksISINITIALMESSAGEe311(zpvmm01)WITHELSE.ENDIFIFs_lgortISINITIALMESSAGEe311(zpvmm01)DISYLIKE'E'WITH'请输入库存地!'ELSE.ENDIFIFsy-datum+4(2)='01'.l_mon_pre='12'.l_year_last_mon=sy-datum(4)-l_mon_pre=sy-datum+4(2)-1.l_year_last_mon=sy-datum(4)SELECTSINGLEbukrsINTOl_bukrsFROMt001kWHEREbwkeyINs_werks.IFsy-subrcEQ0.SELECTSINGLElfgjalfmonINTO(l_year,l_mon)FROMWHEREbukrsEQIFsy-subrcEQIFl_yearEQp_lfgjaANDl_monEQELSEIFp_lfgjaEQl_year_last_monANDp_lfmonEQMESSAGEMESSAGEe285WITHIFp_t_ftlGT100ORp_t_ftlLEMESSAGEe000WITHtext- " Form --> <-- FORMfrm_get_rev_stock_end**<MARD**再从MARDH中取出数量为0**<MARADATA:l_tabixLIKEsy-tabix.DATA:l_labstLIKEmard-labst.DATA:l_lfgjaLIKEmard-lfgja.DATA:l_labst_revLIKEmard-l_dmbtr_revLIKEmseg-DATA:lt_mardhLIKETABLEOFmardhWITHHEADERDATA:BEGINOFlt_exp_matOCCURS0,matnrLIKEmara-matnr,ENDOFDATA:l_mengeLIKEmard-labst.DATA:l_lgortLIKEmard-RANGESlr_lgortFORmard-DEFINEmar_lgort. =&1.lr_lgort-option=&2. =&3. =&4.appendlr_lgort.clearlr_lgort.END-OF-mar_lgort'I''EQ''1020'*取消以下反冲地点***mar_lgort'I''EQ''5210'***mar_lgort'I''EQ''5310'***mar_lgort'I''EQ''1092'***mar_lgort'I''EQ''5220'***mar_lgort'I''EQ''5320'LOOPATSELECTSINGLElgortINTOl_lgortFROMt001lWHEREwerksINANDlgortEQs_lgort-lowANDlgortINlr_lgort.IFsy-subrcISINITIAL.mar_g_lgort'I''EQ'l_lgort''.IFgr_lgort[]ISMESSAGEe000(zpvmm01)DISYLIKE'E'WITHtext-801.SORT**<IFs_matnrISINITIAL.SELECTa~werksa~lgorta~matnra~lfgjaa~lfmona~labstb~meinsb~mtartINTOCORRESPONDINGFIELDSOFTABLEgt_rev_stock_endFROMmardASaINNERJOINmaraASbONa~matnrEQb~matnrWHEREa~werksINs_werksANDa~lgortINgr_lgortANDa~lfgjaLESELECTa~werksa~lgorta~matnra~lfgjaa~lfmona~labstb~meinsb~mtartINTOCORRESPONDINGFIELDSOFTABLEgt_rev_stock_endFROMmardASaINNERJOINmaraASbONa~matnrEQb~matnrWHEREa~werksINs_werksANDa~lgortINgr_lgortANDa~lfgjaLEp_lfgjaANDa~matnrNOTINCHECKgt_rev_stock_end[]ISNOTINITIAL.IFgt_rev_stock_end[]ISNOTINITIAL.SORTgt_rev_stock_endBYmatnr.LOOPATgt_rev_stock_end.MOVE:p_lfmonTOgt_rev_stock_end-MODIFYl_tabix=sy-IF(gt_rev_stock_end-lfgjaEQp_lfgjaANDgt_rev_stock_end-lfmonLEp_lfmon)ORgt_rev_stock_end-lfgjaLTp_lfgja.IFgt_rev_stock_end-labst<>0.MODIFYCLEARELSEIFgt_rev_stock_end-lfgjaEQp_lfgjaANDgt_rev_stock_end-lfmonGTSELECTMAX(lfgja)INTOl_lfgjaFROMWHEREmatnrEQgt_rev_stock_end-matnrANDwerksEQgt_rev_stock_end-werksANDlgortEQgt_rev_stock_end-IFsy-subrcISSELECT*INTOTABLElt_mardhFROMWHEREmatnrEQgt_rev_stock_end-matnrANDwerksEQgt_rev_stock_end-werksANDlgortEQgt_rev_stock_end-lgortANDlfgjaEQl_lfgja.IFsy-subrcEQSORTlt_mardhBYlfmonREADTABLElt_mardhWITHKEYmatnr=gt_rev_stock_end-werks=gt_rev_stock_end-werkslgort=gt_rev_stock_end-IFsy-subrcEQMOVEp_lfmonTOgt_rev_stock_end-MOVElt_mardh-labstTOgt_rev_stock_end-labst.MODIFYgt_rev_stock_endINDEXl_tabix.DELETEDELETEDELETEDELETEgt_rev_stock_endWHERElabst=0.IFp_labstISNOTINITIAL.l_labst_rev=-1*DELETEgt_rev_stock_endWHERElabstLTANDlabstGTSORTgt_rev_stock_endBYmatnr.IFgt_rev_stock_end[]ISINITIAL.MESSAGEs481DISYLIKE'E'.**<CONCATENATEp_lfgjap_lfmon'01'INTOg_date_first.CALLFUNCTION'LAST_DAY_OF_MONTHS' =g_date_firstlast_day_of_month=**<MKPF和MSEGBOChangedbyterry.wang BOChangedby SELECTSELECTmblnr EOChangedbyINTOTABLEgt_mkpfFROMWHEREbudatBETWEENg_date_firstAND BOChangedbyterry.wangDATA:BEGINOFlt_mkpfOCCURS0,mblnrLIKEmkpf-mblnr,mjahrLIKEmkpf-mjahr,usnamLIKEmkpf-ENDOFSELECTmblnrmjahrINTOTABLElt_mkpfFROMmkpfWHEREmjahrEQp_lfgjaANDbudatBETWEENg_date_firstANDg_date_lastANDtcode2='MFBF'.SORTlt_mkpfBYLOOPATlt_mkpfWHEREusnamBETWEEN'D36230010000'AND gt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARLOOPATlt_mkpfWHEREusnamBETWEEN'D36240010000'AND gt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARLOOPATlt_mkpfWHEREusnamBETWEEN'D36250010000'AND gt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARLOOPATlt_mkpfWHEREusnamBETWEEN'D36260010000'AND gt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARLOOPATlt_mkpfWHEREusnamBETWEEN'D36270010000'AND gt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARLOOPATlt_mkpfWHEREusnamBETWEEN'D40000000000'ANDgt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARLOOPATlt_mkpfWHEREusnamEQgt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARLOOPATlt_mkpfWHEREusnamEQgt_mkpf-mblnr=lt_mkpf-gt_mkpf-mjahr=lt_mkpf-APPENDgt_mkpf.CLEARIFgt_usname[]ISNOTINITIAL.LOOPATgt_usname.LOOPATlt_mkpfWHEREusnamBETWEENgt_usname-usnalANDgt_usname-usnah.gt_mkpf-mblnr=lt_mkpf-mblnr.gt_mkpf-mjahr=lt_mkpf-mjahr.APPENDgt_mkpf.CLEARgt_mkpf.LOOPATgt_mkpf-mblnr=lt_mkpf-mblnr.gt_mkpf-mjahr=lt_mkpf-mjahr.APPENDgt_mkpf.CLEARgt_mkpf.SORTDELETEADJACENTDUPLICATESFROMEOChangedbyterry.wangSELECTSELECTmblnrmjahrzeilebwartmatnrwerkslgortdmbtrmengemeinsEOChangedbyINTOTABLEgt_msegFROMmsegFORALLENTRIESINgt_mkpfWHEREmblnrEQgt_mkpf-ANDmjahrEQgt_mkpf-BOChangedbyterry.wangAND(zeileBETWEEN'0001'ANDEOChangedbyterry.wangANDwerksINs_werksANDlgortINgr_lgort*将261/262改为 and(bwarteq'261' bwarteq'262'AND(bwartEQ'Z61'bwartEQ'Z62' DELETEgt_msegWHEREaufnr(3)<>**<SELECT*INTOTABLEgt_mbewFROMmbewFORALLENTRIESINgt_rev_stock_endWHEREmatnrEQgt_rev_stock_end-matnrANDbwkeyEQgt_rev_stock_end-**<LOOPATgt_rev_stock_end.tabix=sy-gt_rev_stock_end-labst_1=gt_rev_stock_end-labst.gt_rev_stock_end-labst=gt_rev_stock_end-labst*p_t_ftl/100READTABLEgt_t006WITHKEYmsehi=gt_rev_stock_end-meins.IFsy-subrcISINITIAL.l_menge=FRAC(gt_rev_stock_end-labst)*100.gt_rev_stock_end-labst=TRUNC(gt_rev_stock_end-labst)+(TRUNC(l_menge)/100)(TRUNC(FRAC(l_menge*2))/100gt_rev_stock_end-labst=TRUNC(gt_rev_stock_end-labstMODIFYgt_rev_stock_endTRANSPORTINGlabstREADTABLEgt_mbewWITHKEYmatnr=gt_rev_stock_end-bwkey=gt_rev_stock_end-IFsy-subrcEQIFgt_mbew-vprsvEQgt_rev_stock_end-dmbtr=gt_rev_stock_end-labst*gt_mbew-gt_rev_stock_end-dmbtr=gt_rev_stock_end-labst*gt_mbew-MODIFYgt_rev_stock_endINDEXtabix.CLEARgt_rev_stock_end.DELETEgt_rev_stock_endWHERElabst=0.IFp_dmbtrISNOTINITIAL.l_dmbtr_rev=-1*DELETEgt_rev_stock_endWHEREdmbtrLTANDdmbtrGT " Form --> <-- FORMfrm_get_pcc_orderDATA:lt_maraLIKETABLEOFmaraWITHHEADERDATA:lt_mbewLIKETABLEOFmbewWITHHEADER**<PCCSELECTb~werksa~aufnrINTOCORRESPONDINGFIELDSOFTABLEgt_pcc_order_traFROMafkoASaINNERJOINaufkASbONa~aufnrEQWHEREb~auartEQ ANDa~plnbezNEANDb~werksIN**<IFgt_pcc_order_tra[]ISNOTDELETEADJACENTDUPLICATESFROMSELECT*INTOTABLElt_mbewFROMmbewFORALLENTRIESINgt_pcc_order_traWHEREmatnrEQgt_pcc_order_tra-plnbezANDbwkeyINs_werksANDbklasINLOOPATgt_pcc_order_tra.tabix=sy-tabix.READTABLElt_mbewWITHKEYmatnr=gt_pcc_order_tra-plnbez.IFsy-subrcEQ0.MOVElt_mbew-bklasTOgt_pcc_order_tra-bklas.MODIFYgt_pcc_order_tra.CLEARDELETEgt_pcc_order_traINDEXtabix.**<从视图CAUFV中取出没有被删除的PCC订单对应的PP订单>SELECT*INTOCORRESPONDINGFIELDSOFTABLEgt_pcc_order_1FROMcaufvWHEREpkosaNEANDloekzNE "无删除标志的PPANDwerksIN "Ls**<PCC订单只对应一个PP订单,且PPSORTgt_pcc_order_1BYpkosaaufnrwerks.LOOPATgt_pcc_order_1.tabix=sy-tabix.ATNEWREADTABLEgt_pcc_order_1INDEXMOVE-CORRESPONDINGgt_pcc_order_1TOgt_pcc_order.APPENDgt_pcc_order.CLEARDELETEADJACENTDUPLICATESFROMLOOPATREADTABLEgt_pcc_orderWITHKEYpkosa=gt_pcc_order_tra-aufnr.IFsy-subrcEQ0.MOVE-CORRESPONDINGgt_pcc_order_traTOgt_pcc_order_alv.APPENDgt_pcc_order_alv.CLEARIFgt_pcc_order_alv[]ISNOT PP订单的PCCSELECT*INTOTABLElt_maraFROMFORALLENTRIESINgt_pcc_order_alvWHEREmatnrEQgt_pcc_order_alv-plnbez.LOOPATgt_pcc_order_alv.tabix=sy-tabix.READTABLElt_maraWITHKEYmatnr=gt_pcc_order_alv-plnbez.IFsy-subrcEQ0.MOVElt_mara-mtartTOgt_pcc_order_alv-mtart.MODIFYgt_pcc_order_alvINDEXtabix.CLEARSORTgt_pcc_order_alvBYaufnr.PERFORMfrm_order_out.g_flag=1. 1有两种情况:一是表示都含有PP订单,二是用户手工确认的 " Form --> <-- FORMfrm_get_fentan**<LOOPATIFgt_mseg-bwart=IFgt_mseg-bwart='Z62'."Tommygt_mseg-dmbtr=gt_mseg-dmbtr*(-1).gt_mseg-menge=gt_mseg-menge*(-1MOVE-CORRESPONDINGgt_msegTOMOVE-CORRESPONDINGgt_mseg_1TOCOLLECTCOLLECTCLEARSORTgt_pcc_orderBY "LS05/08/16*<PCCLOOPATgt_pcc_order.LOOPATgt_mseg_1WHEREwerks=gt_pcc_order- aufnr=gt_pcc_order-pkosa.MOVE-CORRESPONDINGgt_mseg_1TOMOVE TOgt_pcc_order_amt-MOVEp_lfmon TOgt_pcc_order_amt-lfmon.MOVEgt_pcc_order-aufnrTOgt_pcc_order_amt-pufnr.COLLECTgt_pcc_order_amt.CLEARIFgt_pcc_order_amt[]ISMESSAGEs311(zpvmm01)DISYLIKE'E'WITHtext-304.**<汇总同一个物料的消耗数量> nt/lgort/materialLOOPATgt_rev_stock_end.CLEAR:gt_rev_stock_end-labst,gt_rev_stock_end-

LOOPATgt_pcc_order_amtWHEREmatnr=gt_rev_stock_end- werks=gt_rev_stock_end- "LsIFsy-subrcEQ

lgort=gt_rev_stock_end- "LsADDgt_pcc_order_amt-mengeTOgt_rev_stock_end-menge.MOVE-CORRESPONDINGgt_pcc_order_amtTOMOVE-CORRESPONDINGgt_pcc_order_amtTOgt_pcc_cost_detail.COLLECTgt_pcc_detail.COLLECTCOLLECTgt_rev_stock_end.CLEARgt_rev_stock_end.**<LOOPATIFgt_rev_stock_end-mengeNEgt_rev_stock_end-perct=gt_rev_stock_end-labst/gt_rev_stock_end-MODIFYgt_rev_stock_end.CLEARgt_rev_stock_end.SORTgt_rev_stock_endBYmengeDESCENDING. "ls05/08/17add**<汇总未分摊物料的记录放到ALV的输出表中>LOOPATgt_rev_stock_endWHEREperctMOVE-CORRESPONDINGgt_rev_stock_endTOgt_fentan_none.APPENDgt_fentan_none.CLEAR**<0的记录,因为分摊率为0出库数量也为0DELETEgt_rev_stock_endWHEREperctEQ0.SORTgt_pcc_order_amtBYwerkslgortmatnrmengeDESCENDING. "lsSORTgt_pcc_order_amtBYmenge**<0的记录,说明全是未分摊的数据不调用BAPICHECKgt_rev_stock_end[]ISNOTINITIAL.PERFORMfrm_cal_out_qty. 4PERFORMfrm_get_rev_stock_end_qty."反冲库期末库存调整明细表IFsy-batchISNOTPERFORMfrm_def_alv_rev_stockUSINGp_cb_t''.IFp_cb_tEQ''.PERFORM PERFORMfrm_modify_bapi_data. BAPI执行正确的且剩余数量不为0记录选出执行剩余数量的CHECKgt_rev_stock_end[]ISNOTPERFORM gt_rev_stock_end_pcc_detail[]= " Form --> <-- FORMfrm_get_rev_stock_end_qty**<DATA:l_meegeLIKEgt_rev_stock_end-meege.LOOPATgt_rev_stock_end.l_meege=LOOPATgt_pcc_order_amtWHEREmatnr=gt_rev_stock_end-2005/10-2005/10-

ANDwerks=gt_rev_stock_end-werks "LsaddANDlgort=gt_rev_stock_end-lgort."Lsl_meege=l_meege+gt_pcc_order_amt-MOVEl_meegeTOgt_rev_stock_end-gt_rev_stock_end-mssge=gt_rev_stock_end-labst-gt_rev_stock_end-meege.MODIFYgt_rev_stock_end.**<输出到ALV的内表中>LOOPATgt_rev_stock_end.MOVE-CORRESPONDINGgt_rev_stock_endTOwa_stock.APPENDwa_stockTOgt_stock. " ModuleSTATUS_0100 MODULEstatus_0100IFp_cb_tISMOVEtext-301TOMOVEtext-302TOSETPF-STATUSSETTITLEBAR WITHPERFORMfrm_def_alv_rev_stockUSINGg_button_''.IFg_cust_cont_1ISINITIAL.CREATEOBJECTEXPORTINGcontainer_name=CREATEOBJECTEXPORTINGi_parent=CALLMETHODgrid1->set_table_for_first_disyi_structure_name='ZPV_S_MM36_1' =gw_layout_1 =gt_stockit_fieldcatalog=gt_fieldcat_1.CREATEOBJECTSETHANDLERevent_receiver1->handle_double_click1FORCALLMETHODgrid1->set_table_for_first_disyi_structure_name='ZPV_S_MM36_1' =gw_layout_1 =gt_stockit_fieldcatalog=gt_fieldcat_1.CALLMETHODgrid1->refresh_table_disIFg_sel_all_ISNOTINITIAL.MOVEtext-200TOMOVEtext-201TOIFg_cust_cont_2ISINITIAL.CREATEOBJECTEXPORTINGcontainer_name=CREATEOBJECTEXPORTINGi_parent=SORTgt_fentan_weiBYwerkslgortCALLMETHODgrid2->set_table_for_first_disy ='ZPV_S_MM36_2' =gw_layout_2it_toolbar_excluding=gt_toolbar_exclud_2 =gt_fentan_wei =gt_fieldcat_2.LOOPATIFscreen-name='TEXT03'.screen-invisible=g_mm.MODIFYSCREEN.IFp_cb_tISNOTLOOPATIFscreen-name='BUTTON'ORscreen-name='SURE'ORscreen-name='BUTTON1'ORscreen-name='G_BUTTON_TEXT'.screen-invisible='1'.MODIFYSCREEN.LOOPATIFg_button_ISINITIAL.IFscreen-name='BUTTON1'.screen-invisible='1'.MODIFYSCREEN.IFscreen-name='SURE'.screen-invisible='1'.MODIFYSCREEN.IFg_cust_cont_3ISNOTCALLMETHODgrid3->set_table_for_first_disi_structure_name= = =it_fieldcatalog=CALLMETHODgrid3->refresh_table_dis "STATUS_0100 MAND_0100 mand_0100CALLMETHODcl_gui_cfw=>dispatch.CASEok_code.WHENPERFORMWHENMOVEtext-216TOg_title.PERFORMfrm_show_pcc_cost_detail.WHENMOVEtext-212TOPERFORMWHENPERFORM WHENIFgt_pp_detail[]ISIFgt_rev_stock_end_pcc_detail[]ISNOTPERFORM "剩余调整数量计算及bapigt_pp_detail[]=MOVEtext-213TOCHECKgt_pp_detail[]ISNOTPERFORM PCC物料的对PPWHENCLEARg_button_PERFORM PERFORMfrm_modify_bapi_data. BAPI执行正确的且剩余数量不为0记录选出执行剩余数量的CHECKgt_rev_stock_end[]ISNOTPERFORM bapiWHENMOVEtext-215TOIFgt_pp_detail_oth_sy[]ISINITIAL.PERFORMfrm_call_no_pcc_qty.PERFORMCHECKgt_pp_detail_oth_sy[]ISNOTINITIAL.PERFORMfrm_show_pp_no_pcc_detail.WHENCALLMETHODgrid2->check_changed_data.REFRESH:"gt_pcc_ft_wei, PERFORM IFgt_ft_wei_1[]ISNOTINITIALORgt_fentan_wei_sy[]ISNOTINITIAL.IFgt_ft_wei_1[]ISNOTINITIAL.PERFORM BAPI

PERFORMfrm_get_wft_qty_sy. "计算未分摊物料剩余调整数量PERFORMfrm_modify_wft_sy. "取出出库调整生成的凭证号和返回信息IFgt_ft_wei_sy[]ISNOTINITIAL.g_mm=PERFORMfrm_call_bapi_qty_sy_wei.BAPIgt_fentan_wei_sy[]=MESSAGEgt_ft_wei_sy[]= IFgt_ft_wei_sy[]ISNOTINITIAL.INSERTLINESOFgt_ft_wei_syINTOTABLEINSERTLINESOFgt_ft_wei_sy_traINTOTABLEPERFORMfrm_show_cont3.PERFORMgt_fentan_wei[]=WHENCLEAR MAND_0100 Form --> <-- FORMfrm_call_bapi_rev_stockSORT

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论