版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、*-* * PROJECT NAME: * PROGRAM TITLE: 防偽稅控接口 * PROGRAM ID/NAME: * AUTHORS NAME: * VERSION: 1.0 *-* * DESCRIPTION: *-* * CHANGE HISTORY *-* * Changed by xxxxxxxx * On xxxxxxxx * Description of the changes: * #1. * #2. * #. *- REPORT Z NO STANDARD PAGE HEADING MESSAGE-ID ZSDA LINE-SIZE 255 line-count 6
2、5. *- * INCLUDES *- INCLUDE: , . *- * TYPE-POOLS *- TYPE-POOLS: slis. ALV *- * TABLES *- TABLES: vbrk, Billing Document: Header Data vbrp, Billing Document: Item Data vbfa, 銷售憑證流 vbak, 銷售憑證:抬頭數(shù)據(jù) vbap, 銷售憑證:項目數(shù)據(jù) vbpa, 銷售憑證:合作伙伴 vbpa3, 一次性客戶的稅編碼 konv, vbrk-knumv konp, konv-knumh lips, SD document: Del
3、ivery: Item data bkpf. TABLES: kna1, General Data in Customer Master knvv, Customer Master Sales Data knvp, Customer Master Partner Functions knbk, Customer Master (Bank Details bnka. Bank master record TABLES: adrc, Addresses (Business Address Services adrct, adr2. Telephone Numbers (Business Addre
4、ss Services TABLES: mara, t006a. Assign Internal to Language-Dependent Unit TABLES: zsd014u, 金稅接口用戶權限分配表 zsd014o, 從SAP導出數(shù)據(jù)記錄表 zsd014i. 從SAP導入數(shù)據(jù)記錄表 *- * Global data define *- * 內(nèi)表定義 *- * 發(fā)票抬頭備注、客戶名稱、客戶地址、客戶銀行 *- DATA: BEGIN OF gt_document OCCURS 0, vbeln LIKE vbrk-vbeln, 發(fā)票號 fkart LIKE vbrk-fkart, 發(fā)票
5、類型 fkdat LIKE vbrk-fkdat, 出具發(fā)票日期 kunrg LIKE vbrk-kunrg, 付款方(客戶 knumv LIKE vbrk-knumv, konv-knumv, zuonr LIKE vbrk-zuonr, 金稅發(fā)票號 sfakn LIKE vbrk-sfakn, 取消的發(fā)票號 * fksto LIKE vbrk-fksto, 該發(fā)票被取消標志 zuonr1(10 TYPE C, 對應正數(shù)發(fā)票 zuonr2(8 TYPE C, 號碼 posnr LIKE vbrp-posnr, matnr LIKE vbrp-matnr, arktx LIKE vbrp-ar
6、ktx, 銷售訂單項目短文本(物料描述 vrkme LIKE vbrp-vrkme, 銷售單位 fkimg LIKE vbrp-fkimg, 開票數(shù)量 price(8 TYPE P decimals 7, 單價(不含稅 netwr/fkimg netwr LIKE vbrp-netwr, 金額(不含稅 trate TYPE P decimals 2, 稅率 mwsbp/netwr mwsbp LIKE vbrp-mwsbp, 稅額 tolwr LIKE vbrp-netwr, 總價值 netwr+mwsbp text(160 TYPE C, 備注 vbelv LIKE vbfa-vbelv,
7、vbeln+posnrvbelv+posnv 發(fā)票與銷售訂單的對應 posnv LIKE vbfa-posnv, bukrs LIKE vbrk-bukrs, 公司代碼,不同的公司適用不同風格的發(fā)票 END OF gt_document. DATA: BEGIN OF gt_customer OCCURS 0, kunnr LIKE kna1-kunnr, name1 LIKE kna1-name1, 客戶名稱 name2 LIKE kna1-name2, 客戶名稱 name(70 TYPE C, 客戶名稱=name1+name2 導出到金稅使用 name3(20 TYPE C, 客戶名稱=n
8、ame1(20 Alv 顯示時使用 ktokd LIKE kna1-ktokd, 客戶帳戶組/判斷是否為一次性客戶 * stras LIKE kna1-stras, 客戶地址(門牌號 街道 street LIKE adrc-street, 客戶地址-街道 house_num1 LIKE adrc-house_num1, 客戶地址-門牌號 addr(70 TYPE C, 客戶地址(街道 門牌號 telf1 LIKE kna1-telf1, 電話 stcd1 LIKE kna1-stcd1, 稅號1(納稅人識別號 bankl LIKE knbk-bankl, 客戶開戶銀行代碼 banka LIKE
9、 bnka-banka, 銀行名稱 * bankn LIKE knbk-bankn, 客戶賬號 bankn LIKE bnka-stras, 銀行街道實際存放客戶賬號 END OF gt_customer. DATA: BEGIN OF gt_output OCCURS 0. INCLUDE STRUCTURE gt_document. INCLUDE STRUCTURE gt_customer. DATA: sel_flag TYPE C, 選擇框 dc_flag TYPE C, 已導出到文本標識 ht_flag TYPE C. 已回填標識 DATA: END OF gt_output. D
10、ATA: BEGIN OF gt_input OCCURS 0, sel_flag TYPE C, 選擇框 jinsh1(10 TYPE C, jinsh2(8 TYPE C, vbeln(10 TYPE C, belnr LIKE bkpf-belnr, flag TYPE C, 回填結果狀態(tài)標志 message(60 TYPE C, END OF gt_input. DATA: gt_zsd014o LIKE zsd014o OCCURS 0 WITH HEADER LINE, gt_zsd014i LIKE zsd014i OCCURS 0 WITH HEADER LINE. DATA:
11、 gt_bdcdata LIKE BDCDATA OCCURS 0 WITH HEADER LINE, gt_bdcmsg LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE. *- * 常量定義 *- CONSTANTS: C_AUTH_QUERY LIKE zsd014u-zauth VALUE 1, C_AUTH_TRANS LIKE zsd014u-zauth VALUE 2. CONSTANTS: C_CANCEL_ZUONR1 LIKE vbrk-zuonr VALUE x, C_CANCEL_ZUONR2 LIKE vbrk-zuonr VALUE
12、 X, C_LENTH_ZUONR TYPE I VALUE 18. CONSTANTS: C_TEXT_SEPARATE(2 TYPE C VALUE n, C_TEXT_ID LIKE THEAD-TDID VALUE 0002, C_TEXT_OBJECT LIKE THEAD-TDOBJECT VALUE VBBK. CONSTANTS: g_object LIKE inri-object VALUE ZMIGSD014, Number range g_nr_01 LIKE inri-nrrangenr VALUE 01, 導出編號區(qū)間 g_nr_02 LIKE inri-nrrang
13、enr VALUE 02. 導入編號區(qū)間 DATA: g_number(10 TYPE C, Number range g_create_time LIKE sy-uzeit. DATA: g_flag_download_chk TYPE C, g_flag_upload_chk TYPE C, g_flag_write_chk TYPE C. *- * 全局變量定義 *- DATA: g_authorization LIKE zsd014u-zauth. DATA: g_filename LIKE rlgrap-filename. *- * Data parameters for alv r
14、eport use *- * Screen 2000 DATA: ok_code LIKE sy-ucomm. DATA: g_container TYPE scrfname VALUE G_CONTAINER, g_custom_container TYPE REF TO cl_gui_custom_container, g_alv_grid TYPE REF TO cl_gui_alv_grid, gw_layout TYPE lvc_s_layo, gw_fieldcat TYPE lvc_s_fcat, gt_fieldcat TYPE lvc_t_fcat. * Screen 300
15、0 DATA: g_container2 TYPE scrfname VALUE G_CONTAINER2, g_custom_container2 TYPE REF TO cl_gui_custom_container, g_alv_grid2 TYPE REF TO cl_gui_alv_grid, gw_layout2 TYPE lvc_s_layo, gw_fieldcat2 TYPE lvc_s_fcat, gt_fieldcat2 TYPE lvc_t_fcat. *= * SELECTION-SCREEN *= * Billing document number SELECTIO
16、N-SCREEN BEGIN OF BLOCK BLOCK0 WITH FRAME TITLE TEXT-006. * 導出 SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 1. PARAMETERS: rb_out RADIOBUTTON GROUP g1. SELECTION-SCREEN COMMENT 3(20 text-007. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-001.
17、 PARAMETERS : p_bukrs LIKE vbrk-bukrs MEMORY ID BUK. SELECT-OPTIONS: s_fkart FOR vbrk-fkart, s_vbeln FOR vbrk-vbeln, s_kunrg FOR vbrk-kunrg, s_fkdat FOR vbrk-fkdat, s_zuonr FOR vbrk-zuonr. SELECTION-SCREEN SKIP 1. PARAMETERS: rb_ykp RADIOBUTTON GROUP g2. PARAMETERS: rb_wkp RADIOBUTTON GROUP g2 DEFAU
18、LT X. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 4. PARAMETERS: rb_1 RADIOBUTTON GROUP g3. SELECTION-SCREEN COMMENT 6(20 text-002. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 4. PARAMETERS: rb_2 RADIOBUTTON GROUP g3. SELECTION-SCREEN COMMENT
19、 6(20 text-003. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 4. PARAMETERS: rb_3 RADIOBUTTON GROUP g3. SELECTION-SCREEN COMMENT 6(20 text-004. SELECTION-SCREEN END OF LINE. PARAMETERS: rb_all RADIOBUTTON GROUP g2. SELECTION-SCREEN END OF BLOCK BLOCK1. * 導入
20、SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 1. PARAMETERS: rb_in RADIOBUTTON GROUP g1. SELECTION-SCREEN COMMENT 3(20 text-008. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF BLOCK BLOCK2 WITH FRAME TITLE TEXT-005. PARAMETERS: p_bukrs2 LIKE bkpf-bukrs, p_gjahr2 LIKE bkpf-gjahr,
21、 p_fname2 LIKE rlgrap-filename. SELECTION-SCREEN END OF BLOCK BLOCK2. SELECTION-SCREEN END OF BLOCK BLOCK0. *- * INITIALIZATION *- INITIALIZATION. PERFORM frm_initial. *- * AT SELECTION-SCREEN *- AT SELECTION-SCREEN. *- * AT SELECTION-SCREEN ON VALUE-REQUEST *- AT SELECTION-SCREEN ON VALUE-REQUEST F
22、OR p_fname2. CALL FUNCTION WS_FILENAME_GET EXPORTING def_path = C: mask = ,Text Files,*.txt;*.prn,All Files,*.*. title = Select File IMPORTING filename = p_fname2 EXCEPTIONS inv_winsys = 1 no_batch = 2 selection_cancel = 3 selection_error = 4 others = 5. IF sy-subrc NE 0 AND sy-subrc NE 3 AND p_fnam
23、e2 NE space. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. *= * MAIN PROGRAM *= *- * START-OF-SELECTION *- START-OF-SELECTION. SELECT SINGLE * FROM zsd014u WHERE uname = sy-uname. IF sy-subrc NE 0. MESSAGE S001. ELSE. IF rb_out NE SPACE. g_authori
24、zation = zsd014u-zauth. PERFORM frm_get_billing_document. PERFORM frm_set_output_data. PERFORM frm_set_alv_para. SORT gt_output BY vbeln posnr. CALL SCREEN 2000. ELSE. PERFORM frm_upload CHANGING g_flag_upload_chk. IF g_flag_upload_chk EQ SPACE. PERFORM frm_set_alv_para2. * SORT gt_input BY CALL SCR
25、EEN 3000. ENDIF. ENDIF. ENDIF. *- * END-OF-SELECTION *- END-OF-SELECTION. *&-* *& Form frm_initial *&-* * text *-* * - p1 text * p1 text * - p2 t NGU NAME = l_name OBJECT = C_TEXT_OBJECT * ARCHIVE_HANDLE = * LOCAL_CAT = * IMPORTING * HEADER = TABLES LINES = lt_tline EXCEPTIONS ID = 1 LANGUAGE = 2 NA
26、ME = 3 NOT_FOUND = 4 OBJECT = 5 REFERENCE_CHECK = 6 WRONG_ACCESS_TO_ARCHIVE = 7 OTHERS = 8 . IF sy-subrc = 0. LOOP AT lt_tline. l_index2 = l_index2 + 1. IF l_index2 = 1. IF l_text EQ SPACE. gt_document-text = lt_tline-tdline. ELSE. 負數(shù)發(fā)票備注第一行為特定文本 CONCATENATE l_text lt_tline-tdline INTO gt_document-t
27、ext SEPARATED BY C_TEXT_SEPARATE. ENDIF. ELSE. CONCATENATE gt_document-text lt_tline-tdline INTO gt_document-text SEPARATED BY C_TEXT_SEPARATE. ENDIF. ENDLOOP. ELSE. IF l_text NE SPACE. gt_document-text = l_text. ENDIF. ENDIF. MOVE gt_document-kunrg TO gt_customer-kunnr. COLLECT gt_customer. MODIFY
28、gt_document INDEX l_index1. ENDLOOP. * 得到客戶數(shù)據(jù) LOOP AT gt_customer. SELECT SINGLE * FROM kna1 WHERE kunnr = gt_customer-kunnr. IF sy-subrc = 0. IF kna1-ktokd NE Z006. 非一次性客戶 MOVE-CORRESPONDING kna1 TO gt_customer. * 名稱 CONCATENATE gt_customer-name1 gt_customer-name2 INTO gt_customer-name. gt_customer
29、-name3 = gt_customer-name1(20. * 地址 SELECT SINGLE * FROM adrc WHERE addrnumber = kna1-adrnr AND date_from = sy-datum. IF sy-subrc = 0. gt_customer-street = adrc-street. gt_customer-house_num1 = adrc-house_num1. CONCATENATE gt_customer-street gt_customer-house_num1 INTO gt_customer-addr. ENDIF. * 銀行
30、SELECT * FROM knbk UP TO 1 ROWS WHERE kunnr = gt_customer-kunnr. ENDSELECT. IF sy-subrc = 0. gt_customer-bankl = knbk-bankl. * gt_customer-bankn = knbk-bankn. * 銀行名稱 SELECT SINGLE * FROM bnka WHERE banks = knbk-banks AND bankl = knbk-bankl. IF sy-subrc = 0. gt_customer-banka = bnka-banka. gt_custome
31、r-bankn = bnka-stras. ENDIF. ENDIF. ELSE. 一次性客戶,客戶數(shù)據(jù)要聯(lián)系憑證數(shù)據(jù)設置 gt_customer-ktokd = Z006. ENDIF. ENDIF. MODIFY gt_customer. ENDLOOP. ENDFORM. frm_get_billing_document *&-* *& Form frm_set_output_data *&-* * text *-* * - p1 text * p1 text * set_table_for_first_display EXPORTING * i_structure_name = is_
32、layout = gw_layout CHANGING it_outtab = gt_output it_fieldcatalog = gt_fieldcat. ELSE. CALL METHOD g_alv_grid-refresh_table_display. ENDIF. ENDMODULE. STATUS_2000 OUTPUT *&-* *& Module USER_COMMAND_2000 INPUT *&-* * text *-* MODULE USER_COMMAND_2000 INPUT. * OK_CODE = SY-UCOMM. * CALL METHOD cl_gui_
33、cfw=dispatch. CASE ok_code. WHEN EXIT. CLEAR ok_code. PERFORM frm_free_alv_control. LEAVE TO SCREEN 0. WHEN ALLS. CLEAR ok_code. PERFORM frm_select_all_2000. WHEN ALLN. CLEAR ok_code. PERFORM frm_unselect_2000. WHEN EXPO. CLEAR ok_code. CALL METHOD g_alv_grid-check_changed_data. PERFORM frm_check_do
34、wnload_data CHANGING g_flag_download_chk. IF g_flag_download_chk EQ SPACE. PERFORM frm_download. ENDIF. WHEN OTHERS. CLEAR ok_code. CALL METHOD g_alv_grid-check_changed_data. ENDCASE. ENDMODULE. USER_COMMAND_2000 INPUT *&-* *& Form frm_free_alv_control *&-* * text *-* * - p1 text * free EXCEPTIONS others = 1. * IF sy-subrc NE 0. * CALL FUN
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年青海省安全員-C證考試(專職安全員)題庫及答案
- 2025貴州省安全員-C證考試(專職安全員)題庫及答案
- 2025吉林省安全員B證考試題庫附答案
- 2025江蘇建筑安全員-C證(專職安全員)考試題庫
- 2025年湖南省安全員-C證考試題庫
- 離心泵知識培訓課件
- 普通話口語訓練(課件)
- 【物理課件】透鏡成像作圖法課件
- 材料物理化學課件緒論
- 《BA工法簡介》課件
- 醫(yī)療機構發(fā)熱門診制度、流程
- 中醫(yī)執(zhí)業(yè)醫(yī)師定期考核個人述職報告范文(精選5篇)
- 10379食品執(zhí)行標準
- YC 264-2014煙用內(nèi)襯紙
- GB/T 706-2008熱軋型鋼
- 建設工程監(jiān)理合同(住房和城鄉(xiāng)建設部2023)
- GB/T 38628-2020信息安全技術汽車電子系統(tǒng)網(wǎng)絡安全指南
- GB/T 10609.2-1989技術制圖明細欄
- 《商務溝通與談判》配套教學課件
- 化工工藝純堿工藝課件
- 干法熄焦工技師理論考試題庫(含答案)
評論
0/150
提交評論