ZFI001应收账龄
来源:互联网 发布:淘宝卖家app叫什么 编辑:程序博客网 时间:2024/06/08 09:18
在sap中是没有标准的应收账龄报表的,要实现这个功能可以使用下面三种方法:
1:利用BW手段完成该功能
2:运用ABAP技术实现该功能
3:也可以利用外部的语言直接捞数据库
当然作为一名ABAPer只好选择方法2咯。
通过前面课程的学习,对这个功能的实现了充分的准备了,选择是ScriptForm。
所以先在se71建立(有不熟悉的童鞋可以先学习ScriptForm的系列课程)
1基本设置数据
2.字符格式
3.段落格式
4.页面,窗口设置
4.1Main 窗口
4.2BILLTO窗口
4.3 COMPANY窗口
4.4 FOOTER窗口
5.接下来就要到se38 写代码啦
*&---------------------------------------------------------------------**& Report ZFI001*&---------------------------------------------------------------------** Author : Jasson.Lee* Date : 2011.04.23* Purpose :* Modi Log: 2011.07.16 Gavin 加 按InvoiceNo排序/ 客户地址过长/多币别*----------------------------------------------------------------------report zfi001.tables: bsad,bsid,kna1,knb1,tnapr.*--------------------------------* Selection Screen*--------------------------------selection-screen begin of block b1 with frame title text-001.select-options: s_kunnr for kna1-kunnr. "CustomerNoparameters: p_bukrs like knb1-bukrs obligatory default 3000. "Company Codeselection-screen end of block b1.* For Line Itemsselection-screen begin of block b2 with frame title text-002.*Open Itemsparameters: rb_open radiobutton group bc default 'X', p_kdate like bsad-budat default sy-datum.selection-screen skip.*Cleared Itemsparameters: rb_close radiobutton group bc.select-options:s_augdt for bsad-augdt.parameters: p_odate like bsad-budat.selection-screen skip.*All Items*PARAMETERS: RB_ALL RADIOBUTTON GROUP BC.*SELECT-OPTIONS:S_BUDAT FOR BSAD-BUDAT.*SELECTION-SCREEN SKIP.selection-screen end of block b2.data:begin of t_bsad occurs 0.data:price1 type p decimals 2, price2 type p decimals 2, price3 type p decimals 2, price4 type p decimals 2, price5 type p decimals 2, pswbt1 type p decimals 2. include structure bsad.data:end of t_bsad.data:begin of t_bsad1 occurs 0. include structure t_bsad.data:end of t_bsad1.data:begin of t_bsad2 occurs 0, kunnr like kna1-kunnr, end of t_bsad2.data:begin of t_bsid occurs 0.data:price1 type p decimals 2, price2 type p decimals 2, price3 type p decimals 2, price4 type p decimals 2, price5 type p decimals 2, pswbt1 type p decimals 2. include structure bsid.data:end of t_bsid.data:begin of t_kna1 occurs 0, kunnr like kna1-kunnr, name1 like adrc-name1, city1 like adrc-city1, pcode like adrc-post_code1, street like adrc-street, str_suppl3 like adrc-str_suppl3, location like adrc-location, landx like t005t-landx, end of t_kna1.data:begin of t_sum occurs 0, kunnr like bsad-kunnr, bukrs like bsad-bukrs, pswsl like bsad-pswsl, psum type p decimals 2, psum1 type p decimals 2, psum2 type p decimals 2, psum3 type p decimals 2, psum4 type p decimals 2, psum5 type p decimals 2, end of t_sum.data:begin of t_sum0 occurs 0. include structure t_sum.data:end of t_sum0.data :w_loop like sy-tabix.data :p_coco like knb1-bukrs.data :w_total(10) type c.data :w_loop1 like sy-tabix.data :w_loop2 like sy-tabix.data :w_loop3 like sy-tabix.data :rcount like sy-tabix.*--------------------------------* Initialization*--------------------------------initialization.*--------------------------------* At Selection Screen PBO*--------------------------------at selection-screen output.*--------------------------------* Start of Selection*--------------------------------start-of-selection. perform get_data. perform get_customer. perform process_data. perform sum_data. perform form_open. perform check_data. select single bukrs into p_coco from knb1 where bukrs = p_bukrs. if p_bukrs = '3000'. w_total = 'Total:'. else. w_total = '总金额:'. endif. perform write_form using ' ' 'COMPANY' 'BODY '.* T_BSAD2[] = T_BSAD[]. delete adjacent duplicates from t_bsad2. describe table t_kna1 lines rcount. sort t_kna1 by kunnr. sort t_sum0 by kunnr. loop at t_kna1. w_loop1 = sy-tabix.* Read table T_BSAD WITH KEY KUNNR = T_KNA1-KUNNR BINARY SEARCH. read table t_sum0 with key kunnr = t_kna1-kunnr binary search. if sy-subrc = 0. perform write_form using 'CUSTOMER' 'BILLTO' 'BODY '. perform write_form using 'HEADER ' 'MAIN' 'TOP '. t_bsad1[] = t_bsad[]. delete t_bsad1 where kunnr <> t_kna1-kunnr. loop at t_bsad1. w_loop2 = sy-tabix. perform write_form using 'DETAIL ITEM ' 'MAIN' 'BODY '. sy-tabix = w_loop2. endloop. t_sum[] = t_sum0[]. delete t_sum where kunnr <> t_kna1-kunnr. sort t_sum by pswsl. loop at t_sum. w_loop3 = sy-tabix.* READ TABLE T_SUM WITH KEY KUNNR = T_KNA1-KUNNR BINARY SEARCH.* IF SY-SUBRC = 0. perform write_form using 'TOTAL ' 'MAIN' 'BODY '.* ENDIF. sy-tabix = w_loop3. endloop. perform write_form using 'SIGN ' 'MAIN' 'BODY '. perform write_form using ' ' 'FOOTER' 'BODY '. sy-tabix = w_loop1. if rcount > w_loop1. perform write_form using 'NEW' 'MAIN' 'BODY '. endif. endif. endloop. perform form_close.end-of-selection.*--------------------------------* Top of Page*--------------------------------top-of-page.*&---------------------------------------------------------------------**& Form get_data*&---------------------------------------------------------------------*form get_data. data l_loop like sy-tabix.*Open Item if rb_open = 'X'.*Get Data from Cleared Item Table select * into corresponding fields of table t_bsad from bsad where kunnr in s_kunnr and bukrs = p_bukrs and budat <= p_kdate and augdt > p_kdate.*Get Data from OpenItem Table select * into corresponding fields of table t_bsid from bsid where kunnr in s_kunnr and bukrs = p_bukrs and budat < p_kdate.* IF NOT T_BSID[] IS INITIAL. loop at t_bsid. l_loop = sy-tabix. move-corresponding t_bsid to t_bsad. append t_bsad. sy-tabix = l_loop. endloop.* ENDIF.*Cleared Item elseif rb_close = 'X'. select * into corresponding fields of table t_bsad from bsad where kunnr in s_kunnr and bukrs = p_bukrs and augdt > p_odate and augdt in s_augdt.* All Item* ELSE.**Get Data from Cleared Item Table* SELECT * INTO CORRESPONDING FIELDS OF TABLE T_BSAD* FROM BSAD* WHERE KUNNR = P_KUNNR AND BUKRS = P_BUKRS AND BUDAT IN S_BUDAT.**Get Data from OpenItem Table* SELECT * INTO CORRESPONDING FIELDS OF TABLE T_BSID* FROM BSID* WHERE KUNNR = P_KUNNR AND BUKRS = P_BUKRS AND BUDAT IN S_BUDAT.** IF NOT T_BSID[] IS INITIAL.* LOOP AT T_BSID.* L_LOOP = SY-TABIX.* MOVE-CORRESPONDING T_BSID TO T_BSAD.* SY-TABIX = L_LOOP.* ENDLOOP.* ENDIF. endif.endform. "get_data*&---------------------------------------------------------------------**& Form Get_Customer*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form get_customer . select k~kunnr a~name1 a~city1 a~post_code1 as pcode a~street a~str_suppl3 a~location t~landx into corresponding fields of table t_kna1 from adrc as a join kna1 as k on a~addrnumber = k~adrnr join t005t as t on a~country = t~land1 for all entries in t_bsad where k~kunnr in s_kunnr and t~spras = sy-langu and k~kunnr = t_bsad-kunnr.endform. " Get_Customer*&---------------------------------------------------------------------**& Form Form_Open*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form form_open . call function 'OPEN_FORM' exporting form = 'ZFI002' language = sy-langu dialog = 'X'* DEVICE = SCREEN exceptions others = 1.endform. " Form_Open*&---------------------------------------------------------------------**& Form write_form*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->Element text* -->Window text* -->Type text*----------------------------------------------------------------------*form write_form using element window type. call function 'WRITE_FORM' exporting element = element window = window type = type.endform. " write_form*&---------------------------------------------------------------------**& Form FORM_CLOSE*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form form_close. call function 'CLOSE_FORM' exceptions others = 1.endform. " FORM_CLOSE*&---------------------------------------------------------------------**& Form process_data*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form process_data . data l_diff type f. data l_kdate type sy-datum. sort t_bsad by belnr. loop at t_bsad. w_loop = sy-tabix. if t_bsad-shkzg = 'H'. t_bsad-pswbt1 = t_bsad-pswbt * ( -1 ). else. t_bsad-pswbt1 = t_bsad-pswbt. endif. if rb_open = 'X'. l_kdate = p_kdate. else. l_kdate = p_odate. endif. l_diff = l_kdate - t_bsad-bldat. if l_diff <= 30. t_bsad-price1 = t_bsad-pswbt1. t_bsad-price2 = 0. t_bsad-price3 = 0. t_bsad-price4 = 0. t_bsad-price5 = 0. elseif l_diff <= 60. t_bsad-price1 = 0. t_bsad-price2 = t_bsad-pswbt1. t_bsad-price3 = 0. t_bsad-price4 = 0. t_bsad-price5 = 0. elseif l_diff <= 90. t_bsad-price1 = 0. t_bsad-price2 = 0. t_bsad-price3 = t_bsad-pswbt1. t_bsad-price4 = 0. t_bsad-price5 = 0. elseif l_diff <= 120. t_bsad-price1 = 0. t_bsad-price2 = 0. t_bsad-price3 = 0. t_bsad-price4 = t_bsad-pswbt1. t_bsad-price5 = 0. else. t_bsad-price1 = 0. t_bsad-price2 = 0. t_bsad-price3 = 0. t_bsad-price4 = 0. t_bsad-price5 = t_bsad-pswbt1. endif. modify t_bsad. sy-tabix = w_loop. endloop.endform. " process_data*&---------------------------------------------------------------------**& Form SUM_DATA*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form sum_data . loop at t_bsad. w_loop = sy-tabix. t_sum0-kunnr = t_bsad-kunnr. t_sum0-bukrs = t_bsad-bukrs. t_sum0-pswsl = t_bsad-pswsl. t_sum0-psum = t_bsad-pswbt1. t_sum0-psum1 = t_bsad-price1. t_sum0-psum2 = t_bsad-price2. t_sum0-psum3 = t_bsad-price3. t_sum0-psum4 = t_bsad-price4. t_sum0-psum5 = t_bsad-price5. collect t_sum0. sy-tabix = w_loop. endloop.endform. " SUM_DATA*&---------------------------------------------------------------------**& Form CHECK_DATA*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form check_data . if sy-subrc <> 0. leave list-processing. endif.endform. " CHECK_DATA
6.大功告成,现在大家来看看运行的结果吧
OK,还行啊。
- ZFI001应收账龄
- 财务会计2----短期投次与应收账项
- 应 酬
- 应 酬
- 应注意
- 应付帐
- delete 应用时应注意的问题
- 为什么账龄分析的余额与应收款明细表对不上?如何分析?
- 微软的应试题
- 李应 水浒
- 创新性应
- 技术人员应掌握市场营销
- 大学生应说的英语
- 应计利息
- 应记英文
- 网络安全应抛开“门户之见”
- 应病与药
- 太上感应篇
- oracle 进程查看v$session
- UBuntu下USB转串口配置
- HDU 1002 A + B Problem II
- Mysql安装
- 摘自代码阅读方法与实践书籍的知识点总结
- ZFI001应收账龄
- 全文索引如果关键字少于3个字符就会查不到
- Eclipse快捷键大全
- 分配内存错误
- linux源代码阅读技巧
- Java GUI
- 黑马程序员_第一篇文章
- 开源.net程序反编译工具 - ILSpy
- 使用服务器变量过滤XSLT Webpart数据