- 浏览: 115700 次
- 性别:
- 来自: 杭州
最新评论
-
张斌梁林:
楼上有高手为啥不说出具体办法呢?还是楼主最好了!!!!
关于豆丁在线文档,百度文库总结 -
bigarden:
LZ分析的很好,学习了
JAVA SSH框架简介 -
s103y:
q8q8q8 写道顶你 兄弟
谢啦,初步使用,感觉还不错
SSO单点登录 -
s103y:
<div class="quote_title ...
关于豆丁在线文档,百度文库总结 -
gaowei52306:
挺好的
ANT简明教程[转载]
春节刚过,还没得心情来上班。就接到了新任务修改一下报表ZFI002财务凭证查询报表。当然对于老手来说这样的事情是小菜一碟了。也确实我是新手都2个小时搞定。所以清闲的很,用来记录以下过程。给需要的童鞋学习。任务主要是要新增加栏位:借方发生额,贷方发生额,文本,参照,用户名。并且用户名可以输入。不管它啦。先看看之前的是什么样子。呵呵~~
输入(查询条件):公司代码:BKPF-BUKRS 凭证编号:BKPF-BELNR 会计年度:BKPF- GJAHR 凭证类型:BKPF- BLART 凭证日期:BKPF-BLDAT 过账日期:BKPF-BUDAT 用户名:BKPF-USNAM(新增加哦~)
表有:T_BKPF,T_BSEG,T_LFA1,T_SKAT
处理过程有:GET_BKPF()-->CHECK_BKPF()-->GET_BSEG()-->PROCESS_BSEG()-->EVENTS_BUILD()-->LAYOUT_BUILD()-->FIELDS_BUILD()-->DISPLAY_BUILD().
是不是很啰嗦啊,其实就是那么简单嘛,分析要求:取数据-->处理数据-->alv显示 其实很多ABAP的报表都是这样的一个套路。好了,其他的也就不多说了,直接上Code.
[plain] view plaincopyprint?
01.*&---------------------------------------------------------------------*
02.*& Report ZFI002
03.*&---------------------------------------------------------------------*
04.* Author : RobertLee
05.* Date : 2008.05.02
06.* Purpose: FI Doc Report using ALV For Finance
07.*
08.*&---------------------------------------------------------------------*
09.* Change : Jasson.Lee
10.* Date : 2012.02.14
11.* Purpose: FI Doc Report using ALV For Finance Add col
12.*
13.*----------------------------------------------------------------------
14.REPORT ZFI002.
15.
16.TABLES: BKPF,BSEG,LFA1,SKAT.
17.*--------------------------------
18.* Global Types
19.* Essential Declaration for ALV Display
20.*--------------------------------
21.TYPE-POOLS: slis.
22.*--------------------------------
23.* Global Internal Tables
24.*--------------------------------
25.DATA:
26. i_fieldcat_alv TYPE slis_t_fieldcat_alv ,
27. i_layout TYPE slis_layout_alv,
28. i_fieldcat TYPE slis_fieldcat_alv,
29. i_events TYPE slis_t_event,
30. w_events LIKE LINE OF i_events,
31. i_list_comments TYPE slis_t_listheader,
32. w_list_comments LIKE LINE OF i_list_comments,
33. w_repid LIKE sy-repid.
34.
35.DATA: BEGIN OF T_BKPF OCCURS 0,
36. BUKRS LIKE BKPF-BUKRS, "CoCode
37. BELNR LIKE BKPF-BELNR, "FI Doc
38. GJAHR LIKE BKPF-GJAHR, "Fiscal Year
39. BLART LIKE BKPF-BLART, "Doc Type
40. BLDAT LIKE BKPF-BLDAT, "Doc Date
41. BUDAT LIKE BKPF-BUDAT, "Posting Date
42. TCODE LIKE BKPF-TCODE, "Transaction Code
43. AWKEY LIKE BKPF-AWKEY, "Reference Doc
44. BSTAT LIKE BKPF-BSTAT, "Document Status
45. BKTXT LIKE BKPF-BKTXT, " txt
46. XBLNR LIKE BKPF-XBLNR, " ref
47. USNAM LIKE BKPF-USNAM, " user name
48. END OF T_BKPF.
49.
50.DATA: BEGIN OF T_BSEG OCCURS 0,
51. BUKRS LIKE BSEG-BUKRS, "CoCode
52. BELNR LIKE BSEG-BELNR, "FI Doc
53. GJAHR LIKE BSEG-GJAHR, "Fiscal Year
54. BUZEI LIKE BSEG-BUZEI, "Item
55. SHKZG LIKE BSEG-SHKZG, "Credit or Debit
56. PSWSL LIKE BSEG-PSWSL, "Cur
57. DMBTR like BSEG-DMBTR, "Local Amount
58. PSWBT LIKE BSEG-PSWBT, "Amount
59. SAKNR LIKE BSEG-SAKNR, "G/L Account Number
60. HKONT LIKE BSEG-HKONT, "General Ledger Account
61. LIFNR LIKE BSEG-LIFNR, "Account Number of Vendor or Creditor
62. BSCHL LIKE BSEG-BSCHL, "Posting Key
63.
64. BLART LIKE BKPF-BLART, "Doc Type
65. BLDAT LIKE BKPF-BLDAT, "Doc Date
66. BUDAT LIKE BKPF-BUDAT, "Posting Date
67. TCODE LIKE BKPF-TCODE, "Transaction Code
68. AWKEY LIKE BKPF-AWKEY, "Reference Doc
69. BSTAT LIKE BKPF-BSTAT, "Document status
70. TXT20 LIKE SKAT-TXT20, "G/L Acccount Name
71. NAME1 LIKE LFA1-NAME1, "Vendor Name
72. PSWBT1 LIKE BSEG-PSWBT, "Amount
73. PSWBT2 LIKE BSEG-PSWBT, "Amount
74. BKTXT LIKE BKPF-BKTXT, " txt
75. XBLNR LIKE BKPF-XBLNR, " ref
76. USNAM LIKE BKPF-USNAM, " user name
77. END OF T_BSEG.
78.
79.DATA: BEGIN OF T_LFA1 OCCURS 0,
80. LIFNR LIKE LFA1-LIFNR,
81. NAME1 LIKE LFA1-NAME1,
82. END OF T_LFA1.
83.DATA: BEGIN OF T_SKAT OCCURS 0,
84. SAKNR LIKE SKAT-SAKNR,
85. TXT20 LIKE SKAT-TXT20,
86. END OF T_SKAT.
87.DATA W_LEN TYPE I.
88.*--------------------------------
89.* Selection Screen
90.*--------------------------------
91.SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
92.SELECT-OPTIONS:
93. S_BUKRS FOR BKPF-BUKRS Default 5000, "CoCode
94. S_BELNR FOR BKPF-BELNR, "FI Doc
95. S_GJAHR FOR BKPF-GJAHR Default 2008, "Fiscal Year
96. S_BLART FOR BKPF-BLART, "Doc Type
97. S_BLDAT FOR BKPF-BLDAT, "Doc Date
98. S_BUDAT FOR BKPF-BUDAT, "Posting Date
99. S_USNAM FOR BKPF-USNAM.
100.SELECTION-SCREEN END OF BLOCK b1.
101.
102.*--------------------------------
103.* Initialization
104.*--------------------------------
105.INITIALIZATION.
106.
107.*--------------------------------
108.* At Selection Screen PBO
109.*--------------------------------
110.AT SELECTION-SCREEN OUTPUT.
111.
112.*--------------------------------
113.* Start of Selection
114.*--------------------------------
115.START-OF-SELECTION.
116. PERFORM GET_BKPF.
117. PERFORM CHECK_BKPF.
118. PERFORM GET_BSEG.
119. PERFORM Process_BSEG.
120. PERFORM Events_build.
121. PERFORM Layout_build.
122. PERFORM Fields_bulid.
123. PERFORM Display_data.
124.
125.END-OF-SELECTION.
126.*--------------------------------
127.* Top of Page
128.*--------------------------------
129.TOP-OF-PAGE.
130.
131.*--------------------------------
132.* At User Command
133.*--------------------------------
134.AT USER-COMMAND.
135.*--------------------------------
136.* At Line Selection
137.*--------------------------------
138.AT LINE-SELECTION.
139.
140.*&---------------------------------------------------------------------*
141.*& Form display_data
142.*&---------------------------------------------------------------------*
143.FORM display_data.
144.
145. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
146. EXPORTING
147. i_callback_user_command = 'USER_COMMAND' "用户触发事件
148.* i_callback_pf_status_set = 'PF_STATUS_SET'(001) "调用用户事件和按钮事件
149. i_callback_program = w_repid "当前程序
150. is_layout = i_layout "子函数layout_build填充的格式定义
151. it_fieldcat = i_fieldcat_alv[] "子函数fields填充的各列
152. it_events = i_events[]
153. i_save = 'A' "保存变式
154. TABLES
155. t_outtab = T_BSEG.
156.
157.ENDFORM. "display_data
158.*---------------------------------------------------------------------*
159.* FORM user_command *
160.*---------------------------------------------------------------------*
161.FORM USER_COMMAND USING i_ucomm LIKE sy-ucomm
162. selfield TYPE slis_selfield.
163. CASE i_ucomm.
164. WHEN '&IC1'.
165. CASE selfield-sel_tab_field.
166. WHEN '1-BELNR'.
167. SET PARAMETER ID 'BLN' FIELD selfield-value.
168. SET PARAMETER ID 'BUK' FIELD T_BSEG-BUKRS.
169. SET PARAMETER ID 'GJR' FIELD T_BSEG-GJAHR.
170. CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
171. ENDCASE.
172. WHEN OTHERS.
173. ENDCASE.
174.
175.ENDFORM. "callback_ucomm
176.
177.*&---------------------------------------------------------------------*
178.*& Form GET_BKPF
179.*&---------------------------------------------------------------------*
180.* text
181.*----------------------------------------------------------------------*
182.* --> p1 text
183.* <-- p2 text
184.*----------------------------------------------------------------------*
185.FORM GET_BKPF .
186.*Get Data From BKPF
187. SELECT BUKRS BELNR GJAHR BLART BLDAT BUDAT TCODE AWKEY BSTAT BKTXT XBLNR USNAM
188. INTO TABLE T_BKPF
189. FROM BKPF
190. WHERE BUKRS IN S_BUKRS AND BELNR IN S_BELNR AND BLDAT IN S_BLDAT
191. and GJAHR in S_GJAHR and BLART in S_BLART AND BUDAT IN S_BUDAT AND USNAM IN S_USNAM .
192.ENDFORM. " GET_BKPF
193.*&---------------------------------------------------------------------*
194.*& Form CHECK_BKPF
195.*&---------------------------------------------------------------------*
196.* text
197.*----------------------------------------------------------------------*
198.* --> p1 text
199.* <-- p2 text
200.*----------------------------------------------------------------------*
201.FORM CHECK_BKPF .
202. IF T_BKPF[] IS INITIAL.
203. MESSAGE I000(ZMsg) with '没找到对应的数据,请更改查询条件'.
204. LEAVE LIST-PROCESSING.
205. ENDIF.
206.
207.ENDFORM. " CHECK_BKPF
208.*&---------------------------------------------------------------------*
209.*& Form GET_BSEG
210.*&---------------------------------------------------------------------*
211.FORM GET_BSEG.
212.*Get Data From BSEG
213. SELECT BUKRS BELNR GJAHR BUZEI SHKZG PSWSL DMBTR PSWBT SAKNR HKONT LIFNR BSCHL
214. INTO CORRESPONDING FIELDS OF TABLE T_BSEG
215. FROM BSEG
216. FOR ALL ENTRIES IN T_BKPF
217. WHERE BUKRS = T_BKPF-BUKRS AND BELNR = T_BKPF-BELNR AND GJAHR = T_BKPF-GJAHR.
218.*Get G/L Account name from skat
219. SELECT SAKNR TXT20
220. INTO TABLE T_SKAT
221. FROM SKAT
222. WHERE SPRAS = SY-LANGU AND KTOPL = 'INT'.
223.*Get Vendor Info from LFA1
224. SELECT LIFNR NAME1
225. INTO TABLE T_LFA1
226. FROM LFA1
227. FOR ALL ENTRIES IN T_BSEG
228. WHERE LIFNR = T_BSEG-LIFNR.
229.ENDFORM. "GET_BSEG
230.*&---------------------------------------------------------------------*
231.*& Form events_build
232.*&---------------------------------------------------------------------*
233.FORM events_build.
234.
235. CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
236. EXPORTING
237. i_list_type = 0
238. IMPORTING
239. et_events = i_events.
240.
241.* READ TABLE i_events WITH KEY name = 'TOP_OF_PAGE' INTO w_events.
242.* IF sy-subrc = 0.
243.* MOVE 'ALV_TOP_OF_PAGE' TO w_events-form.
244.* MODIFY i_events FROM w_events INDEX sy-tabix.
245.* ENDIF.
246.*
247.* READ TABLE i_events WITH KEY name = 'END_OF_LIST' INTO w_events.
248.* IF sy-subrc = 0.
249.* MOVE 'ALV_END_OF_LIST' TO w_events-form.
250.* MODIFY i_events FROM w_events INDEX sy-tabix.
251.* ENDIF.
252.
253. READ TABLE i_events WITH KEY name = 'USER_COMMAND' INTO w_events.
254. IF sy-subrc = 0.
255. MOVE 'USER_COMMAND' TO w_events-form.
256. MODIFY i_events FROM w_events INDEX sy-tabix.
257. ENDIF.
258.
259.ENDFORM. "events_build
260.
261.*&---------------------------------------------------------------------*
262.*& Form layout_build
263.*&---------------------------------------------------------------------*
264.FORM layout_build.
265.* i_layout-detail_popup = 'X'. "弹出详细信息窗口
266.* i-layout-no_vline = 'X'. "设置列间隔线
267. i_layout-info_fieldname = 'COLOR'. "颜色值
268. i_layout-colwidth_optimize = 'X'. "优化列宽选项
269. i_layout-detail_initial_lines = 'X'.
270. i_layout-detail_titlebar = '凭证查询报表'.
271. i_layout-no_colhead =' '.
272. w_repid = sy-repid.
273.
274.ENDFORM. "layout_build
275.
276.
277.*&---------------------------------------------------------------------*
278.*& Form Fields_Bulid
279.*&---------------------------------------------------------------------*
280.* text
281.*----------------------------------------------------------------------*
282.* --> p1 text
283.* <-- p2 text
284.*----------------------------------------------------------------------*
285.FORM fields_bulid .
286. DATA tmp_pos TYPE i.
287. REFRESH i_fieldcat_alv.
288. CLEAR i_fieldcat.
289.
290. tmp_pos = 1.
291. i_fieldcat-col_pos = tmp_pos.
292. i_fieldcat-fieldname = 'BLART'.
293. i_fieldcat-seltext_l = '凭证类型'.
294. i_fieldcat-key = 'X'.
295. APPEND i_fieldcat TO i_fieldcat_alv.
296. CLEAR i_fieldcat.
297.
298. tmp_pos = tmp_pos + 1.
299. i_fieldcat-col_pos = tmp_pos.
300. i_fieldcat-fieldname = 'BUKRS'.
301. i_fieldcat-seltext_l = '公司代码'.
302. i_fieldcat-outputlen = '15'.
303. i_fieldcat-no_zero = 'X'.
304. i_fieldcat-key = 'X'.
305. APPEND i_fieldcat TO i_fieldcat_alv.
306. CLEAR i_fieldcat.
307.
308. tmp_pos = tmp_pos + 1.
309. i_fieldcat-col_pos = tmp_pos.
310. i_fieldcat-fieldname = 'BELNR'.
311. i_fieldcat-seltext_l = '会计凭证号'.
312. i_fieldcat-outputlen = '10'.
313. APPEND i_fieldcat TO i_fieldcat_alv.
314. CLEAR i_fieldcat.
315.
316. tmp_pos = tmp_pos + 1.
317. i_fieldcat-col_pos = tmp_pos.
318. i_fieldcat-fieldname = 'BLDAT'.
319. i_fieldcat-seltext_l = '凭证日期'.
320. APPEND i_fieldcat TO i_fieldcat_alv.
321. CLEAR i_fieldcat.
322.
323. tmp_pos = tmp_pos + 1.
324. i_fieldcat-col_pos = tmp_pos.
325. i_fieldcat-fieldname = 'BUDAT'.
326. i_fieldcat-seltext_l = '过账日期'.
327. APPEND i_fieldcat TO i_fieldcat_alv.
328. CLEAR i_fieldcat.
329.
330. tmp_pos = tmp_pos + 1.
331. i_fieldcat-col_pos = tmp_pos.
332. i_fieldcat-fieldname = 'GJAHR'.
333. i_fieldcat-seltext_l = '年度'.
334. APPEND i_fieldcat TO i_fieldcat_alv.
335. CLEAR i_fieldcat.
336.
337. tmp_pos = tmp_pos + 1.
338. i_fieldcat-col_pos = tmp_pos.
339. i_fieldcat-fieldname = 'BUZEI'.
340. i_fieldcat-seltext_l = '项目'.
341. APPEND i_fieldcat TO i_fieldcat_alv.
342. CLEAR i_fieldcat.
343.
344.
345. tmp_pos = tmp_pos + 1.
346. i_fieldcat-col_pos = tmp_pos.
347. i_fieldcat-fieldname = 'BSCHL'.
348. i_fieldcat-seltext_l = 'PK'.
349. APPEND i_fieldcat TO i_fieldcat_alv.
350. CLEAR i_fieldcat.
351.
352. tmp_pos = tmp_pos + 1.
353. i_fieldcat-col_pos = tmp_pos.
354. i_fieldcat-fieldname = 'SHKZG'.
355. i_fieldcat-seltext_l = '借方/贷方'.
356. i_fieldcat-no_out = 'X'.
357. APPEND i_fieldcat TO i_fieldcat_alv.
358. CLEAR i_fieldcat.
359.
360. tmp_pos = tmp_pos + 1.
361. i_fieldcat-col_pos = tmp_pos.
362. i_fieldcat-fieldname = 'HKONT'.
363. i_fieldcat-seltext_l = '科目'.
364. i_fieldcat-No_Zero = 'X'.
365. APPEND i_fieldcat TO i_fieldcat_alv.
366. CLEAR i_fieldcat.
367.
368. tmp_pos = tmp_pos + 1.
369. i_fieldcat-col_pos = tmp_pos.
370. i_fieldcat-fieldname = 'SAKNR'.
371. i_fieldcat-seltext_l = '总帐科目'.
372. i_fieldcat-No_Zero = 'X'.
373. i_fieldcat-no_out = 'X'.
374. APPEND i_fieldcat TO i_fieldcat_alv.
375. CLEAR i_fieldcat.
376.
377. tmp_pos = tmp_pos + 1.
378. i_fieldcat-col_pos = tmp_pos.
379. i_fieldcat-fieldname = 'TXT20'.
380. i_fieldcat-seltext_l = '科目名'.
381. APPEND i_fieldcat TO i_fieldcat_alv.
382. CLEAR i_fieldcat.
383.
384. tmp_pos = tmp_pos + 1.
385. i_fieldcat-col_pos = tmp_pos.
386. i_fieldcat-fieldname = 'LIFNR'.
387. i_fieldcat-seltext_l = 'Vendor'.
388. i_fieldcat-no_out = 'X'.
389. APPEND i_fieldcat TO i_fieldcat_alv.
390. CLEAR i_fieldcat.
391.
392. tmp_pos = tmp_pos + 1.
393. i_fieldcat-col_pos = tmp_pos.
394. i_fieldcat-fieldname = 'NAME1'.
395. i_fieldcat-seltext_l = '厂商名'.
396. i_fieldcat-no_out = 'X'.
397. APPEND i_fieldcat TO i_fieldcat_alv.
398. CLEAR i_fieldcat.
399.
400. tmp_pos = tmp_pos + 1.
401. i_fieldcat-col_pos = tmp_pos.
402. i_fieldcat-fieldname = 'PSWSL'.
403. i_fieldcat-seltext_l = '币别'.
404. APPEND i_fieldcat TO i_fieldcat_alv.
405. CLEAR i_fieldcat.
406.
407. tmp_pos = tmp_pos + 1.
408. i_fieldcat-col_pos = tmp_pos.
409. i_fieldcat-fieldname = 'PSWBT'.
410. i_fieldcat-seltext_l = '金额'.
411. APPEND i_fieldcat TO i_fieldcat_alv.
412. CLEAR i_fieldcat.
413.
414. tmp_pos = tmp_pos + 1.
415. i_fieldcat-col_pos = tmp_pos.
416. i_fieldcat-fieldname = 'DMBTR'.
417. i_fieldcat-seltext_l = '本币金额'.
418. APPEND i_fieldcat TO i_fieldcat_alv.
419. CLEAR i_fieldcat.
420.
421. tmp_pos = tmp_pos + 1.
422. i_fieldcat-col_pos = tmp_pos.
423. i_fieldcat-fieldname = 'AWKEY'.
424. i_fieldcat-seltext_l = '原始凭证'.
425. APPEND i_fieldcat TO i_fieldcat_alv.
426. CLEAR i_fieldcat.
427.
428. tmp_pos = tmp_pos + 1.
429. i_fieldcat-col_pos = tmp_pos.
430. i_fieldcat-fieldname = 'TCODE'.
431. i_fieldcat-seltext_l = '原始凭证交易码'.
432. APPEND i_fieldcat TO i_fieldcat_alv.
433. CLEAR i_fieldcat.
434.
435. tmp_pos = tmp_pos + 1.
436. i_fieldcat-col_pos = tmp_pos.
437. i_fieldcat-fieldname = 'BSTAT'.
438. i_fieldcat-seltext_l = '凭证状态'.
439. i_fieldcat-no_Out = 'X'.
440. APPEND i_fieldcat TO i_fieldcat_alv.
441. CLEAR i_fieldcat.
442.
443. tmp_pos = tmp_pos + 1.
444. i_fieldcat-col_pos = tmp_pos.
445. i_fieldcat-fieldname = 'PSWBT1'.
446. i_fieldcat-seltext_l = '借方发生额'.
447. APPEND i_fieldcat TO i_fieldcat_alv.
448. CLEAR i_fieldcat.
449.
450. tmp_pos = tmp_pos + 1.
451. i_fieldcat-col_pos = tmp_pos.
452. i_fieldcat-fieldname = 'PSWBT2'.
453. i_fieldcat-seltext_l = '贷方发生额'.
454. APPEND i_fieldcat TO i_fieldcat_alv.
455. CLEAR i_fieldcat.
456.
457. tmp_pos = tmp_pos + 1.
458. i_fieldcat-col_pos = tmp_pos.
459. i_fieldcat-fieldname = 'BKTXT'.
460. i_fieldcat-seltext_l = '文本'.
461. APPEND i_fieldcat TO i_fieldcat_alv.
462. CLEAR i_fieldcat.
463.
464. tmp_pos = tmp_pos + 1.
465. i_fieldcat-col_pos = tmp_pos.
466. i_fieldcat-fieldname = 'XBLNR'.
467. i_fieldcat-seltext_l = '参照'.
468. APPEND i_fieldcat TO i_fieldcat_alv.
469. CLEAR i_fieldcat.
470.
471. tmp_pos = tmp_pos + 1.
472. i_fieldcat-col_pos = tmp_pos.
473. i_fieldcat-fieldname = 'USNAM'.
474. i_fieldcat-seltext_l = '用户名'.
475. APPEND i_fieldcat TO i_fieldcat_alv.
476. CLEAR i_fieldcat.
477.
478.
479.ENDFORM. " Fields_Bulid
480.*&---------------------------------------------------------------------*
481.*& Form Process_BSEG
482.*&---------------------------------------------------------------------*
483.* text
484.*----------------------------------------------------------------------*
485.* --> p1 text
486.* <-- p2 text
487.*----------------------------------------------------------------------*
488.FORM process_BSEG .
489. DATA l_loop LIKE sy-tabix.
490. DATA L_LEN TYPE I.
491. SORT T_BSEG BY BUKRS GJAHR BELNR.
492. SORT T_BKPF BY BUKRS GJAHR BELNR.
493. LOOP AT T_BSEG.
494. L_LOOP = SY-TABIX.
495. IF T_BSEG-SHKZG = 'H'.
496. T_BSEG-DMBTR = T_BSEG-DMBTR * ( -1 ).
497. T_BSEG-PSWBT = T_BSEG-PSWBT * ( -1 ).
498. T_BSEG-PSWBT2 = T_BSEG-PSWBT * ( -1 ).
499. ENDIF.
500. IF T_BSEG-SHKZG = 'S'.
501. T_BSEG-PSWBT1 = T_BSEG-PSWBT .
502. ENDIF.
503.* Get G/L Account Name
504. READ TABLE T_SKAT WITH KEY SAKNR = T_BSEG-HKONT BINARY SEARCH.
505. IF SY-SUBRC = 0.
506. T_BSEG-TXT20 = T_SKAT-TXT20.
507. ENDIF.
508.* Get Vendor Name
509. IF T_BSEG-SAKNR <> '' AND T_BSEG-LIFNR <> ''.
510. T_BSEG-HKONT = T_BSEG-LIFNR.
511. READ TABLE T_LFA1 WITH KEY LIFNR = T_BSEG-LIFNR BINARY SEARCH.
512. IF SY-SUBRC = 0.
513. T_BSEG-NAME1 = T_LFA1-NAME1.
514. T_BSEG-TXT20 = T_LFA1-NAME1.
515. ENDIF.
516. ENDIF.
517.*Move Doc Header to Item
518. READ TABLE T_BKPF WITH KEY BUKRS = T_BSEG-BUKRS GJAHR = T_BSEG-GJAHR
519. BELNR = T_BSEG-BELNR BINARY SEARCH.
520. IF SY-SUBRC = 0.
521. T_BSEG-BLART = T_BKPF-BLART .
522. T_BSEG-BLDAT = T_BKPF-BLDAT .
523. T_BSEG-BUDAT = T_BKPF-BUDAT .
524. T_BSEG-TCODE = T_BKPF-TCODE .
525. T_BSEG-AWKEY = T_BKPF-AWKEY .
526. T_BSEG-BKTXT = T_BKPF-BKTXT .
527. T_BSEG-XBLNR = T_BKPF-XBLNR .
528. T_BSEG-USNAM = T_BKPF-USNAM .
529. ENDIF.
530. IF T_BSEG-AWKEY <>' '.
531. W_LEN = STRLEN( T_BSEG-AWKEY ) .
532. IF W_LEN = 10 OR W_LEN = 14 OR W_LEN = 18.
533. T_BSEG-AWKEY = T_BSEG-AWKEY(10).
534. ENDIF.
535. ENDIF.
536.
537. MODIFY T_BSEG.
538. SY-TABIX = L_LOOP.
539. ENDLOOP.
540.ENDFORM. " Process_BSEG
*&---------------------------------------------------------------------*
*& Report ZFI002
*&---------------------------------------------------------------------*
* Author : RobertLee
* Date : 2008.05.02
* Purpose: FI Doc Report using ALV For Finance
*
*&---------------------------------------------------------------------*
* Change : Jasson.Lee
* Date : 2012.02.14
* Purpose: FI Doc Report using ALV For Finance Add col
*
*----------------------------------------------------------------------
REPORT ZFI002.
TABLES: BKPF,BSEG,LFA1,SKAT.
*--------------------------------
* Global Types
* Essential Declaration for ALV Display
*--------------------------------
TYPE-POOLS: slis.
*--------------------------------
* Global Internal Tables
*--------------------------------
DATA:
i_fieldcat_alv TYPE slis_t_fieldcat_alv ,
i_layout TYPE slis_layout_alv,
i_fieldcat TYPE slis_fieldcat_alv,
i_events TYPE slis_t_event,
w_events LIKE LINE OF i_events,
i_list_comments TYPE slis_t_listheader,
w_list_comments LIKE LINE OF i_list_comments,
w_repid LIKE sy-repid.
DATA: BEGIN OF T_BKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS, "CoCode
BELNR LIKE BKPF-BELNR, "FI Doc
GJAHR LIKE BKPF-GJAHR, "Fiscal Year
BLART LIKE BKPF-BLART, "Doc Type
BLDAT LIKE BKPF-BLDAT, "Doc Date
BUDAT LIKE BKPF-BUDAT, "Posting Date
TCODE LIKE BKPF-TCODE, "Transaction Code
AWKEY LIKE BKPF-AWKEY, "Reference Doc
BSTAT LIKE BKPF-BSTAT, "Document Status
BKTXT LIKE BKPF-BKTXT, " txt
XBLNR LIKE BKPF-XBLNR, " ref
USNAM LIKE BKPF-USNAM, " user name
END OF T_BKPF.
DATA: BEGIN OF T_BSEG OCCURS 0,
BUKRS LIKE BSEG-BUKRS, "CoCode
BELNR LIKE BSEG-BELNR, "FI Doc
GJAHR LIKE BSEG-GJAHR, "Fiscal Year
BUZEI LIKE BSEG-BUZEI, "Item
SHKZG LIKE BSEG-SHKZG, "Credit or Debit
PSWSL LIKE BSEG-PSWSL, "Cur
DMBTR like BSEG-DMBTR, "Local Amount
PSWBT LIKE BSEG-PSWBT, "Amount
SAKNR LIKE BSEG-SAKNR, "G/L Account Number
HKONT LIKE BSEG-HKONT, "General Ledger Account
LIFNR LIKE BSEG-LIFNR, "Account Number of Vendor or Creditor
BSCHL LIKE BSEG-BSCHL, "Posting Key
BLART LIKE BKPF-BLART, "Doc Type
BLDAT LIKE BKPF-BLDAT, "Doc Date
BUDAT LIKE BKPF-BUDAT, "Posting Date
TCODE LIKE BKPF-TCODE, "Transaction Code
AWKEY LIKE BKPF-AWKEY, "Reference Doc
BSTAT LIKE BKPF-BSTAT, "Document status
TXT20 LIKE SKAT-TXT20, "G/L Acccount Name
NAME1 LIKE LFA1-NAME1, "Vendor Name
PSWBT1 LIKE BSEG-PSWBT, "Amount
PSWBT2 LIKE BSEG-PSWBT, "Amount
BKTXT LIKE BKPF-BKTXT, " txt
XBLNR LIKE BKPF-XBLNR, " ref
USNAM LIKE BKPF-USNAM, " user name
END OF T_BSEG.
DATA: BEGIN OF T_LFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF T_LFA1.
DATA: BEGIN OF T_SKAT OCCURS 0,
SAKNR LIKE SKAT-SAKNR,
TXT20 LIKE SKAT-TXT20,
END OF T_SKAT.
DATA W_LEN TYPE I.
*--------------------------------
* Selection Screen
*--------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
S_BUKRS FOR BKPF-BUKRS Default 5000, "CoCode
S_BELNR FOR BKPF-BELNR, "FI Doc
S_GJAHR FOR BKPF-GJAHR Default 2008, "Fiscal Year
S_BLART FOR BKPF-BLART, "Doc Type
S_BLDAT FOR BKPF-BLDAT, "Doc Date
S_BUDAT FOR BKPF-BUDAT, "Posting Date
S_USNAM FOR BKPF-USNAM.
SELECTION-SCREEN END OF BLOCK b1.
*--------------------------------
* Initialization
*--------------------------------
INITIALIZATION.
*--------------------------------
* At Selection Screen PBO
*--------------------------------
AT SELECTION-SCREEN OUTPUT.
*--------------------------------
* Start of Selection
*--------------------------------
START-OF-SELECTION.
PERFORM GET_BKPF.
PERFORM CHECK_BKPF.
PERFORM GET_BSEG.
PERFORM Process_BSEG.
PERFORM Events_build.
PERFORM Layout_build.
PERFORM Fields_bulid.
PERFORM Display_data.
END-OF-SELECTION.
*--------------------------------
* Top of Page
*--------------------------------
TOP-OF-PAGE.
*--------------------------------
* At User Command
*--------------------------------
AT USER-COMMAND.
*--------------------------------
* At Line Selection
*--------------------------------
AT LINE-SELECTION.
*&---------------------------------------------------------------------*
*& Form display_data
*&---------------------------------------------------------------------*
FORM display_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_user_command = 'USER_COMMAND' "用户触发事件
* i_callback_pf_status_set = 'PF_STATUS_SET'(001) "调用用户事件和按钮事件
i_callback_program = w_repid "当前程序
is_layout = i_layout "子函数layout_build填充的格式定义
it_fieldcat = i_fieldcat_alv[] "子函数fields填充的各列
it_events = i_events[]
i_save = 'A' "保存变式
TABLES
t_outtab = T_BSEG.
ENDFORM. "display_data
*---------------------------------------------------------------------*
* FORM user_command *
*---------------------------------------------------------------------*
FORM USER_COMMAND USING i_ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE i_ucomm.
WHEN '&IC1'.
CASE selfield-sel_tab_field.
WHEN '1-BELNR'.
SET PARAMETER ID 'BLN' FIELD selfield-value.
SET PARAMETER ID 'BUK' FIELD T_BSEG-BUKRS.
SET PARAMETER ID 'GJR' FIELD T_BSEG-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDCASE.
WHEN OTHERS.
ENDCASE.
ENDFORM. "callback_ucomm
*&---------------------------------------------------------------------*
*& Form GET_BKPF
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_BKPF .
*Get Data From BKPF
SELECT BUKRS BELNR GJAHR BLART BLDAT BUDAT TCODE AWKEY BSTAT BKTXT XBLNR USNAM
INTO TABLE T_BKPF
FROM BKPF
WHERE BUKRS IN S_BUKRS AND BELNR IN S_BELNR AND BLDAT IN S_BLDAT
and GJAHR in S_GJAHR and BLART in S_BLART AND BUDAT IN S_BUDAT AND USNAM IN S_USNAM .
ENDFORM. " GET_BKPF
*&---------------------------------------------------------------------*
*& Form CHECK_BKPF
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CHECK_BKPF .
IF T_BKPF[] IS INITIAL.
MESSAGE I000(ZMsg) with '没找到对应的数据,请更改查询条件'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " CHECK_BKPF
*&---------------------------------------------------------------------*
*& Form GET_BSEG
*&---------------------------------------------------------------------*
FORM GET_BSEG.
*Get Data From BSEG
SELECT BUKRS BELNR GJAHR BUZEI SHKZG PSWSL DMBTR PSWBT SAKNR HKONT LIFNR BSCHL
INTO CORRESPONDING FIELDS OF TABLE T_BSEG
FROM BSEG
FOR ALL ENTRIES IN T_BKPF
WHERE BUKRS = T_BKPF-BUKRS AND BELNR = T_BKPF-BELNR AND GJAHR = T_BKPF-GJAHR.
*Get G/L Account name from skat
SELECT SAKNR TXT20
INTO TABLE T_SKAT
FROM SKAT
WHERE SPRAS = SY-LANGU AND KTOPL = 'INT'.
*Get Vendor Info from LFA1
SELECT LIFNR NAME1
INTO TABLE T_LFA1
FROM LFA1
FOR ALL ENTRIES IN T_BSEG
WHERE LIFNR = T_BSEG-LIFNR.
ENDFORM. "GET_BSEG
*&---------------------------------------------------------------------*
*& Form events_build
*&---------------------------------------------------------------------*
FORM events_build.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_events.
* READ TABLE i_events WITH KEY name = 'TOP_OF_PAGE' INTO w_events.
* IF sy-subrc = 0.
* MOVE 'ALV_TOP_OF_PAGE' TO w_events-form.
* MODIFY i_events FROM w_events INDEX sy-tabix.
* ENDIF.
*
* READ TABLE i_events WITH KEY name = 'END_OF_LIST' INTO w_events.
* IF sy-subrc = 0.
* MOVE 'ALV_END_OF_LIST' TO w_events-form.
* MODIFY i_events FROM w_events INDEX sy-tabix.
* ENDIF.
READ TABLE i_events WITH KEY name = 'USER_COMMAND' INTO w_events.
IF sy-subrc = 0.
MOVE 'USER_COMMAND' TO w_events-form.
MODIFY i_events FROM w_events INDEX sy-tabix.
ENDIF.
ENDFORM. "events_build
*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
FORM layout_build.
* i_layout-detail_popup = 'X'. "弹出详细信息窗口
* i-layout-no_vline = 'X'. "设置列间隔线
i_layout-info_fieldname = 'COLOR'. "颜色值
i_layout-colwidth_optimize = 'X'. "优化列宽选项
i_layout-detail_initial_lines = 'X'.
i_layout-detail_titlebar = '凭证查询报表'.
i_layout-no_colhead =' '.
w_repid = sy-repid.
ENDFORM. "layout_build
*&---------------------------------------------------------------------*
*& Form Fields_Bulid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fields_bulid .
DATA tmp_pos TYPE i.
REFRESH i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BLART'.
i_fieldcat-seltext_l = '凭证类型'.
i_fieldcat-key = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BUKRS'.
i_fieldcat-seltext_l = '公司代码'.
i_fieldcat-outputlen = '15'.
i_fieldcat-no_zero = 'X'.
i_fieldcat-key = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BELNR'.
i_fieldcat-seltext_l = '会计凭证号'.
i_fieldcat-outputlen = '10'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BLDAT'.
i_fieldcat-seltext_l = '凭证日期'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BUDAT'.
i_fieldcat-seltext_l = '过账日期'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'GJAHR'.
i_fieldcat-seltext_l = '年度'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BUZEI'.
i_fieldcat-seltext_l = '项目'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BSCHL'.
i_fieldcat-seltext_l = 'PK'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'SHKZG'.
i_fieldcat-seltext_l = '借方/贷方'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'HKONT'.
i_fieldcat-seltext_l = '科目'.
i_fieldcat-No_Zero = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'SAKNR'.
i_fieldcat-seltext_l = '总帐科目'.
i_fieldcat-No_Zero = 'X'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'TXT20'.
i_fieldcat-seltext_l = '科目名'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'LIFNR'.
i_fieldcat-seltext_l = 'Vendor'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'NAME1'.
i_fieldcat-seltext_l = '厂商名'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWSL'.
i_fieldcat-seltext_l = '币别'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWBT'.
i_fieldcat-seltext_l = '金额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'DMBTR'.
i_fieldcat-seltext_l = '本币金额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'AWKEY'.
i_fieldcat-seltext_l = '原始凭证'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'TCODE'.
i_fieldcat-seltext_l = '原始凭证交易码'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BSTAT'.
i_fieldcat-seltext_l = '凭证状态'.
i_fieldcat-no_Out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWBT1'.
i_fieldcat-seltext_l = '借方发生额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWBT2'.
i_fieldcat-seltext_l = '贷方发生额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BKTXT'.
i_fieldcat-seltext_l = '文本'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'XBLNR'.
i_fieldcat-seltext_l = '参照'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'USNAM'.
i_fieldcat-seltext_l = '用户名'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
ENDFORM. " Fields_Bulid
*&---------------------------------------------------------------------*
*& Form Process_BSEG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM process_BSEG .
DATA l_loop LIKE sy-tabix.
DATA L_LEN TYPE I.
SORT T_BSEG BY BUKRS GJAHR BELNR.
SORT T_BKPF BY BUKRS GJAHR BELNR.
LOOP AT T_BSEG.
L_LOOP = SY-TABIX.
IF T_BSEG-SHKZG = 'H'.
T_BSEG-DMBTR = T_BSEG-DMBTR * ( -1 ).
T_BSEG-PSWBT = T_BSEG-PSWBT * ( -1 ).
T_BSEG-PSWBT2 = T_BSEG-PSWBT * ( -1 ).
ENDIF.
IF T_BSEG-SHKZG = 'S'.
T_BSEG-PSWBT1 = T_BSEG-PSWBT .
ENDIF.
* Get G/L Account Name
READ TABLE T_SKAT WITH KEY SAKNR = T_BSEG-HKONT BINARY SEARCH.
IF SY-SUBRC = 0.
T_BSEG-TXT20 = T_SKAT-TXT20.
ENDIF.
* Get Vendor Name
IF T_BSEG-SAKNR <> '' AND T_BSEG-LIFNR <> ''.
T_BSEG-HKONT = T_BSEG-LIFNR.
READ TABLE T_LFA1 WITH KEY LIFNR = T_BSEG-LIFNR BINARY SEARCH.
IF SY-SUBRC = 0.
T_BSEG-NAME1 = T_LFA1-NAME1.
T_BSEG-TXT20 = T_LFA1-NAME1.
ENDIF.
ENDIF.
*Move Doc Header to Item
READ TABLE T_BKPF WITH KEY BUKRS = T_BSEG-BUKRS GJAHR = T_BSEG-GJAHR
BELNR = T_BSEG-BELNR BINARY SEARCH.
IF SY-SUBRC = 0.
T_BSEG-BLART = T_BKPF-BLART .
T_BSEG-BLDAT = T_BKPF-BLDAT .
T_BSEG-BUDAT = T_BKPF-BUDAT .
T_BSEG-TCODE = T_BKPF-TCODE .
T_BSEG-AWKEY = T_BKPF-AWKEY .
T_BSEG-BKTXT = T_BKPF-BKTXT .
T_BSEG-XBLNR = T_BKPF-XBLNR .
T_BSEG-USNAM = T_BKPF-USNAM .
ENDIF.
IF T_BSEG-AWKEY <>' '.
W_LEN = STRLEN( T_BSEG-AWKEY ) .
IF W_LEN = 10 OR W_LEN = 14 OR W_LEN = 18.
T_BSEG-AWKEY = T_BSEG-AWKEY(10).
ENDIF.
ENDIF.
MODIFY T_BSEG.
SY-TABIX = L_LOOP.
ENDLOOP.
ENDFORM. " Process_BSEG
输入(查询条件):公司代码:BKPF-BUKRS 凭证编号:BKPF-BELNR 会计年度:BKPF- GJAHR 凭证类型:BKPF- BLART 凭证日期:BKPF-BLDAT 过账日期:BKPF-BUDAT 用户名:BKPF-USNAM(新增加哦~)
表有:T_BKPF,T_BSEG,T_LFA1,T_SKAT
处理过程有:GET_BKPF()-->CHECK_BKPF()-->GET_BSEG()-->PROCESS_BSEG()-->EVENTS_BUILD()-->LAYOUT_BUILD()-->FIELDS_BUILD()-->DISPLAY_BUILD().
是不是很啰嗦啊,其实就是那么简单嘛,分析要求:取数据-->处理数据-->alv显示 其实很多ABAP的报表都是这样的一个套路。好了,其他的也就不多说了,直接上Code.
[plain] view plaincopyprint?
01.*&---------------------------------------------------------------------*
02.*& Report ZFI002
03.*&---------------------------------------------------------------------*
04.* Author : RobertLee
05.* Date : 2008.05.02
06.* Purpose: FI Doc Report using ALV For Finance
07.*
08.*&---------------------------------------------------------------------*
09.* Change : Jasson.Lee
10.* Date : 2012.02.14
11.* Purpose: FI Doc Report using ALV For Finance Add col
12.*
13.*----------------------------------------------------------------------
14.REPORT ZFI002.
15.
16.TABLES: BKPF,BSEG,LFA1,SKAT.
17.*--------------------------------
18.* Global Types
19.* Essential Declaration for ALV Display
20.*--------------------------------
21.TYPE-POOLS: slis.
22.*--------------------------------
23.* Global Internal Tables
24.*--------------------------------
25.DATA:
26. i_fieldcat_alv TYPE slis_t_fieldcat_alv ,
27. i_layout TYPE slis_layout_alv,
28. i_fieldcat TYPE slis_fieldcat_alv,
29. i_events TYPE slis_t_event,
30. w_events LIKE LINE OF i_events,
31. i_list_comments TYPE slis_t_listheader,
32. w_list_comments LIKE LINE OF i_list_comments,
33. w_repid LIKE sy-repid.
34.
35.DATA: BEGIN OF T_BKPF OCCURS 0,
36. BUKRS LIKE BKPF-BUKRS, "CoCode
37. BELNR LIKE BKPF-BELNR, "FI Doc
38. GJAHR LIKE BKPF-GJAHR, "Fiscal Year
39. BLART LIKE BKPF-BLART, "Doc Type
40. BLDAT LIKE BKPF-BLDAT, "Doc Date
41. BUDAT LIKE BKPF-BUDAT, "Posting Date
42. TCODE LIKE BKPF-TCODE, "Transaction Code
43. AWKEY LIKE BKPF-AWKEY, "Reference Doc
44. BSTAT LIKE BKPF-BSTAT, "Document Status
45. BKTXT LIKE BKPF-BKTXT, " txt
46. XBLNR LIKE BKPF-XBLNR, " ref
47. USNAM LIKE BKPF-USNAM, " user name
48. END OF T_BKPF.
49.
50.DATA: BEGIN OF T_BSEG OCCURS 0,
51. BUKRS LIKE BSEG-BUKRS, "CoCode
52. BELNR LIKE BSEG-BELNR, "FI Doc
53. GJAHR LIKE BSEG-GJAHR, "Fiscal Year
54. BUZEI LIKE BSEG-BUZEI, "Item
55. SHKZG LIKE BSEG-SHKZG, "Credit or Debit
56. PSWSL LIKE BSEG-PSWSL, "Cur
57. DMBTR like BSEG-DMBTR, "Local Amount
58. PSWBT LIKE BSEG-PSWBT, "Amount
59. SAKNR LIKE BSEG-SAKNR, "G/L Account Number
60. HKONT LIKE BSEG-HKONT, "General Ledger Account
61. LIFNR LIKE BSEG-LIFNR, "Account Number of Vendor or Creditor
62. BSCHL LIKE BSEG-BSCHL, "Posting Key
63.
64. BLART LIKE BKPF-BLART, "Doc Type
65. BLDAT LIKE BKPF-BLDAT, "Doc Date
66. BUDAT LIKE BKPF-BUDAT, "Posting Date
67. TCODE LIKE BKPF-TCODE, "Transaction Code
68. AWKEY LIKE BKPF-AWKEY, "Reference Doc
69. BSTAT LIKE BKPF-BSTAT, "Document status
70. TXT20 LIKE SKAT-TXT20, "G/L Acccount Name
71. NAME1 LIKE LFA1-NAME1, "Vendor Name
72. PSWBT1 LIKE BSEG-PSWBT, "Amount
73. PSWBT2 LIKE BSEG-PSWBT, "Amount
74. BKTXT LIKE BKPF-BKTXT, " txt
75. XBLNR LIKE BKPF-XBLNR, " ref
76. USNAM LIKE BKPF-USNAM, " user name
77. END OF T_BSEG.
78.
79.DATA: BEGIN OF T_LFA1 OCCURS 0,
80. LIFNR LIKE LFA1-LIFNR,
81. NAME1 LIKE LFA1-NAME1,
82. END OF T_LFA1.
83.DATA: BEGIN OF T_SKAT OCCURS 0,
84. SAKNR LIKE SKAT-SAKNR,
85. TXT20 LIKE SKAT-TXT20,
86. END OF T_SKAT.
87.DATA W_LEN TYPE I.
88.*--------------------------------
89.* Selection Screen
90.*--------------------------------
91.SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
92.SELECT-OPTIONS:
93. S_BUKRS FOR BKPF-BUKRS Default 5000, "CoCode
94. S_BELNR FOR BKPF-BELNR, "FI Doc
95. S_GJAHR FOR BKPF-GJAHR Default 2008, "Fiscal Year
96. S_BLART FOR BKPF-BLART, "Doc Type
97. S_BLDAT FOR BKPF-BLDAT, "Doc Date
98. S_BUDAT FOR BKPF-BUDAT, "Posting Date
99. S_USNAM FOR BKPF-USNAM.
100.SELECTION-SCREEN END OF BLOCK b1.
101.
102.*--------------------------------
103.* Initialization
104.*--------------------------------
105.INITIALIZATION.
106.
107.*--------------------------------
108.* At Selection Screen PBO
109.*--------------------------------
110.AT SELECTION-SCREEN OUTPUT.
111.
112.*--------------------------------
113.* Start of Selection
114.*--------------------------------
115.START-OF-SELECTION.
116. PERFORM GET_BKPF.
117. PERFORM CHECK_BKPF.
118. PERFORM GET_BSEG.
119. PERFORM Process_BSEG.
120. PERFORM Events_build.
121. PERFORM Layout_build.
122. PERFORM Fields_bulid.
123. PERFORM Display_data.
124.
125.END-OF-SELECTION.
126.*--------------------------------
127.* Top of Page
128.*--------------------------------
129.TOP-OF-PAGE.
130.
131.*--------------------------------
132.* At User Command
133.*--------------------------------
134.AT USER-COMMAND.
135.*--------------------------------
136.* At Line Selection
137.*--------------------------------
138.AT LINE-SELECTION.
139.
140.*&---------------------------------------------------------------------*
141.*& Form display_data
142.*&---------------------------------------------------------------------*
143.FORM display_data.
144.
145. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
146. EXPORTING
147. i_callback_user_command = 'USER_COMMAND' "用户触发事件
148.* i_callback_pf_status_set = 'PF_STATUS_SET'(001) "调用用户事件和按钮事件
149. i_callback_program = w_repid "当前程序
150. is_layout = i_layout "子函数layout_build填充的格式定义
151. it_fieldcat = i_fieldcat_alv[] "子函数fields填充的各列
152. it_events = i_events[]
153. i_save = 'A' "保存变式
154. TABLES
155. t_outtab = T_BSEG.
156.
157.ENDFORM. "display_data
158.*---------------------------------------------------------------------*
159.* FORM user_command *
160.*---------------------------------------------------------------------*
161.FORM USER_COMMAND USING i_ucomm LIKE sy-ucomm
162. selfield TYPE slis_selfield.
163. CASE i_ucomm.
164. WHEN '&IC1'.
165. CASE selfield-sel_tab_field.
166. WHEN '1-BELNR'.
167. SET PARAMETER ID 'BLN' FIELD selfield-value.
168. SET PARAMETER ID 'BUK' FIELD T_BSEG-BUKRS.
169. SET PARAMETER ID 'GJR' FIELD T_BSEG-GJAHR.
170. CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
171. ENDCASE.
172. WHEN OTHERS.
173. ENDCASE.
174.
175.ENDFORM. "callback_ucomm
176.
177.*&---------------------------------------------------------------------*
178.*& Form GET_BKPF
179.*&---------------------------------------------------------------------*
180.* text
181.*----------------------------------------------------------------------*
182.* --> p1 text
183.* <-- p2 text
184.*----------------------------------------------------------------------*
185.FORM GET_BKPF .
186.*Get Data From BKPF
187. SELECT BUKRS BELNR GJAHR BLART BLDAT BUDAT TCODE AWKEY BSTAT BKTXT XBLNR USNAM
188. INTO TABLE T_BKPF
189. FROM BKPF
190. WHERE BUKRS IN S_BUKRS AND BELNR IN S_BELNR AND BLDAT IN S_BLDAT
191. and GJAHR in S_GJAHR and BLART in S_BLART AND BUDAT IN S_BUDAT AND USNAM IN S_USNAM .
192.ENDFORM. " GET_BKPF
193.*&---------------------------------------------------------------------*
194.*& Form CHECK_BKPF
195.*&---------------------------------------------------------------------*
196.* text
197.*----------------------------------------------------------------------*
198.* --> p1 text
199.* <-- p2 text
200.*----------------------------------------------------------------------*
201.FORM CHECK_BKPF .
202. IF T_BKPF[] IS INITIAL.
203. MESSAGE I000(ZMsg) with '没找到对应的数据,请更改查询条件'.
204. LEAVE LIST-PROCESSING.
205. ENDIF.
206.
207.ENDFORM. " CHECK_BKPF
208.*&---------------------------------------------------------------------*
209.*& Form GET_BSEG
210.*&---------------------------------------------------------------------*
211.FORM GET_BSEG.
212.*Get Data From BSEG
213. SELECT BUKRS BELNR GJAHR BUZEI SHKZG PSWSL DMBTR PSWBT SAKNR HKONT LIFNR BSCHL
214. INTO CORRESPONDING FIELDS OF TABLE T_BSEG
215. FROM BSEG
216. FOR ALL ENTRIES IN T_BKPF
217. WHERE BUKRS = T_BKPF-BUKRS AND BELNR = T_BKPF-BELNR AND GJAHR = T_BKPF-GJAHR.
218.*Get G/L Account name from skat
219. SELECT SAKNR TXT20
220. INTO TABLE T_SKAT
221. FROM SKAT
222. WHERE SPRAS = SY-LANGU AND KTOPL = 'INT'.
223.*Get Vendor Info from LFA1
224. SELECT LIFNR NAME1
225. INTO TABLE T_LFA1
226. FROM LFA1
227. FOR ALL ENTRIES IN T_BSEG
228. WHERE LIFNR = T_BSEG-LIFNR.
229.ENDFORM. "GET_BSEG
230.*&---------------------------------------------------------------------*
231.*& Form events_build
232.*&---------------------------------------------------------------------*
233.FORM events_build.
234.
235. CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
236. EXPORTING
237. i_list_type = 0
238. IMPORTING
239. et_events = i_events.
240.
241.* READ TABLE i_events WITH KEY name = 'TOP_OF_PAGE' INTO w_events.
242.* IF sy-subrc = 0.
243.* MOVE 'ALV_TOP_OF_PAGE' TO w_events-form.
244.* MODIFY i_events FROM w_events INDEX sy-tabix.
245.* ENDIF.
246.*
247.* READ TABLE i_events WITH KEY name = 'END_OF_LIST' INTO w_events.
248.* IF sy-subrc = 0.
249.* MOVE 'ALV_END_OF_LIST' TO w_events-form.
250.* MODIFY i_events FROM w_events INDEX sy-tabix.
251.* ENDIF.
252.
253. READ TABLE i_events WITH KEY name = 'USER_COMMAND' INTO w_events.
254. IF sy-subrc = 0.
255. MOVE 'USER_COMMAND' TO w_events-form.
256. MODIFY i_events FROM w_events INDEX sy-tabix.
257. ENDIF.
258.
259.ENDFORM. "events_build
260.
261.*&---------------------------------------------------------------------*
262.*& Form layout_build
263.*&---------------------------------------------------------------------*
264.FORM layout_build.
265.* i_layout-detail_popup = 'X'. "弹出详细信息窗口
266.* i-layout-no_vline = 'X'. "设置列间隔线
267. i_layout-info_fieldname = 'COLOR'. "颜色值
268. i_layout-colwidth_optimize = 'X'. "优化列宽选项
269. i_layout-detail_initial_lines = 'X'.
270. i_layout-detail_titlebar = '凭证查询报表'.
271. i_layout-no_colhead =' '.
272. w_repid = sy-repid.
273.
274.ENDFORM. "layout_build
275.
276.
277.*&---------------------------------------------------------------------*
278.*& Form Fields_Bulid
279.*&---------------------------------------------------------------------*
280.* text
281.*----------------------------------------------------------------------*
282.* --> p1 text
283.* <-- p2 text
284.*----------------------------------------------------------------------*
285.FORM fields_bulid .
286. DATA tmp_pos TYPE i.
287. REFRESH i_fieldcat_alv.
288. CLEAR i_fieldcat.
289.
290. tmp_pos = 1.
291. i_fieldcat-col_pos = tmp_pos.
292. i_fieldcat-fieldname = 'BLART'.
293. i_fieldcat-seltext_l = '凭证类型'.
294. i_fieldcat-key = 'X'.
295. APPEND i_fieldcat TO i_fieldcat_alv.
296. CLEAR i_fieldcat.
297.
298. tmp_pos = tmp_pos + 1.
299. i_fieldcat-col_pos = tmp_pos.
300. i_fieldcat-fieldname = 'BUKRS'.
301. i_fieldcat-seltext_l = '公司代码'.
302. i_fieldcat-outputlen = '15'.
303. i_fieldcat-no_zero = 'X'.
304. i_fieldcat-key = 'X'.
305. APPEND i_fieldcat TO i_fieldcat_alv.
306. CLEAR i_fieldcat.
307.
308. tmp_pos = tmp_pos + 1.
309. i_fieldcat-col_pos = tmp_pos.
310. i_fieldcat-fieldname = 'BELNR'.
311. i_fieldcat-seltext_l = '会计凭证号'.
312. i_fieldcat-outputlen = '10'.
313. APPEND i_fieldcat TO i_fieldcat_alv.
314. CLEAR i_fieldcat.
315.
316. tmp_pos = tmp_pos + 1.
317. i_fieldcat-col_pos = tmp_pos.
318. i_fieldcat-fieldname = 'BLDAT'.
319. i_fieldcat-seltext_l = '凭证日期'.
320. APPEND i_fieldcat TO i_fieldcat_alv.
321. CLEAR i_fieldcat.
322.
323. tmp_pos = tmp_pos + 1.
324. i_fieldcat-col_pos = tmp_pos.
325. i_fieldcat-fieldname = 'BUDAT'.
326. i_fieldcat-seltext_l = '过账日期'.
327. APPEND i_fieldcat TO i_fieldcat_alv.
328. CLEAR i_fieldcat.
329.
330. tmp_pos = tmp_pos + 1.
331. i_fieldcat-col_pos = tmp_pos.
332. i_fieldcat-fieldname = 'GJAHR'.
333. i_fieldcat-seltext_l = '年度'.
334. APPEND i_fieldcat TO i_fieldcat_alv.
335. CLEAR i_fieldcat.
336.
337. tmp_pos = tmp_pos + 1.
338. i_fieldcat-col_pos = tmp_pos.
339. i_fieldcat-fieldname = 'BUZEI'.
340. i_fieldcat-seltext_l = '项目'.
341. APPEND i_fieldcat TO i_fieldcat_alv.
342. CLEAR i_fieldcat.
343.
344.
345. tmp_pos = tmp_pos + 1.
346. i_fieldcat-col_pos = tmp_pos.
347. i_fieldcat-fieldname = 'BSCHL'.
348. i_fieldcat-seltext_l = 'PK'.
349. APPEND i_fieldcat TO i_fieldcat_alv.
350. CLEAR i_fieldcat.
351.
352. tmp_pos = tmp_pos + 1.
353. i_fieldcat-col_pos = tmp_pos.
354. i_fieldcat-fieldname = 'SHKZG'.
355. i_fieldcat-seltext_l = '借方/贷方'.
356. i_fieldcat-no_out = 'X'.
357. APPEND i_fieldcat TO i_fieldcat_alv.
358. CLEAR i_fieldcat.
359.
360. tmp_pos = tmp_pos + 1.
361. i_fieldcat-col_pos = tmp_pos.
362. i_fieldcat-fieldname = 'HKONT'.
363. i_fieldcat-seltext_l = '科目'.
364. i_fieldcat-No_Zero = 'X'.
365. APPEND i_fieldcat TO i_fieldcat_alv.
366. CLEAR i_fieldcat.
367.
368. tmp_pos = tmp_pos + 1.
369. i_fieldcat-col_pos = tmp_pos.
370. i_fieldcat-fieldname = 'SAKNR'.
371. i_fieldcat-seltext_l = '总帐科目'.
372. i_fieldcat-No_Zero = 'X'.
373. i_fieldcat-no_out = 'X'.
374. APPEND i_fieldcat TO i_fieldcat_alv.
375. CLEAR i_fieldcat.
376.
377. tmp_pos = tmp_pos + 1.
378. i_fieldcat-col_pos = tmp_pos.
379. i_fieldcat-fieldname = 'TXT20'.
380. i_fieldcat-seltext_l = '科目名'.
381. APPEND i_fieldcat TO i_fieldcat_alv.
382. CLEAR i_fieldcat.
383.
384. tmp_pos = tmp_pos + 1.
385. i_fieldcat-col_pos = tmp_pos.
386. i_fieldcat-fieldname = 'LIFNR'.
387. i_fieldcat-seltext_l = 'Vendor'.
388. i_fieldcat-no_out = 'X'.
389. APPEND i_fieldcat TO i_fieldcat_alv.
390. CLEAR i_fieldcat.
391.
392. tmp_pos = tmp_pos + 1.
393. i_fieldcat-col_pos = tmp_pos.
394. i_fieldcat-fieldname = 'NAME1'.
395. i_fieldcat-seltext_l = '厂商名'.
396. i_fieldcat-no_out = 'X'.
397. APPEND i_fieldcat TO i_fieldcat_alv.
398. CLEAR i_fieldcat.
399.
400. tmp_pos = tmp_pos + 1.
401. i_fieldcat-col_pos = tmp_pos.
402. i_fieldcat-fieldname = 'PSWSL'.
403. i_fieldcat-seltext_l = '币别'.
404. APPEND i_fieldcat TO i_fieldcat_alv.
405. CLEAR i_fieldcat.
406.
407. tmp_pos = tmp_pos + 1.
408. i_fieldcat-col_pos = tmp_pos.
409. i_fieldcat-fieldname = 'PSWBT'.
410. i_fieldcat-seltext_l = '金额'.
411. APPEND i_fieldcat TO i_fieldcat_alv.
412. CLEAR i_fieldcat.
413.
414. tmp_pos = tmp_pos + 1.
415. i_fieldcat-col_pos = tmp_pos.
416. i_fieldcat-fieldname = 'DMBTR'.
417. i_fieldcat-seltext_l = '本币金额'.
418. APPEND i_fieldcat TO i_fieldcat_alv.
419. CLEAR i_fieldcat.
420.
421. tmp_pos = tmp_pos + 1.
422. i_fieldcat-col_pos = tmp_pos.
423. i_fieldcat-fieldname = 'AWKEY'.
424. i_fieldcat-seltext_l = '原始凭证'.
425. APPEND i_fieldcat TO i_fieldcat_alv.
426. CLEAR i_fieldcat.
427.
428. tmp_pos = tmp_pos + 1.
429. i_fieldcat-col_pos = tmp_pos.
430. i_fieldcat-fieldname = 'TCODE'.
431. i_fieldcat-seltext_l = '原始凭证交易码'.
432. APPEND i_fieldcat TO i_fieldcat_alv.
433. CLEAR i_fieldcat.
434.
435. tmp_pos = tmp_pos + 1.
436. i_fieldcat-col_pos = tmp_pos.
437. i_fieldcat-fieldname = 'BSTAT'.
438. i_fieldcat-seltext_l = '凭证状态'.
439. i_fieldcat-no_Out = 'X'.
440. APPEND i_fieldcat TO i_fieldcat_alv.
441. CLEAR i_fieldcat.
442.
443. tmp_pos = tmp_pos + 1.
444. i_fieldcat-col_pos = tmp_pos.
445. i_fieldcat-fieldname = 'PSWBT1'.
446. i_fieldcat-seltext_l = '借方发生额'.
447. APPEND i_fieldcat TO i_fieldcat_alv.
448. CLEAR i_fieldcat.
449.
450. tmp_pos = tmp_pos + 1.
451. i_fieldcat-col_pos = tmp_pos.
452. i_fieldcat-fieldname = 'PSWBT2'.
453. i_fieldcat-seltext_l = '贷方发生额'.
454. APPEND i_fieldcat TO i_fieldcat_alv.
455. CLEAR i_fieldcat.
456.
457. tmp_pos = tmp_pos + 1.
458. i_fieldcat-col_pos = tmp_pos.
459. i_fieldcat-fieldname = 'BKTXT'.
460. i_fieldcat-seltext_l = '文本'.
461. APPEND i_fieldcat TO i_fieldcat_alv.
462. CLEAR i_fieldcat.
463.
464. tmp_pos = tmp_pos + 1.
465. i_fieldcat-col_pos = tmp_pos.
466. i_fieldcat-fieldname = 'XBLNR'.
467. i_fieldcat-seltext_l = '参照'.
468. APPEND i_fieldcat TO i_fieldcat_alv.
469. CLEAR i_fieldcat.
470.
471. tmp_pos = tmp_pos + 1.
472. i_fieldcat-col_pos = tmp_pos.
473. i_fieldcat-fieldname = 'USNAM'.
474. i_fieldcat-seltext_l = '用户名'.
475. APPEND i_fieldcat TO i_fieldcat_alv.
476. CLEAR i_fieldcat.
477.
478.
479.ENDFORM. " Fields_Bulid
480.*&---------------------------------------------------------------------*
481.*& Form Process_BSEG
482.*&---------------------------------------------------------------------*
483.* text
484.*----------------------------------------------------------------------*
485.* --> p1 text
486.* <-- p2 text
487.*----------------------------------------------------------------------*
488.FORM process_BSEG .
489. DATA l_loop LIKE sy-tabix.
490. DATA L_LEN TYPE I.
491. SORT T_BSEG BY BUKRS GJAHR BELNR.
492. SORT T_BKPF BY BUKRS GJAHR BELNR.
493. LOOP AT T_BSEG.
494. L_LOOP = SY-TABIX.
495. IF T_BSEG-SHKZG = 'H'.
496. T_BSEG-DMBTR = T_BSEG-DMBTR * ( -1 ).
497. T_BSEG-PSWBT = T_BSEG-PSWBT * ( -1 ).
498. T_BSEG-PSWBT2 = T_BSEG-PSWBT * ( -1 ).
499. ENDIF.
500. IF T_BSEG-SHKZG = 'S'.
501. T_BSEG-PSWBT1 = T_BSEG-PSWBT .
502. ENDIF.
503.* Get G/L Account Name
504. READ TABLE T_SKAT WITH KEY SAKNR = T_BSEG-HKONT BINARY SEARCH.
505. IF SY-SUBRC = 0.
506. T_BSEG-TXT20 = T_SKAT-TXT20.
507. ENDIF.
508.* Get Vendor Name
509. IF T_BSEG-SAKNR <> '' AND T_BSEG-LIFNR <> ''.
510. T_BSEG-HKONT = T_BSEG-LIFNR.
511. READ TABLE T_LFA1 WITH KEY LIFNR = T_BSEG-LIFNR BINARY SEARCH.
512. IF SY-SUBRC = 0.
513. T_BSEG-NAME1 = T_LFA1-NAME1.
514. T_BSEG-TXT20 = T_LFA1-NAME1.
515. ENDIF.
516. ENDIF.
517.*Move Doc Header to Item
518. READ TABLE T_BKPF WITH KEY BUKRS = T_BSEG-BUKRS GJAHR = T_BSEG-GJAHR
519. BELNR = T_BSEG-BELNR BINARY SEARCH.
520. IF SY-SUBRC = 0.
521. T_BSEG-BLART = T_BKPF-BLART .
522. T_BSEG-BLDAT = T_BKPF-BLDAT .
523. T_BSEG-BUDAT = T_BKPF-BUDAT .
524. T_BSEG-TCODE = T_BKPF-TCODE .
525. T_BSEG-AWKEY = T_BKPF-AWKEY .
526. T_BSEG-BKTXT = T_BKPF-BKTXT .
527. T_BSEG-XBLNR = T_BKPF-XBLNR .
528. T_BSEG-USNAM = T_BKPF-USNAM .
529. ENDIF.
530. IF T_BSEG-AWKEY <>' '.
531. W_LEN = STRLEN( T_BSEG-AWKEY ) .
532. IF W_LEN = 10 OR W_LEN = 14 OR W_LEN = 18.
533. T_BSEG-AWKEY = T_BSEG-AWKEY(10).
534. ENDIF.
535. ENDIF.
536.
537. MODIFY T_BSEG.
538. SY-TABIX = L_LOOP.
539. ENDLOOP.
540.ENDFORM. " Process_BSEG
*&---------------------------------------------------------------------*
*& Report ZFI002
*&---------------------------------------------------------------------*
* Author : RobertLee
* Date : 2008.05.02
* Purpose: FI Doc Report using ALV For Finance
*
*&---------------------------------------------------------------------*
* Change : Jasson.Lee
* Date : 2012.02.14
* Purpose: FI Doc Report using ALV For Finance Add col
*
*----------------------------------------------------------------------
REPORT ZFI002.
TABLES: BKPF,BSEG,LFA1,SKAT.
*--------------------------------
* Global Types
* Essential Declaration for ALV Display
*--------------------------------
TYPE-POOLS: slis.
*--------------------------------
* Global Internal Tables
*--------------------------------
DATA:
i_fieldcat_alv TYPE slis_t_fieldcat_alv ,
i_layout TYPE slis_layout_alv,
i_fieldcat TYPE slis_fieldcat_alv,
i_events TYPE slis_t_event,
w_events LIKE LINE OF i_events,
i_list_comments TYPE slis_t_listheader,
w_list_comments LIKE LINE OF i_list_comments,
w_repid LIKE sy-repid.
DATA: BEGIN OF T_BKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS, "CoCode
BELNR LIKE BKPF-BELNR, "FI Doc
GJAHR LIKE BKPF-GJAHR, "Fiscal Year
BLART LIKE BKPF-BLART, "Doc Type
BLDAT LIKE BKPF-BLDAT, "Doc Date
BUDAT LIKE BKPF-BUDAT, "Posting Date
TCODE LIKE BKPF-TCODE, "Transaction Code
AWKEY LIKE BKPF-AWKEY, "Reference Doc
BSTAT LIKE BKPF-BSTAT, "Document Status
BKTXT LIKE BKPF-BKTXT, " txt
XBLNR LIKE BKPF-XBLNR, " ref
USNAM LIKE BKPF-USNAM, " user name
END OF T_BKPF.
DATA: BEGIN OF T_BSEG OCCURS 0,
BUKRS LIKE BSEG-BUKRS, "CoCode
BELNR LIKE BSEG-BELNR, "FI Doc
GJAHR LIKE BSEG-GJAHR, "Fiscal Year
BUZEI LIKE BSEG-BUZEI, "Item
SHKZG LIKE BSEG-SHKZG, "Credit or Debit
PSWSL LIKE BSEG-PSWSL, "Cur
DMBTR like BSEG-DMBTR, "Local Amount
PSWBT LIKE BSEG-PSWBT, "Amount
SAKNR LIKE BSEG-SAKNR, "G/L Account Number
HKONT LIKE BSEG-HKONT, "General Ledger Account
LIFNR LIKE BSEG-LIFNR, "Account Number of Vendor or Creditor
BSCHL LIKE BSEG-BSCHL, "Posting Key
BLART LIKE BKPF-BLART, "Doc Type
BLDAT LIKE BKPF-BLDAT, "Doc Date
BUDAT LIKE BKPF-BUDAT, "Posting Date
TCODE LIKE BKPF-TCODE, "Transaction Code
AWKEY LIKE BKPF-AWKEY, "Reference Doc
BSTAT LIKE BKPF-BSTAT, "Document status
TXT20 LIKE SKAT-TXT20, "G/L Acccount Name
NAME1 LIKE LFA1-NAME1, "Vendor Name
PSWBT1 LIKE BSEG-PSWBT, "Amount
PSWBT2 LIKE BSEG-PSWBT, "Amount
BKTXT LIKE BKPF-BKTXT, " txt
XBLNR LIKE BKPF-XBLNR, " ref
USNAM LIKE BKPF-USNAM, " user name
END OF T_BSEG.
DATA: BEGIN OF T_LFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF T_LFA1.
DATA: BEGIN OF T_SKAT OCCURS 0,
SAKNR LIKE SKAT-SAKNR,
TXT20 LIKE SKAT-TXT20,
END OF T_SKAT.
DATA W_LEN TYPE I.
*--------------------------------
* Selection Screen
*--------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
S_BUKRS FOR BKPF-BUKRS Default 5000, "CoCode
S_BELNR FOR BKPF-BELNR, "FI Doc
S_GJAHR FOR BKPF-GJAHR Default 2008, "Fiscal Year
S_BLART FOR BKPF-BLART, "Doc Type
S_BLDAT FOR BKPF-BLDAT, "Doc Date
S_BUDAT FOR BKPF-BUDAT, "Posting Date
S_USNAM FOR BKPF-USNAM.
SELECTION-SCREEN END OF BLOCK b1.
*--------------------------------
* Initialization
*--------------------------------
INITIALIZATION.
*--------------------------------
* At Selection Screen PBO
*--------------------------------
AT SELECTION-SCREEN OUTPUT.
*--------------------------------
* Start of Selection
*--------------------------------
START-OF-SELECTION.
PERFORM GET_BKPF.
PERFORM CHECK_BKPF.
PERFORM GET_BSEG.
PERFORM Process_BSEG.
PERFORM Events_build.
PERFORM Layout_build.
PERFORM Fields_bulid.
PERFORM Display_data.
END-OF-SELECTION.
*--------------------------------
* Top of Page
*--------------------------------
TOP-OF-PAGE.
*--------------------------------
* At User Command
*--------------------------------
AT USER-COMMAND.
*--------------------------------
* At Line Selection
*--------------------------------
AT LINE-SELECTION.
*&---------------------------------------------------------------------*
*& Form display_data
*&---------------------------------------------------------------------*
FORM display_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_user_command = 'USER_COMMAND' "用户触发事件
* i_callback_pf_status_set = 'PF_STATUS_SET'(001) "调用用户事件和按钮事件
i_callback_program = w_repid "当前程序
is_layout = i_layout "子函数layout_build填充的格式定义
it_fieldcat = i_fieldcat_alv[] "子函数fields填充的各列
it_events = i_events[]
i_save = 'A' "保存变式
TABLES
t_outtab = T_BSEG.
ENDFORM. "display_data
*---------------------------------------------------------------------*
* FORM user_command *
*---------------------------------------------------------------------*
FORM USER_COMMAND USING i_ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE i_ucomm.
WHEN '&IC1'.
CASE selfield-sel_tab_field.
WHEN '1-BELNR'.
SET PARAMETER ID 'BLN' FIELD selfield-value.
SET PARAMETER ID 'BUK' FIELD T_BSEG-BUKRS.
SET PARAMETER ID 'GJR' FIELD T_BSEG-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDCASE.
WHEN OTHERS.
ENDCASE.
ENDFORM. "callback_ucomm
*&---------------------------------------------------------------------*
*& Form GET_BKPF
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_BKPF .
*Get Data From BKPF
SELECT BUKRS BELNR GJAHR BLART BLDAT BUDAT TCODE AWKEY BSTAT BKTXT XBLNR USNAM
INTO TABLE T_BKPF
FROM BKPF
WHERE BUKRS IN S_BUKRS AND BELNR IN S_BELNR AND BLDAT IN S_BLDAT
and GJAHR in S_GJAHR and BLART in S_BLART AND BUDAT IN S_BUDAT AND USNAM IN S_USNAM .
ENDFORM. " GET_BKPF
*&---------------------------------------------------------------------*
*& Form CHECK_BKPF
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CHECK_BKPF .
IF T_BKPF[] IS INITIAL.
MESSAGE I000(ZMsg) with '没找到对应的数据,请更改查询条件'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " CHECK_BKPF
*&---------------------------------------------------------------------*
*& Form GET_BSEG
*&---------------------------------------------------------------------*
FORM GET_BSEG.
*Get Data From BSEG
SELECT BUKRS BELNR GJAHR BUZEI SHKZG PSWSL DMBTR PSWBT SAKNR HKONT LIFNR BSCHL
INTO CORRESPONDING FIELDS OF TABLE T_BSEG
FROM BSEG
FOR ALL ENTRIES IN T_BKPF
WHERE BUKRS = T_BKPF-BUKRS AND BELNR = T_BKPF-BELNR AND GJAHR = T_BKPF-GJAHR.
*Get G/L Account name from skat
SELECT SAKNR TXT20
INTO TABLE T_SKAT
FROM SKAT
WHERE SPRAS = SY-LANGU AND KTOPL = 'INT'.
*Get Vendor Info from LFA1
SELECT LIFNR NAME1
INTO TABLE T_LFA1
FROM LFA1
FOR ALL ENTRIES IN T_BSEG
WHERE LIFNR = T_BSEG-LIFNR.
ENDFORM. "GET_BSEG
*&---------------------------------------------------------------------*
*& Form events_build
*&---------------------------------------------------------------------*
FORM events_build.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_events.
* READ TABLE i_events WITH KEY name = 'TOP_OF_PAGE' INTO w_events.
* IF sy-subrc = 0.
* MOVE 'ALV_TOP_OF_PAGE' TO w_events-form.
* MODIFY i_events FROM w_events INDEX sy-tabix.
* ENDIF.
*
* READ TABLE i_events WITH KEY name = 'END_OF_LIST' INTO w_events.
* IF sy-subrc = 0.
* MOVE 'ALV_END_OF_LIST' TO w_events-form.
* MODIFY i_events FROM w_events INDEX sy-tabix.
* ENDIF.
READ TABLE i_events WITH KEY name = 'USER_COMMAND' INTO w_events.
IF sy-subrc = 0.
MOVE 'USER_COMMAND' TO w_events-form.
MODIFY i_events FROM w_events INDEX sy-tabix.
ENDIF.
ENDFORM. "events_build
*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
FORM layout_build.
* i_layout-detail_popup = 'X'. "弹出详细信息窗口
* i-layout-no_vline = 'X'. "设置列间隔线
i_layout-info_fieldname = 'COLOR'. "颜色值
i_layout-colwidth_optimize = 'X'. "优化列宽选项
i_layout-detail_initial_lines = 'X'.
i_layout-detail_titlebar = '凭证查询报表'.
i_layout-no_colhead =' '.
w_repid = sy-repid.
ENDFORM. "layout_build
*&---------------------------------------------------------------------*
*& Form Fields_Bulid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fields_bulid .
DATA tmp_pos TYPE i.
REFRESH i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BLART'.
i_fieldcat-seltext_l = '凭证类型'.
i_fieldcat-key = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BUKRS'.
i_fieldcat-seltext_l = '公司代码'.
i_fieldcat-outputlen = '15'.
i_fieldcat-no_zero = 'X'.
i_fieldcat-key = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BELNR'.
i_fieldcat-seltext_l = '会计凭证号'.
i_fieldcat-outputlen = '10'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BLDAT'.
i_fieldcat-seltext_l = '凭证日期'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BUDAT'.
i_fieldcat-seltext_l = '过账日期'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'GJAHR'.
i_fieldcat-seltext_l = '年度'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BUZEI'.
i_fieldcat-seltext_l = '项目'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BSCHL'.
i_fieldcat-seltext_l = 'PK'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'SHKZG'.
i_fieldcat-seltext_l = '借方/贷方'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'HKONT'.
i_fieldcat-seltext_l = '科目'.
i_fieldcat-No_Zero = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'SAKNR'.
i_fieldcat-seltext_l = '总帐科目'.
i_fieldcat-No_Zero = 'X'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'TXT20'.
i_fieldcat-seltext_l = '科目名'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'LIFNR'.
i_fieldcat-seltext_l = 'Vendor'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'NAME1'.
i_fieldcat-seltext_l = '厂商名'.
i_fieldcat-no_out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWSL'.
i_fieldcat-seltext_l = '币别'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWBT'.
i_fieldcat-seltext_l = '金额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'DMBTR'.
i_fieldcat-seltext_l = '本币金额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'AWKEY'.
i_fieldcat-seltext_l = '原始凭证'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'TCODE'.
i_fieldcat-seltext_l = '原始凭证交易码'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BSTAT'.
i_fieldcat-seltext_l = '凭证状态'.
i_fieldcat-no_Out = 'X'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWBT1'.
i_fieldcat-seltext_l = '借方发生额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'PSWBT2'.
i_fieldcat-seltext_l = '贷方发生额'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'BKTXT'.
i_fieldcat-seltext_l = '文本'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'XBLNR'.
i_fieldcat-seltext_l = '参照'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
tmp_pos = tmp_pos + 1.
i_fieldcat-col_pos = tmp_pos.
i_fieldcat-fieldname = 'USNAM'.
i_fieldcat-seltext_l = '用户名'.
APPEND i_fieldcat TO i_fieldcat_alv.
CLEAR i_fieldcat.
ENDFORM. " Fields_Bulid
*&---------------------------------------------------------------------*
*& Form Process_BSEG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM process_BSEG .
DATA l_loop LIKE sy-tabix.
DATA L_LEN TYPE I.
SORT T_BSEG BY BUKRS GJAHR BELNR.
SORT T_BKPF BY BUKRS GJAHR BELNR.
LOOP AT T_BSEG.
L_LOOP = SY-TABIX.
IF T_BSEG-SHKZG = 'H'.
T_BSEG-DMBTR = T_BSEG-DMBTR * ( -1 ).
T_BSEG-PSWBT = T_BSEG-PSWBT * ( -1 ).
T_BSEG-PSWBT2 = T_BSEG-PSWBT * ( -1 ).
ENDIF.
IF T_BSEG-SHKZG = 'S'.
T_BSEG-PSWBT1 = T_BSEG-PSWBT .
ENDIF.
* Get G/L Account Name
READ TABLE T_SKAT WITH KEY SAKNR = T_BSEG-HKONT BINARY SEARCH.
IF SY-SUBRC = 0.
T_BSEG-TXT20 = T_SKAT-TXT20.
ENDIF.
* Get Vendor Name
IF T_BSEG-SAKNR <> '' AND T_BSEG-LIFNR <> ''.
T_BSEG-HKONT = T_BSEG-LIFNR.
READ TABLE T_LFA1 WITH KEY LIFNR = T_BSEG-LIFNR BINARY SEARCH.
IF SY-SUBRC = 0.
T_BSEG-NAME1 = T_LFA1-NAME1.
T_BSEG-TXT20 = T_LFA1-NAME1.
ENDIF.
ENDIF.
*Move Doc Header to Item
READ TABLE T_BKPF WITH KEY BUKRS = T_BSEG-BUKRS GJAHR = T_BSEG-GJAHR
BELNR = T_BSEG-BELNR BINARY SEARCH.
IF SY-SUBRC = 0.
T_BSEG-BLART = T_BKPF-BLART .
T_BSEG-BLDAT = T_BKPF-BLDAT .
T_BSEG-BUDAT = T_BKPF-BUDAT .
T_BSEG-TCODE = T_BKPF-TCODE .
T_BSEG-AWKEY = T_BKPF-AWKEY .
T_BSEG-BKTXT = T_BKPF-BKTXT .
T_BSEG-XBLNR = T_BKPF-XBLNR .
T_BSEG-USNAM = T_BKPF-USNAM .
ENDIF.
IF T_BSEG-AWKEY <>' '.
W_LEN = STRLEN( T_BSEG-AWKEY ) .
IF W_LEN = 10 OR W_LEN = 14 OR W_LEN = 18.
T_BSEG-AWKEY = T_BSEG-AWKEY(10).
ENDIF.
ENDIF.
MODIFY T_BSEG.
SY-TABIX = L_LOOP.
ENDLOOP.
ENDFORM. " Process_BSEG
发表评论
-
SAP 物料差异分析
2013-03-04 13:58 5460我们知道SAP中,当物料 ... -
CO中的几类成本要素
2012-10-07 15:46 1621成本要素分为初级成本 ... -
ABAP:SAP报表性能的优化
2012-08-06 16:46 2296原文地址:http://blog.chinaunix.net/ ... -
ECC 6.0 New GL Functionality and General FAQ
2012-07-16 16:12 2448ECC 6.0 New GL Functionality 1 ... -
SAP固定资产的几个相关日期
2012-06-19 10:28 2391[转帖]SAP固定资产的几 ... -
SAP BSEG
2012-06-13 16:12 4383BSAS+BSIS+BSAK+BSIK+BSAD+BSID = ... -
SAP GR/IR
2012-04-20 09:35 1447GR/IR 1,采购的an incoming invoice当 ... -
初级成本要素和次级成本要素区别
2012-02-06 11:20 1476初级成本要素与次级成本要素。SAP除总帐的及时集成外,它的另一 ... -
SAP替代和规则
2011-12-19 09:51 4618后台路径:IMG----财务会计(新)——工具——会计凭证中的 ... -
FI---FI tables的结构和关系总览图
2011-11-22 13:55 1004FI---FI tables的结构和关 ... -
IT零起点转FICO学习路线(转)
2011-09-06 13:50 2527IT零起点转FICO学习路线 ... -
[转]FI顾问基础知识
2011-09-03 16:20 942[转]FI顾问基础知识 最 ... -
IMG设置
2011-09-03 15:56 1249IMG设置 一、Basis基本操作 SA02 ... -
SAP自学(转)
2011-08-25 13:19 1146自学SAP三道坎 ~~~~ ... -
FICO学习计划(转)
2011-08-22 17:05 1504<div class="note-header ...
相关推荐
- **CPUDT**/**CPUTM**:会计凭证输入日期及时间,记录了物料凭证创建的时间。 - **USNAM**:用户名,执行该物料凭证操作的用户。 - **TCODE2**:事务代码,表示执行物料凭证操作的具体事务代码。 2. **MSEG...
SAP SQVI(快速查看器)是一种在SAP系统中用于快速创建和执行多表联查的工具,尤其适用于FICO(财务会计和控制)领域的数据查询。SQVI虽然有一些限制,比如创建的对象只能由创建者使用,且无法在不同环境中传输,但...
**SAP FB04**是SAP系统中的一个关键交易代码,主要用于查看和修改已存在的会计凭证。此功能对于财务人员来说至关重要,因为它允许用户追踪对特定凭证进行的所有更改,包括更改的时间、执行更改的人以及具体的更改...
- **查看预制凭证**:FBV3和ZFBV3事务码用于查看和批量处理预制的会计凭证,有助于自动化财务流程。 - **打印凭证**:ZFIR001事务码支持打印凭证,包括外币交易,方便纸质记录和归档。 3. 科目余额表: - **总账...
值得注意的是,尽管FBD1会生成一个样本凭证,但这只是一个预览,并不会立即产生实际的会计凭证。 **查看周期性凭证(F.15)** 使用事务代码F.15,你可以查看周期性凭证的清单。这个清单显示所有已定义的周期性凭证...
SAP Report Painter报表编制用户操作手册 本文档旨在帮助用户学习和掌握SAP Report Painter报表编制系统操作流程和方法。下面是本手册的详细知识点: 1. 操作说明 * 保存按钮:保存您在数据库中的工作。 * 返回...
本文档详细介绍了SAP系统中会计凭证配置的相关知识点,包括功能范围、业务范围、会计年度变式、过账期间设置和会计凭证编号等内容。通过这些知识点的学习,读者可以更好地理解如何在SAP系统中进行会计配置,并根据...
### SAP设定物料凭证结算期间详解 #### 一、概述 SAP系统中,**设定物料凭证结算期间**是一项重要的财务管理活动,它涉及到物料管理(MM)模块中的账务处理流程。通过设定结算期间,企业可以确保物料凭证按照正确...
- 通过SAP菜单启动:会计 > 财务会计 > 总账 > 过账 FV50 - 编辑器停放总账凭证。 #### 六、操作步骤 1. **启动交易**:通过菜单路径或直接输入事务代码FV50来启动此交易。 - 在SAP Easy Access界面中双击相应选项...
通过集成的报表和分析工具,SAP财务系统为管理层提供实时、准确的财务数据,支持决策制定。这些数据涵盖了收入、支出、利润、现金流等关键指标,有助于企业快速响应市场变化,做出明智的商业决策。 4. 国际性的应用...
审批会计核算的开票凭证报表是后勤系统报表查询中的一个重要组成部分,提供了审批会计核算的开票凭证信息,包括开票凭证的编号、名称、数量和单位等信息。该报表可以帮助用户快速地查询和分析审批会计核算的开票凭证...
本操作手册详细介绍了在SAP系统中进行重过帐会计凭证的步骤,适用于富大集团的SAP项目实施。 1. 目的与处理说明: 重过帐会计凭证的主要目的是为了修正PA(利润中心会计)凭证的错误。当发现凭证过帐有误,如成本...
涵盖了SAP金融会计的各个方面,包括General Settings、Financial Accounting、Financial Accounting Global Settings、检查度量单位、业务围、年度变式、会计凭证、Field status 和 Coding block subscreen、...
在财务会计中,我们可以定义财务会计科目、会计凭证和财务报表等。 3. 集成机制:集成机制是指 SAP PS 和 FICO 之间的连接机制,用于实现项目结果分析和财务会计之间的数据交换。在本文中,我们将介绍 SAP PS 和 ...
1. FBAS(会计凭证):包含会计凭证的基本数据。 - 重要字段包括: - BELNR(凭证编号):唯一标识会计凭证。 - GJAHR(会计年度):该凭证所属的会计年度。 - MANDT(客户端):SAP系统中独立的企业单元标识。 ...
根据提供的文件信息,我们可以推断出这是一本关于SAP财务模块的专业书籍,重点在于SAP财务会计(FI)的相关知识和技术。以下是对文件中提到的一些核心知识点的详细解释: ### SAP FI 财务会计相关 #### SAP 部分...
这份名为"SAP查询及报表培训资料.ppt"的文档提供了对SAP系统中财务会计(FI/CO)和库存管理(MM/SD)模块的查询及报表功能的详细指导,旨在帮助财务负责人有效地进行数据管理和分析。 在财务会计部分,主要介绍了以下...
在SAP系统中,Smartforms是一种强大的工具,用于创建复杂的打印输出...了解这些知识点后,无论是简单的单据打印还是复杂的报表输出,你都能游刃有余。记得实践是检验理论的最好方式,动手操作是掌握Smartforms的关键。
1. 需要下载UF0简版,因为系统自带的财务报表系统格式可能不兼容修改,可能会出现“未知错误101”。 2. 运行UF0简版,打开凭证模板,金额式模板路径为C:\windows\system32\UFCOmSQL\glpzje5,数量外币式模板为glpzwb...
1. **凭证过账**:在SAP中,每笔交易都以会计凭证的形式记录。凭证包含借贷双方的信息,以及相关的总分类账主记录号。SAP支持自动和手动两种方式过账,自动过账通常与业务流程集成,如销售订单确认或采购入库;手动...