IT干货网

ABAP-FI-预制凭证过账

flyfish 2022年03月09日 SAP 166 0
 1 CALL FUNCTION 'PRELIMINARY_POSTING_DOC_READ' 
 2  
 3 EXPORTING 
 4  
 5 belnr = rec_vbkpf-belnr 
 6  
 7 bukrs = rec_vbkpf-bukrs 
 8  
 9 gjahr = rec_vbkpf-gjahr 
10  
11 TABLES 
12  
13 t_vbkpf = t_vbkpf1 
14  
15 t_vbsec = t_vbsec1 
16  
17 t_vbseg = t_vbseg1 
18  
19 t_vbset = t_vbset1 
20  
21 EXCEPTIONS "#EC * 
22  
23 document_line_not_found = 1 
24  
25 document_not_found = 2 
26  
27 input_incomplete = 3 
28  
29 OTHERS = 4. 
30  
31 *// Change Posting Date to Current Date(Required) 
32  
33 CLEAR:rec_vbkpf1. 
34  
35 LOOP AT t_vbkpf1 INTO rec_vbkpf1. 
36  
37 rec_vbkpf1-budat = sy-datum. 
38  
39 MODIFY t_vbkpf1 FROM rec_vbkpf1 TRANSPORTING budat. 
40  
41 CLEAR:rec_vbkpf1. 
42  
43 ENDLOOP. 
44  
45 *// Change BZALT to BUZEI. - !!!! - it's obligatory 
46  
47 CLEAR:rec_vbseg1. 
48  
49 LOOP AT t_vbseg1 INTO rec_vbseg1. 
50  
51 CLEAR:rec_vbseg1-fipos . 
52  
53 rec_vbseg1-bzalt = rec_vbseg1-buzei. 
54  
55 MODIFY t_vbseg1 FROM rec_vbseg1 TRANSPORTING bzalt fipos. 
56  
57 CLEAR:rec_vbseg1. 
58  
59 ENDLOOP. 
60  
61 CALL FUNCTION 'PRELIMINARY_POSTING_DOC_WRITE' 
62  
63 TABLES 
64  
65 t_vbkpf = t_vbkpf1 
66  
67 t_vbsec = t_vbsec1 
68  
69 t_vbseg = t_vbseg1 
70  
71 t_vbset = t_vbset1 
72  
73 EXCEPTIONS "#EC * 
74  
75 abnormal_termination = 1 
76  
77 insert_error = 2 
78  
79 update_error = 3 
80  
81 read_error = 4 
82  
83 OTHERS = 5. 
84  
85 CALL FUNCTION 'PRELIMINARY_POSTING_POST_ALL' 
86  
87 EXPORTING 
88  
89 nomsg = c_x 
90  
91 TABLES 
92  
93 t_vbkpf = t_vbkpf 
94  
95 t_msg = t_msg 
96  
97 EXCEPTIONS 
98  
99 OTHERS = 1.

评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!

ABAP-QRFC-解决锁冲突问题