标签:use begin document nts into -- sage odi 退出
例:需求:
开发要求:制作交货单的人员,需要同一张单的交货仓位保持一致,设计成在保存前将所有行都改为和第一行项的仓位一致。
在发货过时会检查如发现不一致,不于过账。
*---------------------------------------------------------------------* * FORM USEREXIT_SAVE_DOCUMENT_PREPARE * *---------------------------------------------------------------------* * This userexit can be used for changes or checks, before a * * document is saved. * * * * If field T180-TRTYP contents ‘H‘, the document will be * * created, else it will be changed. * * * * This form is called at the beginning of form BELEG_SICHERN * * * *---------------------------------------------------------------------* FORM userexit_save_document_prepare. IF sy-uname = ‘HS014‘. BREAK-POINT. ENDIF. "只处理对客户发货,公司间交易不处理. IF ( tcode = ‘VL02N‘ OR tcode = ‘VL02‘ OR tcode = ‘VL01N‘ OR tcode = ‘VL01‘ ) and ( xlikp-VKORG = ‘1010‘ or xlikp-VKORG = ‘1020‘ ). "DATA: XLIPS_C LIKE LIPSVB OCCURS 0 WITH HEADER LINE. "DATA: I_LIPS LIKE LIPSVB OCCURS 0 WITH HEADER LINE. data: c_lgort like xlips-lgort , i_idx type i,i_Cnt type i, msg type string. IF sy-ucomm = ‘WABU_T‘. "过账 需要检查 如果有不同仓位,则报错. c_lgort = ‘‘. i_idx = 0. loop at xlips . if i_idx = 0 . "取得第一行的库位 i_idx = i_idx + 1. c_lgort = c_lgort = xlips-lgort. endif. if c_lgort <> xlips-lgort. message ‘交货单内存在不同的交货仓位,请通知销售助理修改正确后再过账.‘ type ‘E‘. endif. clear xlips. endloop. endif. IF sy-ucomm = ‘SICH_T‘ or sy-ucomm = ‘YES‘ . "如果是保存(或退出提示保存) ,则统一更新仓位. c_lgort = ‘‘. i_idx = 0. i_Cnt = 0. loop at xlips . if i_idx = 0 . "取得第一行的仓位 i_idx = i_idx + 1. c_lgort = c_lgort = xlips-lgort. if c_lgort = ‘‘. message ‘在保存交货单前请填写第一行项的交货仓位‘ type ‘E‘. else. concatenate ‘你在第一行项输入的仓是‘ c_lgort ‘,增强系统将按此仓位更新所有行项‘ into msg. message msg type ‘I‘. endif. endif. if c_lgort <> xlips-lgort. "更新仓位 xlips-lgort = c_lgort. "更新标识 U 表示该纪录被修改,需要更新,D表示删除,I表示新增 if xlips-updkz = ‘ ‘. xlips-updkz = ‘U‘. endif. modify xlips. i_Cnt = i_Cnt + 1. endif. clear xlips. endloop. if i_Cnt > 1. msg = i_Cnt . concatenate ‘更新了‘ msg ‘个行项的仓位‘ into msg. message msg type ‘I‘. endif. endif. ENDIF. ENDFORM. "USEREXIT_SAVE_DOCUMENT_PREPARE *eject
标签:use begin document nts into -- sage odi 退出
原文地址:http://www.cnblogs.com/rainysblog/p/6479484.html