用导入导出模板生成系统标准功能单据--销售订单
用中間表,利用導入導出模板功能自動產生銷售訂單為例。
1.??????打入導入導出模板補丁。
2.??????新建中間表,ZSORDER(主表),ZSORDERQ(子表)如下圖
?
?
?
3.??????新建導入導出模板YSOH,并將中間表與系統標準的銷售訂單表關聯
?
?
4.??????添加”產生訂單”按鈕代碼如下:
?
5.?? If BOUT='6'
6.?? ?
7.?? Integer X
8.?? If !GSERVEUR
9.??????????Call OUVRE_TRACE("createSOH") From LECFIC?????? #TIM2014035開啟日志
10.? ????Endif
11.? ?
12.?????If !clalev([ZSR]) : Local File ZSORDER[ZSR]: Endif? #TIM20140305中間表主表
13.?????If !clalev([BYBH]) : Local FileYBPCTEMH[BYBH] : Endif?? #TIM20140305
14.?????If !clalev([ZSQ]) : Local FileZSORDERQ[ZSQ] : Endif???? #TIM20140305中間表子表
15.?????If !clalev([YBH]) : Local FileYBPCTEMH[YBH] : Endif???? #TIM20140305數據來源表主表
16.?????If !clalev([YBD]) : Local FileYBPCTEMD[YBD] : Endif???? #TIM20140305數據來源表子表
17.?If !clalev([ITMT]) : LocalFile ITMMASTER[ITMT] : Endif
18.?Char YIHN
19.??
20.?Filter [YBH] Where[F:YBH]YSTAT<>2 and [F:YBH]YSOHNUM=[M:YSD0]YSOHNUM
21.? For [YBH]
22.? ?
23.???????Delete [ZSR] Where ZNUM= [F:ZSR]ZNUM?????????????? #TIM20140305將中間表數據清空
24.?????????If fstat : TFLG=1 : Goto GAS_TEMPT :Endif
25.?????????Delete [ZSQ] Where ZNUM<> ''
26.?????????If fstat : TFLG=1 : Goto GAS_TEMPT :Endif
27.? ????Raz[F:ZSR]
28.? ????PREF ='001'+num$(J)
29.?????YIHN =GUSER+format$("D:YYMMDDhhmmss",date$)+PREF? #TIM20140305將數據來源表主表數據寫入中間表主表
30.? ????[F:ZSR]ZNUM=YIHN
31.? ????[F:ZSR]ZSALFCY=[M:YSD0]YFCY
32.?????[F:ZSR]ZBPCORD=[M:YSD0]YBPCNUM
33.? ????[F:ZSR]ZORDDAT=date$
34.?????[F:ZSR]ZCUSORDREF=[M:YSD0]YSOHNUM
35.?????[F:ZSR]ZTYPE='SON'?? #[M:YSD0]YSOHTYP???? #ELMA 20131226
36.?????[F:ZSR]ZBIZH=[M:YSD0]YBIZH??????????????? #ELMA 20131226
37.???
38.? ????Write[ZSR]
39.? ?
40.? ????Integer I
41.?????For I = 0 To [M:YSD1]NBLIG -1? #TIM20140305將數據來源表子表數據寫入中間表子表
?
42.?If [M:YSD1]YOK(I)=2?? and [M:YSD1]YYSOHS(I)=''?? #elma 2014-2-1-20
43.?Read[ITMT]ITM0=[M:YSD1]ITMREF(I)
44.? ????????Raz[F:ZSQ]
45.? ????????[F:ZSQ]ZNUM=YIHN?? #[M:YSD0]YSOHNUM??
46.?????????[F:ZSQ]ZSOPLIN=[M:YSD1]YBDLIN(I)
47.?????????[F:ZSQ]ZSOQSEQ=[M:YSD1]YBDLIN(I)
48.?????????[F:ZSQ]ZITMREF=[M:YSD1]ITMREF(I)
49.?????????[F:ZSQ]ZQTY=[M:YSD1]YNUM(I)
50.?????????[F:ZSQ]ZSAU=[F:ITMT]SAU
51.?????????[F:ZSQ]ZSOHPRI=[M:YSD1]YPRICS(I)
52.?[F:ZSQ]ZSURMENT=[M:YSD1]YSURMENT(I)
53.?[F:ZSQ]ZPACKRE=[M:YSD1]YPACKRE(I)
54.?[F:ZSQ]ZBAMODE=[M:YSD1]YBAMODE(I)
55.?[F:ZSQ]ZDATUO=[M:YSD1]YDATUO(I)
56.?[F:ZSQ]ZCHEFAN=[M:YSD1]YCHEFAN(I)
57.?[F:ZSQ]ZBIAOTYPE=[M:YSD1]YBIAOTYPE(I)
58.??
59.?[F:ZSQ]YBPCPOH=[M:YSD1]YBPCPOH(I)
60.?[F:ZSQ]YBPCIT=[M:YSD1]YBPCIT(I)
61.?[F:ZSQ]YJIAODATE=[M:YSD1]YJIAODATE(I)
62.??
63.?[F:ZSQ]ZYZPSTA=[M:YSD1]YZPSTA(I)
64.?[F:ZSQ]ZYBPCITMNO=[M:YSD1]YBPCITMNO(I)
65.??
66.? ???????Write[ZSQ]
67.? ????Endif? #elma 2014-2-1-20
68.? ????Next
69.? ?
70.? ?
71.? ????
72.? ????GAS_TEMPT
73.? ?????Read [ZSR]ZSR0=YIHN
74.? ????????If !fstat
75.??????????????????Call IMPORTSIL('YSOH','ZNUM="' + YIHN + '"') From GIMPOBJ #TIM20140305調用新建的導入導出模板,即將中間表數據,導入到標準功能單據表中(銷售訂單表)
76.??
77.? ????????Endif
78.? Next
79.? ?
80.? ?
81.? ?
82.? Filter [YBH]
83.? Endif
84.????? If !GSERVEUR #TIM20140305顯示日志文件。
85.????? ????????Call FERME_TRACE From LECFIC
86.????? ????????Call LEC_TRACE From LECFIC
87.? Endif
生成成功如下圖。
總結
以上是生活随笔為你收集整理的用导入导出模板生成系统标准功能单据--销售订单的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Viewpager无限循环(首页与尾页平
- 下一篇: flex 下对齐_flex布局