SAP_ABAP_OO_ALV案例

 SAP ABAP顾问能力模型梳理_企业数字化建设者的博客-CSDN博客SAP Abap顾问能力模型https://blog.csdn.net/java_zhong1990/article/details/132469977

一、OO_ ALV ,面向对象开发ALV报表

基于对收款清账平台的开发,解释 OO_ALV开发的程序结构与代码模板参考

1.1 代码部分


REPORT  zsd076 .
*******************************************************
*程序名: ZSD076
*程序描述:流水导入 -- > 收款凭证 --> 清账凭证
*----------------------------------------------------------------------
*创建日期     ABAP开发顾问      业务顾问
*20220704    TerryZhong      TerryZhong*******************************************************INCLUDE zsd076_global.
INCLUDE zsd076_top.
INCLUDE zsd076_sel.
INCLUDE zsd076_frm.
INCLUDE zsd076_pbo.
INCLUDE zsd076_pai.
INCLUDE zsd076_9001.SELECTION-SCREEN FUNCTION KEY: 1.INITIALIZATION.gv_init = 'X'.PERFORM init.AT SELECTION-SCREEN OUTPUT.PERFORM init_output.AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_file.PERFORM get_excel.AT SELECTION-SCREEN.CASE sscrfields-ucomm.WHEN 'FC01'.PERFORM download_template USING '水单导入模板.xlsx' 'ZTSD015'.WHEN OTHERS.ENDCASE.START-OF-SELECTION.IF p_inp = 'X'.     "导入程序PERFORM get_data_for_excel.PERFORM check_data_for_excel."Set Index RequenceLOOP AT gt_data ASSIGNING <fs_data>.<fs_data>-zindex = sy-tabix.ENDLOOP.PERFORM set_catalog.PERFORM display_alv.ELSEIF p_sel = 'X'. "处理收款"添加权限检查SELECT t001~bukrs INTO TABLE @gv_auth_bukrs FROM t001 WHERE t001~bukrs IN @so_vkorg.IF gv_auth_bukrs IS NOT INITIAL.LOOP AT gv_auth_bukrs INTO gs_auth_bukrs.AUTHORITY-CHECK OBJECT 'F_KK_ODBUK'ID 'BUKRS' FIELD gs_auth_bukrs-bukrsID 'ORDERACT' FIELD '03'.IF sy-subrc = 4.MESSAGE '没有申请' && gs_auth_bukrs-bukrs && '公司的访问权限,请联系系统管理员!' TYPE 'S' DISPLAY LIKE 'E'.LEAVE TO LIST-PROCESSING.EXIT.ELSEIF sy-subrc <> 0.MESSAGE '没有申请' && gs_auth_bukrs-bukrs && '公司的访问权限,请联系系统管理员!' TYPE 'S' DISPLAY LIKE 'E'.LEAVE TO LIST-PROCESSING.EXIT.ENDIF.ENDLOOP.ENDIF."Get NOPERFORM get_data_for_ztsd015."Get ITEM OF Uncleaning INVOICEREAD TABLE gt_data ASSIGNING <fs_data> INDEX 1. " 获取第一条 ,水单IF sy-subrc = 0.<fs_data>-checked = 'X'."Added by zhong on 20221012 ,从ZTSD018中获取单据 业务确认过的 。SELECT * INTO TABLE @lt_ztsd018 FROM ztsd018 WHERE ztsd018~ztsd015_id = @<fs_data>-zid.IF lt_ztsd018 IS NOT INITIAL.REFRESH :lt_bsid.LOOP AT lt_ztsd018 INTO ls_ztsd018.MOVE-CORRESPONDING ls_ztsd018 TO ls_bsid.ls_bsid-zid           = ls_ztsd018-ztsd015_id."收款单IDls_bsid-in_wrbtr      = ls_ztsd018-wrbtr_2.   "分配余额ls_bsid-oa_no         = ls_ztsd018-oa_no.ls_bsid-rstgr         = ls_ztsd018-rstgr.ls_bsid-status_inc_a  = icon_locked.APPEND ls_bsid TO lt_bsid.ENDLOOP.ELSE."获取客户 RV 的凭证
*        PERFORM get_data_for_bsid_by2 USING <fs_data>-vkorg <fs_data>-kunnr.
*        PERFORM dear_data_for_bsid    USING <fs_data>-vkorg <fs_data>-kunnr.ENDIF.ENDIF.CALL SCREEN 9001.ELSEIF p_sel2 = 'X'."查询"添加权限检查SELECT t001~bukrs INTO TABLE @gv_auth_bukrs FROM t001 WHERE t001~bukrs IN @so_vkorg.IF gv_auth_bukrs IS NOT INITIAL.LOOP AT gv_auth_bukrs INTO gs_auth_bukrs.AUTHORITY-CHECK OBJECT 'F_KK_ODBUK'ID 'BUKRS' FIELD gs_auth_bukrs-bukrsID 'ORDERACT' FIELD '03'.IF sy-subrc = 4.MESSAGE '没有申请' && gs_auth_bukrs-bukrs && '公司的访问权限,请联系系统管理员!' TYPE 'S' DISPLAY LIKE 'E'.LEAVE TO LIST-PROCESSING.EXIT.ELSEIF sy-subrc <> 0.MESSAGE '没有申请' && gs_auth_bukrs-bukrs && '公司的访问权限,请联系系统管理员!' TYPE 'S' DISPLAY LIKE 'E'.LEAVE TO LIST-PROCESSING.EXIT.ENDIF.ENDLOOP.ENDIF."get noPERFORM get_data_for_ztsd015.PERFORM set_catalog.PERFORM display_alv.ELSEIF p_3 = 'X'.CALL TRANSACTION 'ZSD077'.ENDIF.
*&---------------------------------------------------------------------*
*& 包含 ZSD076_GLOBAL
*&---------------------------------------------------------------------*DATA:gv_init TYPE char1.DATA:lt_ztsd018 TYPE TABLE OF ztsd018.
DATA:ls_ztsd018 TYPE ztsd018.DATA:gv_auth_bukrs TYPE TABLE OF t001.
DATA:gs_auth_bukrs TYPE t001.*&---------------------------------------------------------------------*
*&  包含                ZFI068_TOP
*&---------------------------------------------------------------------*
TABLES: sscrfields,vbak,bsis.
TYPE-POOLS: esp1,slis ,icon.
TYPES: BEGIN OF gy_data,zindex          TYPE i,           "序号checked         TYPE char1,       "勾选框status_inc      TYPE char10,      "状态灯status          TYPE char2,       "状态message         TYPE char255,     "消息文本zid             TYPE ztsd015-zid, "ID "收款单IDbelnr           TYPE bsid-belnr,  "凭证编号gjahr           TYPE bsid-gjahr,  "财务年度bstat           TYPE bsid-bstat,cbelnr          TYPE bsid-belnr,         "清账凭证编号vkorg           TYPE ztsd015-vkorg,      "销售机构kunnr           TYPE ztsd015-kunnr,      "售达方kunnr_desc      TYPE ztsd015-kunnr_desc, "客户名称 - 模板上的客户名称kunnr2          TYPE ztsd015-kunnr,      "送达方kunnr_desc2     TYPE ztsd015-kunnr_desc, "送达方名称kunnr_desc_yh   TYPE ztsd015-kunnr_desc, "客户付款名称bstkd           TYPE ztsd015-bstkd,
*         sname           TYPE pa0001-sname,      "业务员
*         pernr           TYPE knvp-pernr,        "业务员编号sname           TYPE char50,             "业务员pernr           TYPE char50,             "业务员编号zname           TYPE ztsd017-zname,      "收款银行zaccount        TYPE ztsd017-zaccount,   "收款账号hkont           TYPE ztsd017-hkont,      "总帐 - 银行科目hkont_in        TYPE ztsd017-hkont_in,   "总帐 - 手续费kunnr_akont     TYPE knb1-akont,         "应收统驭科目kunnr_akont2    TYPE knb1-akont,         "预收统驭科目hkont_in2       TYPE ztsd017-hkont_in2,kostl           TYPE bsis-kostl,item_text       TYPE ztsd017-item_text,  "行项目文本acct_type       TYPE ztsd017-acct_type,  "帐户类型doc_type        TYPE ztsd017-doc_type,   "凭证类型rstgr           TYPE ztsd017-rstgr,      "原因代码rstgr_kunnr     TYPE ztsd017-rstgr,      "原因代码xblnr           TYPE ztsd017-xblnr,           "参考transactionno   TYPE ztsd015-transactionno,   "交易流水transactiontype TYPE ztsd015-transactiontype, "交易类型businesstype    TYPE ztsd015-businesstype,    "业务类型accountpayer    TYPE ztsd015-accountpayer,    "付款人开户行号payer           TYPE ztsd015-payer,           "付款人开户行名debitaccount    TYPE ztsd015-debitaccount,    "付款人账号payername       TYPE ztsd015-payername,       "付款人名称transactiondate TYPE ztsd015-transactiondate, "交易日期tradecurrency   TYPE ztsd015-tradecurrency,   "交易货币wrbtr           TYPE ztsd015-wrbtr,  "金额wrbtr_charge    TYPE ztsd015-wrbtr,  "金额-手续费wrbtr_charge2   TYPE ztsd015-wrbtr,  "金额-手续费 业务补充wrbtr_2         TYPE ztsd015-wrbtr,  "分配余额wrbtr_3         TYPE ztsd015-wrbtr,  "预收wrbtr_4         TYPE ztsd015-wrbtr,  "佣金budat           TYPE bsis-budat, "过账日期trans_date      TYPE bsis-budat, "换算日期modifiydate     TYPE ztsd015-modifiydate, "水单记录的日期modifiytime     TYPE ztsd015-modifiytime, "水单时间modifiedby      TYPE ztsd015-modifiedby,  "水单确认人zstatus         TYPE  c, "分配状态zin             TYPE ztsd015-zin, "会计确认za              TYPE ztsd015-za,  "业务确认zp              TYPE ztsd015-zp,  "凭证过账zc              TYPE ztsd015-zc,  "凭证清账modifiydate_za  TYPE ztsd015-modifiydate_za, "业务确认日期modifiytime_za  TYPE ztsd015-modifiytime_za, "业务确认时间modifiedby_za   TYPE ztsd015-modifiedby_za,  "业务确认人status_inc_i    TYPE char10,      "流水初始确认status_inc_a    TYPE char10,      "流水业务员确认status_inc_p    TYPE char10,      "凭证过账status_inc_c    TYPE char10,      "凭证清账ztrue           TYPE char10,      "辅助字段 已匹配到客户关键词 Xztimes          TYPE ztsd016-ztimes,    "次数bank_bak        TYPE ztsd015-bank_bak, "水单备注END OF gy_data.DATA: gs_data TYPE gy_data,gt_data TYPE TABLE OF gy_data.
FIELD-SYMBOLS: <fs_data>  TYPE gy_data.DATA: gt_fieldcat_lvc TYPE lvc_t_fcat, "ALV:定义一个先显示字段的表gs_fieldcat_lvc LIKE LINE OF gt_fieldcat_lvc. "ALV" ---  bsid  客户未清发票TYPES:BEGIN OF ly_bsid,bukrs        TYPE  bsid-bukrs, "公司代码kunnr        TYPE  bsid-kunnr, "客户umsks        TYPE  bsid-umsks, "事务类型umskz        TYPE  bsid-umskz, "特别总账标识augdt        TYPE  bsid-augdt, "结算augbl        TYPE  bsid-augbl, "清帐凭证zuonr        TYPE  bsid-zuonr, "分配gjahr        TYPE  bsid-gjahr, "财年belnr        TYPE  bsid-belnr, "凭证编号buzei        TYPE  bsid-buzei, "行项目budat        TYPE  bsid-budat, "过帐日期bldat        TYPE  bsid-bldat, "凭证日期cpudt        TYPE  bsid-cpudt, "录入日期waers        TYPE  bsid-waers, "货币xblnr        TYPE  bsid-xblnr, "参照blart        TYPE  bsid-blart, "凭证类型monat        TYPE  bsid-monat, "期间bschl        TYPE  bsid-bschl, "记帐代码zumsk        TYPE  bsid-zumsk, "特别总帐标志shkzg        TYPE  bsid-shkzg, "借方/贷方gsber        TYPE  bsid-gsber, "业务范围mwskz        TYPE  bsid-mwskz, "税码dmbtr        TYPE  bsid-dmbtr, "本位币金额wrbtr        TYPE  bsid-wrbtr, "金额mwsts        TYPE  bsid-mwsts, "LC 税额wmwst        TYPE  bsid-wmwst, "税额bdiff        TYPE  bsid-bdiff, "估价差额bdif2        TYPE  bsid-bdif2, "估价差额 2sgtxt        TYPE  bsid-sgtxt, "文本projn        TYPE  bsid-projn, "未在使用中的aufnr        TYPE  bsid-aufnr, "订单anln1        TYPE  bsid-anln1, "资产anln2        TYPE  bsid-anln2, "次级编号saknr        TYPE  bsid-saknr, "总帐科目hkont        TYPE  bsid-hkont, "总帐fkont        TYPE  bsid-fkont, "财务预算filkd        TYPE  bsid-filkd, "分支zfbdt        TYPE  bsid-zfbdt, "基限日期zterm        TYPE  bsid-zterm, "付款条件zbd1t        TYPE  bsid-zbd1t, "天数 1zbd2t        TYPE  bsid-zbd2t, "天数 2zbd3t        TYPE  bsid-zbd3t, "天内净额zbd1p        TYPE  bsid-zbd1p, "折扣百分比 1zbd2p        TYPE  bsid-zbd2p, "折扣百分比 2in_wrbtr     TYPE  bsid-wrbtr,  "分配金额zid          TYPE  ztsd015-zid, "IDoa_no        TYPE ztsd018-oa_no,rstgr        TYPE ztsd018-rstgr,zmonth       TYPE  num10, "testzstatus      TYPE  c, "IDstatus_inc   TYPE char10,      "状态灯status_inc_a TYPE char10,      "流水业务员确认status_inc_c TYPE char10,      "凭证清账END OF ly_bsid.DATA:ls_bsid TYPE ly_bsid.
DATA:lt_bsid TYPE TABLE OF ly_bsid.
DATA:lt_bsid_temp TYPE TABLE OF ly_bsid.
FIELD-SYMBOLS: <fs_bsid>  TYPE ly_bsid."--  ooalvDATA: gs_layo1 TYPE lvc_s_layo,gs_fcat1 TYPE lvc_s_fcat,gt_fcat1 TYPE lvc_t_fcat.
* 定义ALV宏
DEFINE add_fcat1.gs_fcat1-scrtext_m   = &1."中字段标签gs_fcat1-fieldname   = &2."ALV 控制: 内部表字段的字段名称gs_fcat1-no_zero     = &3."ALV 控制: 为输出隐藏零gs_fcat1-checkbox    = &4."ALV 控制: 作为复选框输出gs_fcat1-edit        = &5."设置可编辑模式gs_fcat1-outputlen   = &6."输出长度gs_fcat1-ref_table   = &7.gs_fcat1-ref_field   = &8.gs_fcat1-datatype    = &9.
APPEND gs_fcat1 TO gt_fcat1.
CLEAR gs_fcat1.
END-OF-DEFINITION.DATA: gs_layo2 TYPE lvc_s_layo,gs_fcat2 TYPE lvc_s_fcat,gt_fcat2 TYPE lvc_t_fcat.
DEFINE add_fcat2.gs_fcat2-scrtext_m   = &1."中字段标签gs_fcat2-fieldname   = &2."ALV 控制: 内部表字段的字段名称gs_fcat2-no_zero     = &3."ALV 控制: 为输出隐藏零gs_fcat2-checkbox    = &4."ALV 控制: 作为复选框输出gs_fcat2-edit        = &5."设置可编辑模式gs_fcat2-outputlen   = &6."输出长度gs_fcat2-ref_table   = &7.gs_fcat2-ref_field   = &8.gs_fcat2-datatype    = &9.
APPEND gs_fcat2 TO gt_fcat2.
CLEAR gs_fcat2.
END-OF-DEFINITION.DATA con1_ref TYPE REF TO cl_gui_custom_container.
DATA con2_ref TYPE REF TO cl_gui_custom_container.DATA g_grid1 TYPE REF TO cl_gui_alv_grid.
DATA g_grid2 TYPE REF TO cl_gui_alv_grid.DATA ok_code TYPE sy-ucomm.
DATA:lv_frist TYPE c."----------------------------------------------
" 加入事件定义:
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: event_receiver TYPE REF TO lcl_event_receiver.
DATA: ls_stbl TYPE lvc_s_stbl.
*定义是件的属性和方法
CLASS lcl_event_receiver DEFINITION.
*公共事件PUBLIC SECTION.METHODS:handle_double_clickFOR EVENT double_click OF cl_gui_alv_gridIMPORTING e_row e_column es_row_no,*按钮处理方法handle_toolbarFOR EVENT toolbar OF cl_gui_alv_gridIMPORTING e_object e_interactive,
*用户交互是件处理handle_user_commandFOR EVENT user_command OF cl_gui_alv_gridIMPORTING e_ucomm.METHODS catch_hotspotclickFOR EVENT hotspot_click OF cl_gui_alv_gridIMPORTING e_row_ide_column_ides_row_no.METHODS catch_changeFOR EVENT data_changed OF cl_gui_alv_gridIMPORTING er_data_changede_onf4e_onf4_beforee_onf4_aftere_ucomm.ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION*实现方法
CLASS lcl_event_receiver IMPLEMENTATION .METHOD handle_double_click.IF e_column-fieldname = 'BELNR'.READ TABLE gt_data INTO gs_data INDEX es_row_no-row_id.IF sy-subrc = 0.**        SET PARAMETER ID 'BLN'   FIELD gs_data-belnr.
**        SET PARAMETER ID 'BUK'   FIELD gs_data-vkorg.
**        SET PARAMETER ID 'GJR'   FIELD gs_data-gjahr.
**        CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.SET PARAMETER ID 'BLP'   FIELD gs_data-belnr.SET PARAMETER ID 'BUK'   FIELD gs_data-vkorg.SET PARAMETER ID 'GJR'   FIELD gs_data-gjahr.CALL TRANSACTION 'FBV0' AND SKIP FIRST SCREEN.ENDIF.ENDIF.ENDMETHOD.                    "handle_double_click*处理按钮事件METHOD handle_toolbar.DATA:ls_toolbar TYPE stb_button.CLEAR ls_toolbar.
*    MOVE 3 TO ls_toolbar-butn_type.
**取工具条接口
*    APPEND ls_toolbar TO e_object->mt_toolbar.CLEAR ls_toolbar.
***加入功能码
*    MOVE 'ZSA' TO ls_toolbar-function.
***图标,可以用SHOWICON系统程序查阅需使用的图标
**    MOVE icon_ppe_vnode TO ls_toolbar-icon.
***按钮文本和提示
*    MOVE '全选' TO  ls_toolbar-quickinfo.
*    MOVE '全选'(112) TO  ls_toolbar-text.
*    MOVE '' TO  ls_toolbar-disabled.
*    APPEND ls_toolbar TO e_object->mt_toolbar.
*MOVE 'ZCA' TO ls_toolbar-function.
***图标,可以用SHOWICON系统程序查阅需使用的图标MOVE icon_ppe_vnode TO ls_toolbar-icon.
***按钮文本和提示MOVE '取消全选' TO  ls_toolbar-quickinfo.MOVE '取消全选'(112) TO  ls_toolbar-text.MOVE '' TO  ls_toolbar-disabled.APPEND ls_toolbar TO e_object->mt_toolbar.***    MOVE 'ZPOST' TO ls_toolbar-function.
*****图标,可以用SHOWICON系统程序查阅需使用的图标
***    MOVE icon_ppe_vnode TO ls_toolbar-icon.
*****按钮文本和提示
***    MOVE '创建收款凭证' TO  ls_toolbar-quickinfo.
***    MOVE '创建收款凭证'(112) TO  ls_toolbar-text.
***    MOVE '' TO  ls_toolbar-disabled.
***    APPEND ls_toolbar TO e_object->mt_toolbar.ENDMETHOD.                    "HANDLE_TOOLBAR*处理功能码事件METHOD handle_user_command.DATA: lt_rows  TYPE lvc_t_row.DATA: lv_total TYPE wrbtr.CASE  e_ucomm.
*定义的按钮事件WHEN 'ZSA'.LOOP AT gt_data ASSIGNING <fs_data>.<fs_data>-checked = 'X'.ENDLOOP.WHEN 'ZCA'.LOOP AT gt_data ASSIGNING <fs_data>.<fs_data>-checked = ''.ENDLOOP.WHEN 'ZPOST'.ENDCASE.ls_stbl-row = 'X'.ls_stbl-col = 'X'.CALL METHOD g_grid1->refresh_table_displayEXPORTINGis_stable = ls_stbl.ENDMETHOD.                    "HANDLE_USER_COMMANDMETHOD catch_hotspotclick.*    CLEAR: lv_dr_total, lv_dz_total.
*    READ TABLE gt_dz_info ASSIGNING FIELD-SYMBOL(<gs_dz_info>) INDEX e_row_id.
*    IF sy-subrc = 0 .
*      IF <gs_dz_info>-budat_display <> '可分配金额'.
*
*        READ TABLE gt_dz_info ASSIGNING FIELD-SYMBOL(<gs_dz_change>) WITH KEY budat_display = '可分配金额'.
*
*        IF <gs_dz_info>-check_dz = 'X'.
*
*          LOOP AT gt_rv_info INTO gs_rv_info WHERE check_rv = 'X'.
*            lv_dr_total = lv_dr_total + gs_rv_info-zqzje.
*          ENDLOOP.
*
*          LOOP AT gt_dz_info INTO gs_dz_info WHERE check_dz = 'X'.
*            lv_dz_total = lv_dz_total + gs_dz_info-n_wrbtr.
*          ENDLOOP.
*
*          IF lv_dz_total - <gs_dz_info>-n_wrbtr < lv_dr_total AND lv_dr_total <> 0.
*            MESSAGE '不能取消勾选,请先调整发票金额' TYPE 'I'.
*          ELSE.
*
*            CLEAR: <gs_dz_info>-check_dz.
*            <gs_dz_change>-n_wrbtr = <gs_dz_change>-n_wrbtr - <gs_dz_info>-n_wrbtr.
*            CLEAR: <gs_dz_info>-n_wrbtr.
*
*          ENDIF.
*
*        ELSE.
*          <gs_dz_info>-check_dz = 'X'..
*          <gs_dz_info>-n_wrbtr = <gs_dz_info>-wrbtr.
*          <gs_dz_change>-n_wrbtr = <gs_dz_change>-n_wrbtr + <gs_dz_info>-n_wrbtr.
*        ENDIF.
*
*      ENDIF.
*    ENDIF.ls_stbl-row = 'X'.ls_stbl-col = 'X'.CALL METHOD g_grid1->refresh_table_displayEXPORTINGis_stable = ls_stbl.ENDMETHOD.                    "CATCH_DOUBLECLICKMETHOD catch_change.DATA lv_message TYPE char255.FIELD-SYMBOLS:  <fs_value> TYPE any.LOOP AT er_data_changed->mt_mod_cells ASSIGNING FIELD-SYMBOL(<ls_mod_cell>) .IF <ls_mod_cell>-fieldname = 'CHECKED'.LOOP AT gt_data ASSIGNING <fs_data> .IF sy-tabix <> <ls_mod_cell>-row_id.<fs_data>-checked = ''.ELSE.<fs_data>-checked = 'X'.ENDIF.ENDLOOP.READ TABLE gt_data INTO gs_data INDEX <ls_mod_cell>-row_id.IF sy-subrc EQ 0.*          ASSIGN COMPONENT <ls_mod_cell>-fieldname OF STRUCTURE gs_data TO <fs_value>.
*          IF sy-subrc EQ 0.
*            CALL METHOD er_data_changed->get_cell_value
*              EXPORTING
*                i_row_id    = <ls_mod_cell>-row_id
*                i_fieldname = <ls_mod_cell>-fieldname
*              IMPORTING
*                e_value     = <fs_value>.
*            <ls_mod_cell>-value = <fs_value>.
*          ENDIF." added by zhong on 20220718 添加未清信息-------------------
*          PERFORM get_data_for_bsid_by2 USING gs_data-vkorg gs_data-kunnr.
*          PERFORM dear_data_for_bsid    USING gs_data-vkorg gs_data-kunnr."Added by zhong on 20221012 ,从ZTSD018中 业务确认过的 ,单据中获取。SELECT * INTO TABLE @lt_ztsd018 FROM ztsd018 WHERE ztsd018~ztsd015_id = @gs_data-zid.IF lt_ztsd018 IS NOT INITIAL.REFRESH :lt_bsid.LOOP AT lt_ztsd018 INTO ls_ztsd018.MOVE-CORRESPONDING ls_ztsd018 TO ls_bsid.ls_bsid-zid           = ls_ztsd018-ztsd015_id.ls_bsid-in_wrbtr      = ls_ztsd018-wrbtr_2.ls_bsid-status_inc_a  = icon_locked.APPEND ls_bsid TO lt_bsid.ENDLOOP.ELSE.
*            "获取客户 RV 的凭证
*            PERFORM get_data_for_bsid_by2 USING gs_data-vkorg gs_data-kunnr.
*            PERFORM dear_data_for_bsid    USING gs_data-vkorg gs_data-kunnr.REFRESH :lt_bsid.ENDIF.ls_stbl-row = 'X'.ls_stbl-col = 'X'.CALL METHOD g_grid2->refresh_table_displayEXPORTINGis_stable = ls_stbl.
*          " ---------------------------ENDIF.ENDIF.ENDLOOP.ls_stbl-row = 'X'.ls_stbl-col = 'X'.CALL METHOD g_grid1->refresh_table_displayEXPORTINGis_stable = ls_stbl.ENDMETHOD.
ENDCLASS.*&---------------------------------------------------------------------*
*& 包含 ZPP066_SEL
*&---------------------------------------------------------------------*
TABLES:ztsd013,lips, bsid,ztsd015,usr02.SELECTION-SCREEN:BEGIN OF BLOCK b0 WITH FRAME TITLE TEXT-001.PARAMETERS:p_inp RADIOBUTTON GROUP g1 USER-COMMAND u1 DEFAULT 'X'."导入收款
PARAMETERS:p_sel RADIOBUTTON GROUP g1 . "处理收款
PARAMETERS:p_sel2 RADIOBUTTON GROUP g1 . "查询流水
PARAMETERS:p_3 RADIOBUTTON GROUP g1 . "客户关键词维护SELECTION-SCREEN SKIP 1.PARAMETERS:pa_file TYPE rlgrap-filename MODIF ID s01."文件夹上传
SELECT-OPTIONS: so_vkorg FOR ztsd013-vkorg MODIF ID s02.
SELECT-OPTIONS: so_kunnr FOR bsid-kunnr MODIF ID s02.SELECT-OPTIONS: so_trans FOR ztsd015-transactionno MODIF ID s02.
SELECT-OPTIONS: so_trane FOR ztsd015-transactiondate MODIF ID s02.SELECT-OPTIONS: so_usr02 FOR usr02-bname MODIF ID s02.SELECTION-SCREEN SKIP 1.
PARAMETERS:p_0 RADIOBUTTON GROUP g2 DEFAULT 'X' USER-COMMAND u1 MODIF ID s03.
PARAMETERS:p_1 RADIOBUTTON GROUP g2 MODIF ID s03. "
PARAMETERS:p_2 RADIOBUTTON GROUP g2 MODIF ID s03. "SELECTION-SCREEN:END OF BLOCK b0.*&---------------------------------------------------------------------*
*&  包含                ZFI068_FRM
*&---------------------------------------------------------------------*FORM get_excel.DATA : l_filetab TYPE filetable,l_waftab  LIKE LINE OF l_filetab,l_rc      TYPE i.CALL METHOD cl_gui_frontend_services=>file_open_dialogEXPORTINGwindow_title            = '打开文件'initial_directory       = 'C:/'CHANGINGfile_table              = l_filetabrc                      = l_rcEXCEPTIONSfile_open_dialog_failed = 1cntl_error              = 2error_no_gui            = 3not_supported_by_gui    = 4OTHERS                  = 5.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.EXIT.ELSE.READ TABLE l_filetab INTO l_waftab INDEX 1.pa_file = l_waftab-filename.CLEAR: l_filetab,l_waftab.ENDIF.ENDFORM.FORM init.DATA: ls_dyntxt TYPE smp_dyntxt .ls_dyntxt-icon_id   = icon_export.ls_dyntxt-quickinfo = '模板下载'.ls_dyntxt-icon_text = '模板下载'.sscrfields-functxt_01 = ls_dyntxt.so_usr02-low    = sy-uname.so_usr02-high   = ''.so_usr02-option = 'BT'.so_usr02-sign   = 'I'.APPEND  so_usr02 TO so_usr02[].ENDFORM.FORM init_output.LOOP AT SCREEN.IF p_inp  = 'X'.IF  screen-group1 = 'S02' OR screen-group1 = 'S03'  OR screen-group1 = 'S04'.screen-active = 0. "隐藏ENDIF.IF screen-group1 = 'S01'.screen-active = 1. "显示ENDIF.ELSEIF p_sel = 'X'.IF  screen-group1 = 'S01'  OR screen-group1 = 'S04'.screen-active = 0. "隐藏ENDIF.IF screen-group1 = 'S02' OR screen-group1 = 'S03'.screen-active = 1. "显示ENDIF.ELSEIF p_sel2 = 'X'.IF  screen-group1 = 'S01'  OR screen-group1 = 'S04'.screen-active = 0. "隐藏ENDIF.IF screen-group1 = 'S02' OR screen-group1 = 'S03' .screen-active = 1. "显示ENDIF.ELSEIF p_3    = 'X'.IF  screen-group1 = 'S01' OR screen-group1 = 'S02' OR screen-group1 = 'S03'  OR screen-group1 = 'S04'.screen-active = 0. "隐藏ENDIF.ENDIF.MODIFY SCREEN.ENDLOOP.ENDFORM.FORM get_data_for_excel.TYPES: BEGIN OF ly_excel_data,zname           TYPE ztsd017-zname,             "收款银行zaccount        TYPE ztsd017-zaccount,          "收款账号transactiondate TYPE ztsd015-transactiondate,   "交易日期transactionno   TYPE ztsd015-transactionno,     "交易流水kunnr_desc_yh   TYPE ztsd015-kunnr_desc,        "客户名称 - 模板上的客户名称tradecurrency   TYPE ztsd015-tradecurrency,     "交易货币wrbtr           TYPE ztsd015-wrbtr,             "金额-到账金额wrbtr_charge    TYPE ztsd015-wrbtr,             "金额-手续费bank_bak        TYPE ztsd015-bank_bak,          "水单备注transactiontype TYPE ztsd015-transactiontype,   "交易类型businesstype    TYPE ztsd015-businesstype,      "业务类型accountpayer    TYPE ztsd015-accountpayer,      "付款人开户行号payer           TYPE ztsd015-payer,             "付款人开户行名debitaccount    TYPE ztsd015-debitaccount,      "付款人账号payername       TYPE ztsd015-payername,         "付款人名称END OF ly_excel_data.
*  DATA: lt_excel      TYPE TABLE OF alsmex_tabline WITH HEADER LINE,DATA: lt_excel      TYPE TABLE OF zcom_alsmex_tabline WITH HEADER LINE,ls_excel_data TYPE ly_excel_data,l_index       LIKE sy-tabix.DATA: lv_lines TYPE i.FIELD-SYMBOLS: <fs>.IF pa_file IS NOT INITIAL.CALL FUNCTION 'ZZALSM_EXCEL_TO_INTERNAL_TABLE'EXPORTINGfilename                = pa_filei_begin_col             = '1'i_begin_row             = '3'i_end_col               = '9'i_end_row               = '9999'TABLESintern                  = lt_excelEXCEPTIONSinconsistent_parameters = 1upload_ole              = 2OTHERS                  = 3.IF sy-subrc = 0.
*&& 将EXCEL格式中的数据导入到内表TAB_LOAD中LOOP AT lt_excel.ASSIGN COMPONENT lt_excel-col OF STRUCTURE ls_excel_data TO <fs>.<fs> = lt_excel-value.AT END OF row.MOVE-CORRESPONDING ls_excel_data TO gs_data."跟Excel的列一一对应的内表APPEND gs_data TO gt_data.CLEAR: ls_excel_data,gs_data.ENDAT.ENDLOOP.lv_lines = lines( gt_data ).IF lv_lines > 8000.MESSAGE  '本次导入数据超过8000,请拆分数据文件!' TYPE 'S'DISPLAY LIKE 'E'.STOP.ENDIF.ENDIF.ELSE.MESSAGE  '请输入文件路径!' TYPE 'S'DISPLAY LIKE 'E'.STOP.ENDIF.ENDFORM.FORM check_data_for_excel.IF gt_data IS NOT INITIAL.LOOP AT gt_data ASSIGNING <fs_data>."  1,检查交易流水号在数据库中是否已经存在"  2,检查交易流水号是否已经被确认"  3,智能匹配销售客户与售达方SELECT SINGLE * INTO @DATA(ls_ztsd016)  FROM ztsd016 WHERE ztsd016~kunnr_desc = @<fs_data>-kunnr_desc_yh.IF ls_ztsd016 IS NOT INITIAL.SELECT SINGLE * INTO @DATA(ls_ztsd017) FROM ztsd017WHERE ztsd017~zaccount = @<fs_data>-zaccount AND ztsd017~waers = @<fs_data>-tradecurrency.IF sy-subrc = 0.<fs_data>-vkorg = ls_ztsd017-vkorg. "销售机构CLEAR: ls_ztsd017.ELSE.CLEAR: ls_ztsd017.ENDIF.
*       <fs_data>-vkorg = ls_ztsd016-vkorg. "销售机构<fs_data>-kunnr = ls_ztsd016-kunnr. "售达方<fs_data>-ztrue = 'X'.<fs_data>-ztimes = ls_ztsd016-ztimes.SELECT SINGLE kna1~name1 INTO <fs_data>-kunnr_desc FROM kna1 WHERE kna1~kunnr = ls_ztsd016-kunnr.CLEAR:ls_ztsd016.ELSE.CLEAR:ls_ztsd016.ENDIF.IF <fs_data>-zname IS INITIAL.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '请输入收款银行!'.CONTINUE.ENDIF.IF <fs_data>-zaccount IS INITIAL.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '请输入收款账号!'.CONTINUE.ENDIF.IF <fs_data>-transactionno IS INITIAL.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '请输入交易流水!'.CONTINUE.ENDIF.IF <fs_data>-transactiondate IS INITIAL.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '请输入交易日期!'.CONTINUE.ENDIF.IF <fs_data>-tradecurrency IS INITIAL.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '请输入交易货币!'.CONTINUE.ENDIF.IF <fs_data>-wrbtr IS INITIAL.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '请输入交易金额!'.CONTINUE.ENDIF.IF <fs_data>-kunnr_desc_yh IS INITIAL.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '请输入备注!'.CONTINUE.ENDIF.SELECT SINGLE * INTO @DATA(ls_check)  FROM ztsd015 WHEREztsd015~transactionno = @<fs_data>-transactionnoAND ztsd015~zname         = @<fs_data>-zname.IF ls_check IS NOT  INITIAL.CLEAR:ls_check.<fs_data>-status = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message = '交易流水号已存在!'.CONTINUE.ELSE.CLEAR:ls_check.ENDIF.ENDLOOP.ENDIF.ENDFORM.FORM download_template USING pu_filename pu_objid.
*& 下载模版DATA: ls_objdata LIKE wwwdatatab.DATA: lv_filename TYPE string,lv_fullpath TYPE string  VALUE 'C:\',lv_path     TYPE  string VALUE 'C:\'.DATA: lv_errtxt TYPE string.DATA: lv_destination LIKE rlgrap-filename.DATA: lv_rc LIKE sy-subrc.DATA: lv_fileup LIKE rlgrap-filename.lv_filename = pu_filename .
*& 调用保存对话框CALL METHOD cl_gui_frontend_services=>file_save_dialogEXPORTINGdefault_extension    = 'xlsx'default_file_name    = lv_filenameinitial_directory    = 'C:\'CHANGINGfilename             = lv_filenamepath                 = lv_pathfullpath             = lv_fullpathEXCEPTIONScntl_error           = 1error_no_gui         = 2not_supported_by_gui = 3OTHERS               = 4.IF sy-subrc NE 0.MESSAGE '不能打开EXCEL' TYPE 'E'.ENDIF.CHECK lv_fullpath IS NOT INITIAL .lv_fileup = lv_fullpath.ls_objdata-relid = 'MI' .ls_objdata-objid = pu_objid .lv_destination = lv_fullpath .CALL FUNCTION 'DOWNLOAD_WEB_OBJECT'EXPORTINGkey         = ls_objdatadestination = lv_destinationIMPORTINGrc          = lv_rc.IF lv_rc NE 0.CONCATENATE '模板文件:' ls_objdata-objid '下载失败' INTO lv_errtxt.MESSAGE lv_errtxt TYPE 'E'.ELSE.MESSAGE '模版下载成功' TYPE 'S'.ENDIF.ENDFORM.                    " DOWNLOAD_TEMPLATEFORM set_catalog.DATA:lv_position TYPE i VALUE 1.CLEAR: lv_position.lv_position = lv_position + 1.
* 预定义一个输出模式DEFINE df_fieldcat.CLEAR gs_fieldcat_lvc.gs_fieldcat_lvc-col_pos     = lv_position."ALV 控制: 输出列gs_fieldcat_lvc-scrtext_m   = &1."中字段标签gs_fieldcat_lvc-fieldname   = &2."ALV 控制: 内部表字段的字段名称gs_fieldcat_lvc-no_zero     = &3."ALV 控制: 为输出隐藏零gs_fieldcat_lvc-checkbox    = &4."ALV 控制: 作为复选框输出gs_fieldcat_lvc-edit        = &5."设置可编辑模式gs_fieldcat_lvc-outputlen   = &6."输出长度gs_fieldcat_lvc-ref_table   = &7.gs_fieldcat_lvc-ref_field   = &8.gs_fieldcat_lvc-datatype    = &9.APPEND gs_fieldcat_lvc TO gt_fieldcat_lvc.ADD 1 TO lv_position.END-OF-DEFINITION.df_fieldcat:'序号' 'ZINDEX' 'X' '' '' '' '' '' '','勾选框' 'CHECKED' 'X' 'X' 'X' '' '' '' '','状态灯' 'STATUS_INC' 'X' '' '' '' '' '' '','状态' 'STATUS' 'X' '' '' '' '' '' '','消息文本' 'MESSAGE' 'X' '' '' '' '' '' '','In' 'STATUS_INC_I' 'X' '' '' '' '' '' '',"流水初始确认'A' 'STATUS_INC_A' 'X' '' '' '' '' '' '' ,"流水业务员确认'P' 'STATUS_INC_P' 'X' '' '' '' '' '' '', "凭证过账
*     'C' 'STATUS_INC_C' 'X' '' '' '' '' '' '',"凭证清账'匹配情况' 'ZTRUE' 'X' 'X' '' '' '' '' '','销售机构' 'VKORG' 'X' '' 'X' '' '' '' '','财务年度' 'GJAHR' 'X' '' '' '' '' '' '','凭证号码' 'BELNR' 'X' '' '' '' '' '' '','凭证状态' 'BSTAT' 'X' '' '' '' '' '' '','售达方'   'KUNNR' 'X' '' 'X' '' '' '' '','客户名称' 'KUNNR_DESC' 'X' '' '' '' '' '' '','客户付款名称' 'KUNNR_DESC_YH' 'X' '' '' '' '' '' '','次数' 'ZTIMES' 'X' '' '' '' '' '' '','收款银行' 'ZNAME' 'X' '' '' '' '' '' '','收款账号' 'ZACCOUNT' 'X' '' '' '' '' '' '','交易流水' 'TRANSACTIONNO' 'X' '' '' '' '' '' '','交易日期' 'TRANSACTIONDATE' 'X' '' '' '' '' '' '','交易货币' 'TRADECURRENCY' 'X' '' '' '' '' '' '','到账金额' 'WRBTR' 'X' '' '' '' '' '' '','手续费' 'WRBTR_CHARGE' 'X' '' '' '' '' '' '','水单备注'   'BANK_BAK' 'X' '' '' '' '' '' '','交易类型' 'TRANSACTIONTYPE' 'X' '' '' '' '' '' '','业务类型' 'BUSINESSTYPE' 'X' '' '' '' '' '' '','付款人开户行号' 'ACCOUNTPAYER' 'X' '' '' '' '' '' '','付款人开户行名' 'PAYER' 'X' '' '' '' '' '' '','付款人账号' 'DEBITACCOUNT' 'X' '' '' '' '' '' '','付款人名称' 'PAYERNAME' 'X' '' '' '' '' '' '','会计确认' 'ZIN' 'X' 'X' '' '' '' '' '','创建日期' 'MODIFIYDATE' 'X' '' '' '' '' '' '','创建时间' 'MODIFIYTIME' 'X' '' '' '' '' '' '','创建人'   'MODIFIEDBY' 'X' '' '' '' '' '' '','收款单ID' 'ZID' 'X' '' '' '' '' '' ''.IF p_sel2 = 'X' . "查询LOOP AT gt_fieldcat_lvc INTO gs_fieldcat_lvc.IFgs_fieldcat_lvc-fieldname = 'CHECKED'OR gs_fieldcat_lvc-fieldname = 'STATUS_INC'OR gs_fieldcat_lvc-fieldname = 'STATUS'OR gs_fieldcat_lvc-fieldname = 'MESSAGE'OR gs_fieldcat_lvc-fieldname = 'ZTRUE'OR gs_fieldcat_lvc-fieldname = 'ZTIMES'.DELETE  gt_fieldcat_lvc.CONTINUE.ENDIF.IF gs_fieldcat_lvc-fieldname = 'VKORG'.gs_fieldcat_lvc-edit = ''.ENDIF.IF gs_fieldcat_lvc-fieldname = 'KUNNR'.gs_fieldcat_lvc-edit = ''.ENDIF.MODIFY gt_fieldcat_lvc FROM gs_fieldcat_lvc.ENDLOOP.ELSEIF p_inp = 'X' . "导入LOOP AT gt_fieldcat_lvc INTO gs_fieldcat_lvc.IF     gs_fieldcat_lvc-fieldname = 'STATUS_INC_I'OR gs_fieldcat_lvc-fieldname = 'STATUS_INC_A'OR gs_fieldcat_lvc-fieldname = 'STATUS_INC_P'OR gs_fieldcat_lvc-fieldname = 'STATUS_INC_C'OR gs_fieldcat_lvc-fieldname = 'GJAHR'OR gs_fieldcat_lvc-fieldname = 'BELNR'OR gs_fieldcat_lvc-fieldname = 'BSTAT'.DELETE  gt_fieldcat_lvc.CONTINUE.ENDIF.ENDLOOP.ENDIF.ENDFORM.FORM display_alv.DATA: ls_layout TYPE lvc_s_layo.IF gt_data IS NOT INITIAL.ls_layout-zebra      = 'X'.ls_layout-cwidth_opt = 'X'.
* 调用ALV functionCALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'EXPORTINGi_callback_program       = sy-repid "这里是调用这个ALV的程序名i_callback_pf_status_set = 'PF_STATUS' "设置ALV状态栏的函数i_callback_user_command  = 'USER_COMMAND' "获取用户事件的函数is_layout_lvc            = ls_layout "显示的布局it_fieldcat_lvc          = gt_fieldcat_lvc "设置显示的字段以及字段的功能i_save                   = 'A'TABLESt_outtab                 = gt_dataEXCEPTIONSprogram_error            = 1.IF sy-subrc <> 0.MESSAGE '报表生成异常,请联系系统管理员!' TYPE 'S' DISPLAY LIKE 'E'.ENDIF.ELSE.
* 这个消息用来显示我们是不是获取到了数据,自己用的时候把这个硬代码换成你需要的TEXT-XXX.MESSAGE '没有获取到数据,请重新检索!' TYPE 'S' DISPLAY LIKE 'E'.LEAVE TO LIST-PROCESSING.EXIT.ENDIF.
ENDFORM.
*&---------------------------------------------------------------------**&---------------------------------------------------------------------*
*&      Form  GET_DATA_FOR_ZTSD015
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_data_for_ztsd015 .SELECTztsd015~zid,"IDztsd015~vkorg,"销售组织ztsd015~kunnr,"售达方
*         ztsd015~kunnr_desc,"客户名称ztsd015~kunnr_desc_yh,ztsd015~modifiydate,"修改记录的日期ztsd015~modifiytime,"修改时间ztsd015~modifiedby ,"修改人ztsd015~transactionno,  "交易流水ztsd015~transactiontype,"交易类型ztsd015~businesstype,   "业务类型ztsd015~accountpayer,   "付款人开户行号ztsd015~payer,          "付款人开户行名ztsd015~debitaccount,   "付款人账号ztsd015~payername,      "付款人名称ztsd015~transactiondate,"交易日期ztsd015~tradecurrency,  "交易货币ztsd015~wrbtr,          "收款金额ztsd015~wrbtr_charge,   "手续费ztsd015~wrbtr_charge2,  "手续费 - 业务补充ztsd015~wrbtr_2,        "分配余额ztsd015~wrbtr_3,        "挂预收款ztsd015~wrbtr_4,        "挂预收佣金ztsd015~bstkd,ztsd015~zin,            "会计确认ztsd015~za,             "业务确认ztsd015~zp,             "凭证过账ztsd015~zc,             "凭证清账ztsd015~modifiydate_za, "业务确认日期ztsd015~modifiytime_za, "业务确认时间ztsd015~modifiedby_za,  "业务确认人ztsd015~zname,          "收款银行ztsd015~zaccount,       "收款账号ztsd015~belnr,          "会计凭证号码ztsd015~gjahr,          "财务年度ztsd015~bank_bak,       "水单备注kna1~name1 && kna1~name2 AS  kunnr_desc,knb1~akont AS kunnr_akont "客户应收统驭科目INTO CORRESPONDING FIELDS OF TABLE @gt_data FROM  ztsd015LEFT  JOIN  knb1  ON knb1~kunnr = ztsd015~kunnr AND knb1~bukrs = ztsd015~vkorgLEFT  JOIN  kna1  ON kna1~kunnr = knb1~kunnrWHEREknb1~bukrs  IN @so_vkorgAND knb1~kunnr  IN @so_kunnrAND ztsd015~transactionno   IN @so_transAND ztsd015~transactiondate IN @so_traneAND ztsd015~modifiedby      IN @so_usr02."Added by zhong on 20220719 添加 E 锁对象LOOP AT gt_data INTO gs_data.PERFORM lock_record USING  gs_data-zid.ENDLOOP.SORT gt_data BY vkorg kunnr ASCENDING transactiondate ASCENDING.IF gt_data IS NOT INITIAL.SELECT bukrs ,belnr ,gjahr,bstat INTO TABLE @DATA(lt_bkpf) FROM bkpf FOR ALL ENTRIES IN @gt_dataWHERE bkpf~bukrs = @gt_data-vkorgAND bkpf~belnr = @gt_data-belnrAND  bkpf~gjahr = @gt_data-gjahr.SELECT * FROM knvp INTO TABLE @DATA(lt_knvp) FOR ALL ENTRIES IN @gt_data WHERE  knvp~kunnr = @gt_data-kunnr AND knvp~vkorg = @gt_data-vkorg.SORT lt_knvp BY vkorg kunnr parvw.LOOP AT gt_data ASSIGNING <fs_data>.<fs_data>-budat  = <fs_data>-transactiondate. "过账日期 = 交易日期"设置凭证的过账状态READ TABLE lt_bkpf INTO DATA(ls_bkpf) WITH  KEY  bukrs = <fs_data>-vkorg belnr = <fs_data>-belnr gjahr = <fs_data>-gjahr .IF sy-subrc = 0.<fs_data>-bstat = ls_bkpf-bstat.IF <fs_data>-bstat = 'V'.<fs_data>-status_inc_p = icon_led_yellow.ELSE.<fs_data>-status_inc_p = icon_led_green.ENDIF.ENDIF."SET送达方READ TABLE lt_knvp INTO DATA(ls_knvp) WITH  KEY  kunnr = <fs_data>-kunnr vkorg = <fs_data>-vkorg parvw = 'WE' BINARY SEARCH.IF sy-subrc = 0.<fs_data>-kunnr2 = ls_knvp-kunn2.ENDIF.*      "业务员
*      READ TABLE lt_knvp INTO ls_knvp       WITH  KEY  kunnr = <fs_data>-kunnr vkorg = <fs_data>-vkorg parvw = 'VE' BINARY SEARCH.
*      IF sy-subrc = 0.
*        SELECT SINGLE pa0001~sname,pa0001~pernr INTO @DATA(ls_pa0001) FROM pa0001 WHERE pernr = @ls_knvp-pernr.
*        <fs_data>-sname = ls_pa0001-sname.
*        <fs_data>-pernr = ls_pa0001-pernr.
*      ENDIF."SET业务员LOOP AT lt_knvp INTO ls_knvp  WHERE kunnr = <fs_data>-kunnr AND vkorg = <fs_data>-vkorg AND parvw = 'VE'.SELECT SINGLE pa0001~sname,pa0001~pernr INTO @DATA(ls_pa0001) FROM pa0001 WHERE pernr = @ls_knvp-pernr.DATA: len TYPE i.CONCATENATE ls_pa0001-sname <fs_data>-sname  INTO <fs_data>-sname SEPARATED BY ','.CONCATENATE ls_pa0001-pernr <fs_data>-pernr  INTO <fs_data>-pernr SEPARATED BY ','.ENDLOOP.CLEAR:len.len             = strlen( <fs_data>-sname ).len             = len - 1.IF <fs_data>-sname IS NOT INITIAL.<fs_data>-sname = <fs_data>-sname+0(len).ENDIF.CLEAR:len.len             = strlen( <fs_data>-pernr ).len             = len - 1.IF <fs_data>-pernr IS NOT INITIAL.<fs_data>-pernr = <fs_data>-pernr+0(len).ENDIF."SET银行过账科目配置表SELECT SINGLE * INTO @DATA(ls_ztsd017) FROM ztsd017WHERE ztsd017~vkorg    = @<fs_data>-vkorgAND ztsd017~waers    = @<fs_data>-tradecurrencyAND ztsd017~zaccount = @<fs_data>-zaccount.IF sy-subrc = 0.<fs_data>-hkont         = ls_ztsd017-hkont.         " 银行科目<fs_data>-hkont_in      = ls_ztsd017-hkont_in.      " 财务费用-银行手续费<fs_data>-kunnr_akont2  = ls_ztsd017-kunnr_akont2.  " 预收账款-外销DATA:lv_string_datetime TYPE syst-msgv1.CLEAR:lv_string_datetime.CALL FUNCTION 'ZFM_TOOLS_GET_STRINGDATE'EXPORTINGztype           = 'D'datum           = <fs_data>-transactiondateuzeit           = sy-uzeitIMPORTINGstring_datetime = lv_string_datetime."行项目文本CONCATENATE lv_string_datetime <fs_data>-kunnr ls_ztsd017-item_text INTO <fs_data>-item_text SEPARATED BY space.<fs_data>-acct_type     = ls_ztsd017-acct_type.   "账户类型<fs_data>-doc_type      = ls_ztsd017-doc_type.    "凭证类型<fs_data>-rstgr         = ls_ztsd017-rstgr.       "原因代码<fs_data>-rstgr_kunnr   = ls_ztsd017-rstgr_kunnr. "客户科目 不需要原因代码<fs_data>-xblnr         = ls_ztsd017-xblnr.       "参照<fs_data>-hkont_in2     = ls_ztsd017-hkont_in2.ENDIF.IF sy-mandt = '900'."SET成本中心IF <fs_data>-kunnr_desc_yh     IS NOT INITIAL AND <fs_data>-vkorg = '3020'.<fs_data>-kostl = '3020999999'.ELSEIF <fs_data>-kunnr_desc_yh IS NOT INITIAL AND <fs_data>-vkorg = '1010'.<fs_data>-kostl ='1010999999'.ENDIF.ELSE.<fs_data>-kostl = '1010010000'.ENDIF."SET STATUS LIGHT" 水单确认IF <fs_data>-zin = 'X'.<fs_data>-status_inc_i = icon_led_green.ENDIF." 推送OMSIF <fs_data>-za = 'P' .    "审批中<fs_data>-status_inc_a = icon_led_yellow.ELSEIF <fs_data>-za = 'F' ."审批完成<fs_data>-status_inc_a = icon_led_green.ENDIF." 凭证创建完成IF <fs_data>-zp = 'X' AND <fs_data>-bstat = 'V'.<fs_data>-status_inc_p = icon_led_yellow.ENDIF." 凭证创建完成IF <fs_data>-zp = 'X' AND <fs_data>-bstat = ''.<fs_data>-status_inc_p = icon_led_green.ENDIF." 清账完成IF <fs_data>-zc = 'X'.<fs_data>-status_inc_c = icon_led_green.ENDIF.ENDLOOP.ENDIF."SET财务待办单据IF p_0 = 'X'.DELETE gt_data WHERE zp = 'X'  AND bstat = ''."SET财务凭证已过账单据ELSEIF p_1 = 'X'.LOOP AT gt_data ASSIGNING <fs_data>.IF <fs_data>-zp = 'X' AND <fs_data>-bstat = ''.ELSE.DELETE  gt_data.ENDIF.ENDLOOP."SET所有的单据ELSEIF p_2 = 'X'.ENDIF."Addded by zhong on 20221129 添加排序SORT gt_data BY zname transactiondate." SET Index of ListLOOP AT gt_data ASSIGNING <fs_data>.<fs_data>-zindex = sy-tabix.ENDLOOP.ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  GET_DATA_FOR_BSID
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_data_for_bsid .SELECTbsid~bukrs,"公司代码bsid~kunnr,"客户bsid~umsks,"事务类型bsid~umskz,"特别总账标识bsid~augdt,"结算bsid~augbl,"清帐凭证bsid~zuonr,"分配bsid~gjahr,"财年bsid~belnr,"凭证编号bsid~buzei,"行项目bsid~budat,"过帐日期bsid~bldat,"凭证日期bsid~cpudt,"录入日期bsid~waers,"货币bsid~xblnr,"参照bsid~blart,"凭证类型bsid~monat,"期间bsid~bschl,"记帐代码bsid~zumsk,"特别总帐标志bsid~shkzg,"借方/贷方bsid~gsber,"业务范围bsid~mwskz,"税码bsid~dmbtr,"本位币金额bsid~wrbtr,"金额bsid~mwsts,"LC 税额bsid~wmwst,"税额bsid~bdiff,"估价差额bsid~bdif2,"估价差额 2bsid~sgtxt,"文本bsid~projn,"未在使用中的bsid~aufnr,"订单bsid~anln1,"资产bsid~anln2,"次级编号bsid~saknr,"总帐科目bsid~hkont,"总帐bsid~fkont,"财务预算bsid~filkd,"分支bsid~zfbdt,"基限日期bsid~zterm,"付款条件bsid~zbd1t,"天数 1bsid~zbd2t,"天数 2bsid~zbd3t,"天内净额bsid~zbd1p,"折扣百分比 1bsid~zbd2p"折扣百分比 2INTO CORRESPONDING FIELDS OF TABLE  @lt_bsid  FROM bsid WHERE bsid~bukrs  IN @so_vkorg AND bsid~kunnr  IN @so_kunnr.ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  GET_DATA_FOR_BSID_BY2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_SO_VKORG_LOW  text
*      -->P_SO_VKORG_HIGH  text
*----------------------------------------------------------------------*
FORM get_data_for_bsid_by2  USING    p_vkorg TYPE vkorgp_kunnr TYPE kunnr.SELECTbsid~bukrs,"公司代码bsid~kunnr,"客户bsid~umsks,"事务类型bsid~umskz,"特别总账标识bsid~augdt,"结算bsid~augbl,"清帐凭证bsid~zuonr,"分配bsid~gjahr,"财年bsid~belnr,"凭证编号bsid~buzei,"行项目bsid~budat,"过帐日期bsid~bldat,"凭证日期bsid~cpudt,"录入日期bsid~waers,"货币bsid~xblnr,"参照bsid~blart,"凭证类型bsid~monat,"期间bsid~bschl,"记帐代码bsid~zumsk,"特别总帐标志bsid~shkzg,"借方/贷方bsid~gsber,"业务范围bsid~mwskz,"税码bsid~dmbtr,"本位币金额bsid~wrbtr,"金额bsid~mwsts,"LC 税额bsid~wmwst,"税额bsid~bdiff,"估价差额bsid~bdif2,"估价差额 2bsid~sgtxt,"文本bsid~projn,"未在使用中的bsid~aufnr,"订单bsid~anln1,"资产bsid~anln2,"次级编号bsid~saknr,"总帐科目bsid~hkont,"总帐bsid~fkont,"财务预算bsid~filkd,"分支bsid~zfbdt,"基限日期bsid~zterm,"付款条件bsid~zbd1t,"天数 1bsid~zbd2t,"天数 2bsid~zbd3t,"天内净额bsid~zbd1p,"折扣百分比 1bsid~zbd2p"折扣百分比 2INTO CORRESPONDING FIELDS OF TABLE  @lt_bsid  FROM bsid WHEREbsid~bukrs = @p_vkorgAND bsid~kunnr = @p_kunnrAND bsid~blart = 'RV'.ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  DEAR_DATA_FOR_BSID
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_SO_VKORG_LOW  text
*      -->P_SO_KUNNR_HIGH  text
*----------------------------------------------------------------------*
FORM dear_data_for_bsid  USING   p_vkorg TYPE vkorgp_kunnr TYPE kunnr.DATA:lv_exit TYPE c." 清账匹配TYPES:BEGIN OF ly_sum_month,bukrs   TYPE  bsid-bukrs, "公司代码kunnr   TYPE  bsid-kunnr, "客户zmonth  TYPE num10,wrbtr   TYPE  bsid-wrbtr, "金额zstatus TYPE  c, "IDzid     TYPE ztsd015-zid, "IDEND OF ly_sum_month.DATA:ls_sum_month TYPE ly_sum_month.DATA:lt_sum_month TYPE TABLE OF ly_sum_month.FIELD-SYMBOLS: <fs_summ>  TYPE  ly_sum_month.SORT lt_bsid BY bukrs kunnr ASCENDING  bldat ASCENDING." 对不同凭证类型的处理 @TODO -----------" RV h s 分配号相同冲销DATA(lt_bsid_s) = lt_bsid.DATA(lt_bsid_h) = lt_bsid.REFRESH :lt_bsid.DELETE lt_bsid_s WHERE shkzg = 'H'.DELETE lt_bsid_h WHERE shkzg = 'S'.LOOP AT lt_bsid_s ASSIGNING <fs_bsid> WHERE bukrs = p_vkorg AND kunnr = p_kunnr AND zstatus = '' AND shkzg = 'S'.READ TABLE lt_bsid_h ASSIGNING FIELD-SYMBOL(<fs_bsid_h>) WITH  KEY xblnr = <fs_bsid>-xblnr wrbtr = <fs_bsid>-wrbtr.IF sy-subrc = 0.
*      <fs_bsid>-zstatus        = 'X'.<fs_bsid>-status_inc_c   = icon_led_green.
*      <fs_bsid_h>-zstatus      = 'X'.<fs_bsid_h>-status_inc_c = icon_led_green. " 可被清账提示灯ENDIF.APPEND <fs_bsid> TO lt_bsid.ENDLOOP.*  LOOP AT lt_bsid_h ASSIGNING <fs_bsid> WHERE bukrs = p_vkorg AND kunnr = p_kunnr AND shkzg = 'H'.
*    <fs_bsid>-wrbtr = <fs_bsid>-wrbtr  * -1.
*    <fs_bsid>-dmbtr = <fs_bsid>-dmbtr  * -1.
*    APPEND <fs_bsid> TO lt_bsid.
*  ENDLOOP.
*
*
*  "1,单笔发票金额 = 收款金额
*  LOOP AT lt_bsid ASSIGNING <fs_bsid> WHERE bukrs = p_vkorg AND kunnr = p_kunnr AND zstatus = ''.
*    "检查被锁定的情况
*    SELECT SINGLE * FROM ztsd018 INTO @DATA(ls_ztsd018) WHERE ztsd018~za = 'P'
*      AND ztsd018~bukrs = @p_vkorg
*      AND ztsd018~gjahr = @<fs_bsid>-gjahr
*      AND ztsd018~belnr = @<fs_bsid>-belnr
*      AND ztsd018~buzei = @<fs_bsid>-buzei.
*
*    IF ls_ztsd018 IS NOT INITIAL.
*      <fs_bsid>-status_inc_a = icon_locked.
*      <fs_bsid>-zstatus  = 'X'.
*      <fs_bsid>-zid      = <fs_data>-zid.
*      <fs_bsid>-in_wrbtr = <fs_bsid>-wrbtr.
*      CLEAR:ls_ztsd018.
*      lv_exit = 'R'.
*      CONTINUE.
*    ENDIF.
*  ENDLOOP.
*
*  IF lv_exit = 'R'.
*    CLEAR: lv_exit.
*    RETURN.
*  ENDIF.
*
*
*  SORT lt_bsid BY bukrs kunnr xblnr ASCENDING  bldat ASCENDING.
*  "1,单笔发票金额 = 收款金额
*  LOOP AT lt_bsid ASSIGNING <fs_bsid> WHERE bukrs = p_vkorg AND kunnr = p_kunnr AND zstatus = ''.
*
*    <fs_bsid>-zmonth = <fs_bsid>-budat+0(6).
*
*    READ TABLE gt_data ASSIGNING <fs_data> WITH  KEY checked = 'X' vkorg = <fs_bsid>-bukrs  kunnr = <fs_bsid>-kunnr wrbtr = <fs_bsid>-wrbtr zstatus = ''.
*    IF sy-subrc = 0.
*
*      <fs_bsid>-zstatus  = 'X'.
*      <fs_bsid>-zid      = <fs_data>-zid.
*      <fs_bsid>-in_wrbtr = <fs_bsid>-wrbtr.
*      <fs_bsid>-status_inc_a = icon_unlocked.
*
*      <fs_data>-zstatus  = 'X'.
*      <fs_data>-wrbtr2   = <fs_bsid>-wrbtr.
*      <fs_data>-wrbtr3   = '0'.
*
*    ELSE.
*
*      <fs_bsid>-zmonth      = <fs_bsid>-budat+0(6).
*
*      ls_sum_month-zmonth   = <fs_bsid>-zmonth.
*      ls_sum_month-wrbtr    = <fs_bsid>-wrbtr.
*      ls_sum_month-bukrs    = <fs_bsid>-bukrs.
*      ls_sum_month-kunnr    = <fs_bsid>-kunnr.
*      COLLECT ls_sum_month INTO lt_sum_month.
*    ENDIF.
*
*  ENDLOOP.*    "2,应收月份 sum(IN) = 单笔流水---
*
*    LOOP AT lt_sum_month ASSIGNING <fs_summ>.
*      READ TABLE gt_data ASSIGNING <fs_data> WITH  KEY vkorg = <fs_summ>-bukrs  kunnr = <fs_summ>-kunnr wrbtr = <fs_summ>-wrbtr zstatus = ''.
*      IF sy-subrc = 0.
*        <fs_summ>-zstatus = 'X'.
*        <fs_summ>-zid     = <fs_data>-zid.
*        <fs_data>-zstatus  = 'X'.
*        <fs_data>-wrbtr2   = <fs_bsid>-wrbtr.
*        <fs_data>-wrbtr3   = '0'.
*      ENDIF.
*    ENDLOOP.
*
*    LOOP AT lt_sum_month ASSIGNING <fs_summ> WHERE zstatus = 'X'.
*      LOOP AT lt_bsid ASSIGNING <fs_bsid> WHERE zmonth = <fs_summ>-zmonth AND bukrs = <fs_summ>-bukrs AND wrbtr = <fs_summ>-wrbtr AND zstatus = ''.
*        <fs_bsid>-zstatus  = 'X'.
*        <fs_bsid>-zid      = <fs_summ>-zid.
*        <fs_bsid>-in_wrbtr = <fs_bsid>-wrbtr.
*
*
*        <fs_data>-zstatus  = 'X'.
*        <fs_data>-wrbtr2   = <fs_bsid>-wrbtr.
*        <fs_data>-wrbtr3   = '0'.
*      ENDLOOP.
*    ENDLOOP.*  "3,顺冲
*  DATA:lv_wrbtr TYPE bsid-wrbtr.
*
*
*  LOOP AT  gt_data ASSIGNING <fs_data> WHERE checked = 'X' AND zstatus = '' .
*
*    lv_wrbtr = <fs_data>-wrbtr.
*    lv_exit  = ''.
*    DO 20 TIMES.
*
*      LOOP AT lt_bsid ASSIGNING <fs_bsid> WHERE  zstatus = '' AND bukrs = p_vkorg AND kunnr = p_kunnr.
*        IF lv_wrbtr > <fs_bsid>-wrbtr. " 收款金额大于发票金额
*
*          lv_wrbtr = lv_wrbtr - <fs_bsid>-wrbtr.
*          <fs_bsid>-zstatus  = 'X'.
*          <fs_bsid>-zid      = <fs_data>-zid.
*          <fs_bsid>-in_wrbtr = <fs_bsid>-wrbtr.
*
*          <fs_bsid>-status_inc_a = icon_unlocked.
*
*          <fs_data>-wrbtr2   = <fs_bsid>-wrbtr + <fs_data>-wrbtr2.
*          <fs_data>-wrbtr3   = <fs_data>-wrbtr - <fs_data>-wrbtr2.
*
*        ELSEIF   lv_wrbtr = <fs_bsid>-wrbtr. " 收款金额 = 发票金额
*
*          <fs_bsid>-zstatus  = 'X'.
*          <fs_bsid>-zid      = <fs_data>-zid.
*          <fs_bsid>-in_wrbtr = <fs_bsid>-wrbtr.
*
*          <fs_bsid>-status_inc_a = icon_unlocked.
*
*          <fs_data>-zstatus  = 'X'.
*          <fs_data>-wrbtr2   = <fs_bsid>-wrbtr + <fs_data>-wrbtr2.
*          <fs_data>-wrbtr3   = <fs_data>-wrbtr  - <fs_data>-wrbtr2.
*
*        ELSE. " 单笔收款还有剩
*          lv_exit = 'R'.
*          EXIT.
*        ENDIF.
*
*      ENDLOOP.
*
*      IF  lv_exit = 'R'.
*        EXIT.
*      ENDIF.
*
*    ENDDO.
*
*  ENDLOOP.SORT lt_bsid BY blart bukrs kunnr bldat belnr buzei  xblnr.ENDFORM.FORM  lock_record  USING  p_key .DATA : it_seqg3  TYPE  seqg3  OCCURS  01  WITH HEADER LINE .DATA : gname LIKE  seqg3-gname,garg  LIKE  seqg3-garg.DATA : BEGIN OF ls_ztsd015 ,mandt TYPE  ztsd015-mandt,zid   TYPE  ztsd015-zid,END OF  ls_ztsd015 .
*---锁定函数初始化:CALL  'C_ENQ_WILDCARD'  ID  'HEX0'  FIELD  ls_ztsd015 .*---对关键字的赋值MOVE  sy-mandt TO ls_ztsd015-mandt .MOVE  p_key    TO ls_ztsd015-zid .gname  =  'ZTSD015' .garg   =  ls_ztsd015 .*---读取是否已经被锁定CALL FUNCTION 'ENQUEUE_READ'EXPORTINGgclient = sy-mandtgname   = gnamegarg    = gargTABLESenq     = it_seqg3.IF  sy-subrc <>  0 .MESSAGE ID  sy-msgid  TYPE  sy-msgty  NUMBER  sy-msgno  WITH  sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .ENDIF .IF  it_seqg3  IS NOT INITIAL .DATA:lt_list_mess  TYPE esp1_message_tab_type  WITH HEADER LINE .DATA:lv_verid      TYPE char32.SELECT SINGLE  * INTO @DATA(ls_015) FROM ztsd015 WHERE zid = @p_key.CONCATENATE  ls_015-transactionno  ' 正由 '  it_seqg3-guname  ' 处理 !'  INTO  lv_verid .lt_list_mess-msgty  = 'E' .lt_list_mess-msgv1  = lv_verid.lt_list_mess-msgid  = 'ZMC01'.lt_list_mess-msgno  = '000'.APPEND lt_list_mess.IF lt_list_mess[] IS NOT INITIAL.CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'TABLESi_message_tab = lt_list_mess.STOP.LEAVE TO SCREEN 0.EXIT.*        DATA: lv_answer TYPE string.              "用于存储用户选择
*        CALL FUNCTION 'POPUP_TO_DECIDE_WITH_MESSAGE'
*          EXPORTING
*            diagnosetext1 = ''  "诊断文本的第一行
*            textline1     = ''         "弹出窗口的第一行,设置文本行内容1
*            text_option1  = '继续打印'      "选项 1 的文本。
*            text_option2  = '退出打印'  "选项 2 的文本。
*            titel         = '提示框'  "设置标题
*          IMPORTING
*            answer        = lv_answer.  "获得用户选择,这里返回的值对应是当前列表NO,比如第一个就返回1,第二个返回2
*
*        IF lv_answer = 'A' OR lv_answer = '2'.
*          STOP.
*          LEAVE TO LIST-PROCESSING.EXIT.
*        ENDIF.ENDIF.ELSE .
*---开始锁定记录
*加锁时,不管这个表中有没有这个条目,都会加锁成功(即sy-subrc = 0)。加锁后,再操作同一条目,会提示XXX正在处理!CALL FUNCTION 'ENQUEUE_EZTSD015'EXPORTINGmode_ztsd015   = 'E'mandt          = sy-mandtzid            = p_keyx_zid          = ''_scope         = '2'_wait          = ''_collect       = ''EXCEPTIONSforeign_lock   = 1system_failure = 2OTHERS         = 3.IF  sy-subrc <>  0 .MESSAGE ID  sy-msgid  TYPE  sy-msgty  NUMBER  sy-msgno  WITH  sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .ENDIF .ENDIF .
ENDFORM .                     "lock_record*------------------------------ 解鎖 -------------------------------------
FORM  unlock_record  USING  p_key .CALL FUNCTION 'DEQUEUE_EZTSD015'EXPORTINGmode_ztsd015 = 'E'mandt        = sy-mandtzid          = p_keyx_zid        = ''_scope       = '3'_synchron    = ''_collect     = ''.ENDFORM.                    "unlock_record*&---------------------------------------------------------------------*
*&  包含                ZFI068_PBO
*&---------------------------------------------------------------------*FORM pf_status USING i_it_extab TYPE slis_t_extab.REFRESH:i_it_extab.IF p_inp = 'X'. " 导入SET TITLEBAR 'ZSTATUS_TITLE'.
*    APPEND 'ZSAVE'  TO i_it_extab.APPEND 'ZCSAVE' TO i_it_extab.APPEND 'ZDEL'   TO i_it_extab.
*    APPEND 'ZSAL'   TO i_it_extab.
*    APPEND 'ZALL'   TO i_it_extab.
*    APPEND 'ZSAVE1'   TO i_it_extab.SET PF-STATUS 'ZSTATUS_001' EXCLUDING i_it_extab.ENDIF.IF p_sel2 = 'X'."查询SET TITLEBAR 'ZSTATUS_TITLE'.APPEND 'ZSAVE'  TO i_it_extab.APPEND 'ZCSAVE' TO i_it_extab.APPEND 'ZDEL'   TO i_it_extab.APPEND 'ZSAL'   TO i_it_extab.APPEND 'ZALL'   TO i_it_extab.APPEND 'ZSAVE1'   TO i_it_extab.SET PF-STATUS 'ZSTATUS_001' EXCLUDING i_it_extab.ENDIF.ENDFORM.*&---------------------------------------------------------------------*
*&  包含                ZFI068_PAI
*&---------------------------------------------------------------------*FORM user_command USING i_ucomm TYPE sy-ucommi_wa_selfield TYPE slis_selfield.DATA:gwa_edit TYPE lvc_s_styl,git_edit TYPE lvc_t_styl.DATA lv_length TYPE num10.DATA lr_grid TYPE REF TO cl_gui_alv_grid.CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'IMPORTINGe_grid = lr_grid.CALL METHOD lr_grid->check_changed_data.CALL METHOD lr_grid->refresh_table_display.i_wa_selfield-refresh = 'X'.CASE i_ucomm.WHEN  'ZSAVE'. " 流水导入DATA:lt_ztsd015 TYPE TABLE OF ztsd015.DATA:ls_ztsd015 TYPE  ztsd015.DATA:lt_ztsd016 TYPE TABLE OF ztsd016.DATA:ls_ztsd016 TYPE  ztsd016.LOOP AT gt_data ASSIGNING <fs_data> WHERE checked = 'X' AND status = ''." 1,检查 交易流水号在数据库中是否存在 - 写入前检查 ,第二次预防SELECT SINGLE * INTO @DATA(ls_cc) FROM ztsd015 WHERE ztsd015~transactionno = @<fs_data>-transactionno.IF sy-subrc = 0.<fs_data>-status     = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message    = '导入失败,交易流水已存在'.CONTINUE.ENDIF.CLEAR:  ls_ztsd015.REFRESH:lt_ztsd015.<fs_data>-modifiedby  = sy-uname.<fs_data>-modifiydate = sy-datum.<fs_data>-modifiytime = sy-uzeit.<fs_data>-zin         = 'X'.CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c32RECEIVINGuuid = <fs_data>-zid.MOVE-CORRESPONDING <fs_data> TO ls_ztsd015.*        SELECT SINGLE * INTO @DATA(ls_kna1) FROM kna1 WHERE kna1~kunnr = @ls_ztsd015-kunnr.
*
*        ls_ztsd015-kunnr_desc_yh = <fs_data>-kunnr_desc_yh.
*        ls_ztsd015-kunnr_desc    = ls_kna1-name1.APPEND ls_ztsd015 TO lt_ztsd015.MODIFY ztsd015 FROM TABLE lt_ztsd015.IF sy-subrc = 0.<fs_data>-status     = 'S'.<fs_data>-status_inc = icon_led_green.<fs_data>-message    = '导入成功'.ELSE.<fs_data>-status     = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-message    = '导入失败'.ENDIF."2,记录关键词IF <fs_data>-ztrue <> 'X'.MOVE-CORRESPONDING <fs_data> TO ls_ztsd016.ls_ztsd016-kunnr_desc  = <fs_data>-kunnr_desc_yh.ls_ztsd016-modifiedby  = sy-uname.ls_ztsd016-modifiydate = sy-datum.ls_ztsd016-modifiytime = sy-uzeit.MODIFY ztsd016 FROM  ls_ztsd016.ELSE.SELECT SINGLE * INTO ls_ztsd016 FROM ztsd016 WHERE ztsd016~vkorg = <fs_data>-vkorg AND  ztsd016~kunnr = <fs_data>-kunnrAND   ztsd016~kunnr_desc = <fs_data>-kunnr_desc_yh .ls_ztsd016-ztimes = ls_ztsd016-ztimes + 1.MODIFY ztsd016 FROM  ls_ztsd016.ENDIF.ENDLOOP.WHEN 'ZSEND'. "推送OMS 发邮件 外销PERFORM send_email USING '1'.WHEN 'ZSAVE1'."推送OMS 发邮件 内销PERFORM send_email USING '2'.WHEN 'ZDEL'.WHEN 'ZSAL'.LOOP AT gt_data ASSIGNING <fs_data>.<fs_data>-checked = ''.ENDLOOP.WHEN 'ZALL'.LOOP AT gt_data ASSIGNING <fs_data>.<fs_data>-checked = 'X'.ENDLOOP.WHEN OTHERS.ENDCASE.ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  SEND_EMAIL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM send_email USING p_type.DATA: obj_exception TYPE REF TO cx_ai_system_fault.DATA: lo_zws3co     TYPE REF TO zws3co_create_workflow_service. "CLASS名*CREATE OBJECT lo_zws3co. "创建对象DATA:in               TYPE  zws2create_worlflow1,ls_parameters_in TYPE  zws2create_worlflow.DATA:out               TYPE  zws2create_worlflow_response1,ls_parameters_out TYPE  zws2create_worlflow_response,ls_return         TYPE  zws2create_workflow_vo.DATA:json_ser TYPE REF TO cl_trex_json_serializer,json_des TYPE REF TO cl_trex_json_deserializer.LOOP AT  gt_data ASSIGNING <fs_data> WHERE checked  = 'X'  .*        MESSAGE '功能开发中' TYPE 'I'.
*        CONTINUE."推送OMS数据准备CALL METHOD /ui2/cl_json=>serializeEXPORTINGdata   = <fs_data>RECEIVINGr_json = ls_parameters_in-header.ls_parameters_in-business_id = 'RECEIPT_EMAIL_ALL'.ls_parameters_in-send_time   = sy-datum && sy-uzeit.ls_parameters_in-from        = 'SAP'.ls_parameters_in-to          = 'OMS'.IF p_type = '1'.      "外销ls_parameters_in-string2     = 'fi25@chengyi.com'.ls_parameters_in-string3     = 'Fi5516018'.ls_parameters_in-string4     = 'gwmy@chengyi.com,zkyw@chengyi.com'.ls_parameters_in-string5     = '黄培芳#联系人:黄培芳#联系电话:2081 / 188-5966-8381'.ELSEIF p_type = '2'.  "内销ls_parameters_in-string2     = 'fi26@chengyi.com'.ls_parameters_in-string3     = 'Cy5358979'.ls_parameters_in-string4     = 'gwmy@chengyi.com'.ls_parameters_in-string5     = '李汝樱#联系人:李汝樱#联系电话:2075'.ENDIF.IF sy-mandt = '300'.MESSAGE '300系统不允许发邮件' TYPE 'I' .RETURN.ENDIF.in-parameters                   = ls_parameters_in.TRY.CALL METHOD lo_zws3co->create_worlflowEXPORTINGcreate_worlflow          = inIMPORTINGcreate_worlflow_response = out.CATCH cx_ai_system_fault INTO obj_exception." 接口创建失败CALL METHOD obj_exception->get_textRECEIVINGresult = ls_return-message.<fs_data>-status_inc = icon_led_red.<fs_data>-status     = 'E'.<fs_data>-message    = 'SAP连接OMS异常,请联系管理员|' && ls_return-message.ENDTRY."记录推送LogDATA:lv_text5 TYPE string.DATA:lv_text6 TYPE string.CALL METHOD /ui2/cl_json=>serializeEXPORTINGdata   = ls_parameters_in-headerRECEIVINGr_json = lv_text5.CALL FUNCTION 'ZFM_TOOLS_SAVELOG'EXPORTINGprogramcode = 'ZSD076_2'
*       TCODE       = SY-TCODE
*       CREATEBY    = SY-UNAME
*       CREATEDATE  = SY-DATUM
*       CREATETIME  = SY-UZEITtext1       = '付款单邮件通知推送'
*       text2       =
*       TEXT3       =
*       TEXT4       =text5       = lv_text5text6       = lv_text6.IF out IS NOT INITIAL."解析接口返回的信息ls_parameters_out   = out-parameters.ls_return           = ls_parameters_out-return.IF ls_return-status = 'S'." 接口同步成功-单据创建成功<fs_data>-status_inc   = icon_led_green.<fs_data>-status       = 'S'.<fs_data>-message      = '发送成功'.
*            UPDATE ztsd015 SET za = 'P'  WHERE zid = <fs_data>-zid.ELSE. " 接口同步成功-单据创建失败<fs_data>-status_inc = icon_led_red.<fs_data>-status     = ls_return-status.<fs_data>-message    = ls_return-message.ENDIF.ENDIF.ENDLOOP.ENDFORM.*&---------------------------------------------------------------------*
*&  包含                ZSD076_9001
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_9001  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9001 OUTPUT.SET PF-STATUS 'ZSTATUS_9001'.SET TITLEBAR  'ZSTATUS_TITLE'.
ENDMODULE.*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9001 INPUT.CASE ok_code.WHEN 'EXPORT'.
** 导出特定格式的excelWHEN '&F03' OR '&F15' OR '&F13'.LOOP AT gt_data INTO gs_data.PERFORM unlock_record USING  gs_data-zid.ENDLOOP.LEAVE TO SCREEN 0.WHEN 'ZTOOMS'. " 推送OMSDATA: obj_exception TYPE REF TO cx_ai_system_fault.DATA: lo_zws3co     TYPE REF TO zws3co_create_workflow_service. "CLASS名*CREATE OBJECT lo_zws3co. "创建对象DATA:in               TYPE  zws2create_worlflow1,ls_parameters_in TYPE  zws2create_worlflow.DATA:out               TYPE  zws2create_worlflow_response1,ls_parameters_out TYPE  zws2create_worlflow_response,ls_return         TYPE  zws2create_workflow_vo.DATA:json_ser TYPE REF TO cl_trex_json_serializer,json_des TYPE REF TO cl_trex_json_deserializer.LOOP AT  gt_data ASSIGNING <fs_data> WHERE checked  = 'X' AND  zin = 'X' AND  za = '' .CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = <fs_data>-kunnrIMPORTINGoutput = <fs_data>-kunnr."推送OMS数据准备CALL METHOD /ui2/cl_json=>serializeEXPORTINGdata   = <fs_data>RECEIVINGr_json = ls_parameters_in-header.ls_parameters_in-business_id = 'RECEIPT'.ls_parameters_in-send_time   = sy-datum && sy-uzeit.ls_parameters_in-from        = 'SAP'.ls_parameters_in-to          = 'OMS'.ls_parameters_in-string1     = <fs_data>-pernr. "业务员编号IF <fs_data>-modifiedby = 'FI097'.      "外销ls_parameters_in-string2     = 'fi25@chengyi.com'.ls_parameters_in-string3     = 'Fi5516018'.ls_parameters_in-string4     = 'gwmy@chengyi.com,zkyw@chengyi.com'.ls_parameters_in-string5     = '黄培芳#联系人:黄培芳#联系电话:2081 / 188-5966-8381'.ELSE . "内销ls_parameters_in-string2     = 'fi26@chengyi.com'.ls_parameters_in-string3     = 'Cy5358979'.ls_parameters_in-string4     = 'gwmy@chengyi.com'.ls_parameters_in-string5     = '李汝樱#联系人:李汝樱#联系电话:2075'.ENDIF.in-parameters                = ls_parameters_in.TRY.CALL METHOD lo_zws3co->create_worlflowEXPORTINGcreate_worlflow          = inIMPORTINGcreate_worlflow_response = out.CATCH cx_ai_system_fault INTO obj_exception." 接口创建失败CALL METHOD obj_exception->get_textRECEIVINGresult = ls_return-message.<fs_data>-status_inc = icon_led_red.<fs_data>-status     = 'E'.<fs_data>-message    = 'SAP连接OMS异常,请联系管理员|' && ls_return-message.ENDTRY.IF out IS NOT INITIAL."解析接口返回的信息ls_parameters_out        = out-parameters.ls_return                = ls_parameters_out-return.IF ls_return-status = 'S'." 接口同步成功-单据创建成功<fs_data>-status_inc   = icon_led_green.<fs_data>-status       = ls_return-status."Test by zhong on 20220719<fs_data>-status_inc_a = icon_led_yellow.<fs_data>-status       = 'S'.<fs_data>-message      = '发送成功'.UPDATE ztsd015 SET za = 'P'  WHERE zid = <fs_data>-zid.ELSE. " 接口同步成功-单据创建失败<fs_data>-status_inc = icon_led_red.<fs_data>-status     = ls_return-status.<fs_data>-message    = ls_return-message.ENDIF.ENDIF."记录推送LogDATA:lv_text5 TYPE string.DATA:lv_text6 TYPE string.CALL METHOD /ui2/cl_json=>serializeEXPORTINGdata   = ls_parameters_in-headerRECEIVINGr_json = lv_text5.CALL FUNCTION 'ZFM_TOOLS_SAVELOG'EXPORTINGprogramcode = 'ZSD076_1'
*           TCODE       = SY-TCODE
*           CREATEBY    = SY-UNAME
*           CREATEDATE  = SY-DATUM
*           CREATETIME  = SY-UZEITtext1       = '付款单推送'
*           text2       =
*           TEXT3       =
*           TEXT4       =text5       = lv_text5text6       = lv_text6.ENDLOOP.WHEN 'ZREOMS'.*      DATA: obj_exception TYPE REF TO cx_ai_system_fault.
*      DATA: lo_zws3co     TYPE REF TO zws3co_create_workflow_service. "CLASS名*CREATE OBJECT lo_zws3co. "创建对象
*      DATA:in               TYPE  zws2create_worlflow1,
*           ls_parameters_in TYPE  zws2create_worlflow.
*      DATA:out               TYPE  zws2create_worlflow_response1,
*           ls_parameters_out TYPE  zws2create_worlflow_response,
*           ls_return         TYPE  zws2create_workflow_vo.
*      DATA:json_ser TYPE REF TO cl_trex_json_serializer,
*           json_des TYPE REF TO cl_trex_json_deserializer.LOOP AT  gt_data ASSIGNING <fs_data> WHERE checked  = 'X' AND  zin = 'X' AND  za = 'F' AND zp = '' .*        MESSAGE '功能开发中' TYPE 'I'.
*        CONTINUE."推送OMS数据准备CALL METHOD /ui2/cl_json=>serializeEXPORTINGdata   = <fs_data>RECEIVINGr_json = ls_parameters_in-header.ls_parameters_in-business_id = 'RECEIPT_RETURN'.ls_parameters_in-send_time   = sy-datum && sy-uzeit.ls_parameters_in-from        = 'SAP'.ls_parameters_in-to          = 'OMS'.ls_parameters_in-string1     = <fs_data>-pernr. "业务员编号in-parameters                = ls_parameters_in.TRY.CALL METHOD lo_zws3co->create_worlflowEXPORTINGcreate_worlflow          = inIMPORTINGcreate_worlflow_response = out.CATCH cx_ai_system_fault INTO obj_exception." 接口创建失败CALL METHOD obj_exception->get_textRECEIVINGresult = ls_return-message.<fs_data>-status_inc = icon_led_red.<fs_data>-status     = 'E'.<fs_data>-message    = 'SAP连接OMS异常,请联系管理员|' && ls_return-message.ENDTRY.*        "记录推送Log
*        DATA:lv_text5 TYPE string.
*        DATA:lv_text6 TYPE string.CALL METHOD /ui2/cl_json=>serializeEXPORTINGdata   = ls_parameters_in-headerRECEIVINGr_json = lv_text5.CALL FUNCTION 'ZFM_TOOLS_SAVELOG'EXPORTINGprogramcode = 'ZSD076_2'
*           TCODE       = SY-TCODE
*           CREATEBY    = SY-UNAME
*           CREATEDATE  = SY-DATUM
*           CREATETIME  = SY-UZEITtext1       = '付款单退回'
*           text2       =
*           TEXT3       =
*           TEXT4       =text5       = lv_text5text6       = lv_text6.IF out IS NOT INITIAL."解析接口返回的信息ls_parameters_out        = out-parameters.ls_return                = ls_parameters_out-return.IF ls_return-status = 'S'." 接口同步成功-单据创建成功<fs_data>-status_inc   = icon_led_green.<fs_data>-status       = ls_return-status."Test by zhong on 20220719<fs_data>-status_inc_a = icon_led_yellow.<fs_data>-status       = 'S'.<fs_data>-message      = '发送成功'.UPDATE ztsd015 SET za = 'P'  WHERE zid = <fs_data>-zid.DELETE FROM ztsd018  WHERE ztsd015_id = <fs_data>-zid.ELSE. " 接口同步成功-单据创建失败<fs_data>-status_inc = icon_led_red.<fs_data>-status     = ls_return-status.<fs_data>-message    = ls_return-message.ENDIF.ENDIF.ENDLOOP.WHEN 'ZPOST'. " 凭证过账"1, 创建之前 检查收款流水 是否符合创建凭证"2,创建收款凭证"3, 3.1 收款银行科目指定 ,3.2 客户统驭科目指定  3.3 文本 内容 3.4 抬头参照DATA: gs_documentheader    TYPE bapiache09,   "表头gs_customercpd       TYPE bapiacpa09,   "会计记帐: 业务伙伴开票凭证 (可接收负载)gs_fica_hd           TYPE bapiaccahd,   "应收和应付附加合同帐户表头行gt_accountreceivable TYPE TABLE OF bapiacar09,     "客户项目gs_accountreceivable TYPE  bapiacar09,     "客户项目gt_accountgl         TYPE TABLE OF bapiacgl09 ,    "总帐科目gs_accountgl         TYPE  bapiacgl09 ,    "总帐科目gt_accounttax        TYPE TABLE OF bapiactx09 ,    "税务项目gs_accounttax        TYPE  bapiactx09 ,    "税务项目gt_criteria          TYPE TABLE OF bapiackec9 ,    "会计记帐:CO-PA 科目分配特性gs_criteria          TYPE  bapiackec9 ,    "会计记帐:CO-PA 科目分配特性gt_valuefield        TYPE TABLE OF bapiackev9 ,    "会计记帐:CO-PA 科目分配值字段gs_valuefield        TYPE  bapiackev9 ,    "会计记帐:CO-PA 科目分配值字段gt_currencyamount    TYPE TABLE OF bapiaccr09 ,    "货币项目gs_currencyamount    TYPE  bapiaccr09 ,    "货币项目gt_return            TYPE TABLE OF bapiret2   ,    "返回参数gs_return            TYPE  bapiret2   ,    "返回参数gt_receivers         TYPE TABLE OF bdi_logsys ,    "传输逻辑系统的结gs_receivers         TYPE  bdi_logsys ,    "传输逻辑系统的结gt_fica_it           TYPE TABLE OF bapiaccait ,    "应收和应付附加合同帐户行项目gs_fica_it           TYPE  bapiaccait ,    "应收和应付附加合同帐户行项目gt_accountpayable    TYPE TABLE OF bapiacap09 ,    "供应商项目gs_accountpayable    TYPE  bapiacap09 ,    "供应商项目gt_paymentcard       TYPE TABLE OF bapiacpc09 ,    "付款卡信息gs_paymentcard       TYPE  bapiacpc09 ,    "付款卡信息gt_extension1        TYPE TABLE OF bapiacextc ,    "客户退出' 参数的容器gs_extension1        TYPE  bapiacextc ,    "客户退出' 参数的容器gt_realestate        TYPE TABLE OF bapiacre09 ,    "不动产科目分配数据gs_realestate        TYPE  bapiacre09 ,    "不动产科目分配数据gt_extension2        TYPE TABLE OF bapiparex  ,    "BAPI 参数 ExtensionIn/ExtensionOut 的参考结构gs_extension2        TYPE bapiparex  .    "BAPI 参数 ExtensionIn/ExtensionOut 的参考结构DATA: wa_zexten LIKE zexten_fi. "就是刚才se11创建的那个结构DATA:lv_type    TYPE c,lv_message TYPE char255.DATA:lv_posnr_acc TYPE posnr_acc.DATA:lv_item_text TYPE ztsd017-item_text.DATA:lv_bstat TYPE c.DATA:lv_doc_status TYPE c.lv_bstat      = 'V'.lv_doc_status = '2'." Added by zhong on 20221208TYPES:BEGIN OF ly_pos,posnr TYPE char2,END OF ly_pos.DATA:lt_pos TYPE TABLE OF ly_pos.DATA:ls_pos TYPE  ly_pos." Added by zhong on 20221208TYPES:BEGIN OF ly_pos_for_v,posnr TYPE char2,END OF ly_pos_for_v.DATA:lt_pos_for_v TYPE TABLE OF ly_pos_for_v.DATA:ls_pos_for_v TYPE  ly_pos_for_v.LOOP AT  gt_data ASSIGNING <fs_data> WHERE checked  = 'X' AND za = 'F' AND  zp <> 'X'.CLEAR:  gs_documentheader,gs_customercpd,gs_fica_hd .CLEAR:  gs_accountreceivable,gs_accountgl ,  gs_accounttax, gs_criteria  , gs_valuefield , gs_currencyamount,gs_return , gs_receivers,  gs_fica_it, gs_accountpayable, gs_paymentcard,  gs_extension1, gs_realestate, gs_extension2.REFRESH :  gt_accountreceivable,gt_accountgl ,  gt_accounttax, gt_criteria  , gt_valuefield , gt_currencyamount,gt_return , gt_receivers,  gt_fica_it, gt_accountpayable, gt_paymentcard,  gt_extension1, gt_realestate, gt_extension2.REFRESH :lt_pos.SELECT SINGLE *INTO @DATA(ls_ztsd017)  FROM ztsd017WHERE ztsd017~vkorg = @<fs_data>-vkorg AND ztsd017~waers = @<fs_data>-tradecurrency AND ztsd017~zaccount = @<fs_data>-zaccount.IF ls_ztsd017 IS INITIAL.<fs_data>-status     = 'E'.<fs_data>-message    = '账户信息未维护'.<fs_data>-status_inc = icon_led_red.CONTINUE.ENDIF.DATA:lv_string_datetime LIKE  syst-msgv1.CALL FUNCTION 'ZFM_TOOLS_GET_STRINGDATE'EXPORTINGztype           = 'D'
*           datum1          =
*           datum2          =datum           = <fs_data>-transactiondateuzeit           = sy-uzeitIMPORTINGstring_datetime = lv_string_datetime.lv_item_text = <fs_data>-item_text.
*        lv_item_text = lv_string_datetime && <fs_data>-kunnr && ls_ztsd017-item_text."凭证抬头gs_documentheader-doc_status = lv_doc_status.gs_documentheader-comp_code  = <fs_data>-vkorg.       "公司代码gs_documentheader-doc_date   = <fs_data>-budat.       "凭证日期gs_documentheader-pstng_date = <fs_data>-budat.       "过账日期gs_documentheader-fis_period = <fs_data>-budat+4(2).  "过账期间SELECT SINGLE * INTO @DATA(ls_t001) FROM t001 WHERE t001~bukrs = @<fs_data>-vkorg.IF <fs_data>-tradecurrency <> ls_t001-waers.gs_documentheader-trans_date = <fs_data>-transactiondate. "换算日期 = 交易日期ENDIF.gs_documentheader-doc_type   = ls_ztsd017-doc_type .  "证类类型gs_documentheader-username   = sy-uname.              "过账人gs_documentheader-header_txt = lv_item_text.          "抬头文本gs_documentheader-ref_doc_no = <fs_data>-xblnr .      "参照IF <fs_data>-wrbtr > 0."银行存款账户lv_posnr_acc = 1.gs_accountgl-itemno_acc = lv_posnr_acc.       "会计凭证行项目编号 类型POSNR_ACCNUMC10gs_accountgl-gl_account = ls_ztsd017-hkont.   "'1002020101'."总分类帐帐目HKONTCHAR10gs_accountgl-item_text  = lv_item_text.       "项目文本SGTXTCHAR50gs_accountgl-acct_type  = <fs_data>-acct_type."帐户类型KOARTCHAR1gs_accountgl-alloc_nmbr = <fs_data>-transactiondate.   "分配号 ACPI_ZUONRCHAR18gs_accountgl-value_date = <fs_data>-transactiondate.   "起息日 VALUTDATS8
*        gs_accountgl-de_cre_ind = 'S' .              "标识: 后续借/贷 ACPI_TBTKZCHAR1APPEND gs_accountgl TO gt_accountgl.CLEAR: wa_zexten.wa_zexten-posnr = lv_posnr_acc.            "凭证行项目wa_zexten-bschl = '40'.                    "记账码wa_zexten-rstgr = <fs_data>-rstgr.         "凭证行项目原因代码wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.CLEAR: gs_currencyamount.gs_currencyamount-itemno_acc   =  lv_posnr_acc.            "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency     =  <fs_data>-tradecurrency. "货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur   =  <fs_data>-wrbtr.         "到账金额  凭证货币金额BAPIDOCCUR|DEC23|4
*        gs_currencyamount-exch_rate = '6.123456'.APPEND gs_currencyamount TO gt_currencyamount.ENDIF."-- 手续费IF <fs_data>-wrbtr_charge > 0 OR <fs_data>-wrbtr_charge2 > 0.lv_posnr_acc = lv_posnr_acc + 1.CLEAR: gs_accountgl.gs_accountgl-itemno_acc =  lv_posnr_acc.       "会计凭证行项目编号 类型POSNR_ACCNUMC10gs_accountgl-gl_account =  <fs_data>-hkont_in. "'5002020101'."总分类帐帐目HKONTCHAR10gs_accountgl-item_text  =  lv_item_text.       "项目文本SGTXTCHAR50gs_accountgl-acct_type  =  <fs_data>-acct_type."帐户类型KOARTCHAR1gs_accountgl-alloc_nmbr =  <fs_data>-transactiondate.          "分配号 ACPI_ZUONRCHAR18
*          gs_accountgl-de_cre_ind = 'S' .               "标识: 后续借/贷 ACPI_TBTKZCHAR1APPEND gs_accountgl TO gt_accountgl.CLEAR: wa_zexten.wa_zexten-bschl = '40'.wa_zexten-posnr = lv_posnr_acc.           "凭证行项目wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.CLEAR:gs_currencyamount.gs_currencyamount-itemno_acc  =  lv_posnr_acc.            "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency    =  <fs_data>-tradecurrency ."货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur  =  <fs_data>-wrbtr_charge + <fs_data>-wrbtr_charge2.  "凭证货币金额BAPIDOCCUR|DEC23|4
*          gs_currencyamount-exch_rate = '6.123456'.APPEND gs_currencyamount TO gt_currencyamount.ENDIF."-- 收款余额:挂预收款 客户统驭科目IF <fs_data>-wrbtr_3 > 0.lv_posnr_acc = lv_posnr_acc + 1.CLEAR:gs_accountgl.gs_accountreceivable-itemno_acc = lv_posnr_acc.           "会计凭证行项目编号 POSNR_ACCNUMC10|0gs_accountreceivable-customer   = <fs_data>-kunnr.        "客户编号KUNNRCHAR10|0
*          gs_accountreceivable-gl_account = <fs_data>-kunnr_akont2."预收 总分类帐帐目HKONTCHAR10|0gs_accountreceivable-c_ctr_area = <fs_data>-vkorg.        "信贷控制范围gs_accountreceivable-alloc_nmbr = <fs_data>-transactiondate.               "分配号 ACPI_ZUONRCHAR18|0gs_accountreceivable-item_text  = lv_item_text.           "项目文本SGTXTCHAR50|0gs_accountreceivable-ref_key_3  = <fs_data>-kunnr.        "行项目的参考码gs_accountreceivable-bline_date = <fs_data>-transactiondate."到期日计算的基限日期ACPI_ZFBDTDATS8|0*          gs_accountreceivable-paymt_ref  = ''."付款参考码APPEND gs_accountreceivable TO gt_accountreceivable.CLEAR: wa_zexten.wa_zexten-posnr = lv_posnr_acc.                "凭证行项目wa_zexten-umskz = '1'.                         "特别总账标识wa_zexten-bschl = '19'.                        "记账码 19 特别总账标识wa_zexten-bstat = lv_bstat.wa_zexten-rstgr = ls_ztsd017-rstgr_in2.        "原因代码 14gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.CLEAR:gs_currencyamount.gs_currencyamount-itemno_acc  =  lv_posnr_acc.           " 会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency    =  <fs_data>-tradecurrency." 货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur  =  <fs_data>-wrbtr_3 * -1. " 余额 凭证货币金额BAPIDOCCUR|DEC23|4APPEND gs_currencyamount TO gt_currencyamount." Added by zhong on 20221221ls_pos_for_v-posnr = lv_posnr_acc+8(2).APPEND ls_pos_for_v TO lt_pos_for_v.ENDIF."-- 收款余额:挂预佣金 客户统驭科目IF <fs_data>-wrbtr_4 > 0.lv_posnr_acc = lv_posnr_acc + 1.CLEAR:gs_accountgl.gs_accountgl-itemno_acc =  lv_posnr_acc."会计凭证行项目编号 类型POSNR_ACCNUMC10gs_accountreceivable-itemno_acc = lv_posnr_acc.          "会计凭证行项目编号 POSNR_ACCNUMC10|0gs_accountreceivable-customer   = <fs_data>-kunnr.       "客户编号KUNNRCHAR10|0*          gs_accountreceivable-gl_account = <fs_data>-kunnr_akont2."预收 总分类帐帐目HKONTCHAR10|0gs_accountreceivable-c_ctr_area = <fs_data>-vkorg.        "信贷控制范围gs_accountreceivable-alloc_nmbr = sy-datum.               "分配号 ACPI_ZUONRCHAR18|0gs_accountreceivable-item_text  = lv_item_text.           "项目文本SGTXTCHAR50|0gs_accountreceivable-ref_key_3  = <fs_data>-kunnr.gs_accountreceivable-bline_date = <fs_data>-transactiondate."到期日计算的基限日期ACPI_ZFBDTDATS8|0gs_accountreceivable-paymt_ref  = ''."付款参考码APPEND gs_accountreceivable TO gt_accountreceivable.CLEAR: wa_zexten.wa_zexten-posnr = lv_posnr_acc.            "凭证行项目wa_zexten-umskz = '9'.                     "特别总账标识wa_zexten-bschl = '19'.                    "记账码 19 特别总账标识wa_zexten-bstat = lv_bstat.wa_zexten-rstgr = ls_ztsd017-rstgr_in2.     "原因代码 15gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.CLEAR:gs_currencyamount.gs_currencyamount-itemno_acc  =  lv_posnr_acc.           " 会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency    =  <fs_data>-tradecurrency." 货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur  =  <fs_data>-wrbtr_4 * -1. " 余额 凭证货币金额BAPIDOCCUR|DEC23|4APPEND gs_currencyamount TO gt_currencyamount." Added by zhong on 20221221ls_pos_for_v-posnr = lv_posnr_acc+8(2).APPEND ls_pos_for_v TO lt_pos_for_v.ENDIF."-- 预收 冲 应收LOOP AT lt_bsid INTO ls_bsid WHERE zid = <fs_data>-zid AND  oa_no = '' AND  rstgr = '14' ." other conditionlv_posnr_acc = lv_posnr_acc + 1.CLEAR:gs_accountreceivable ,gs_currencyamount,wa_zexten."客户统驭科目gs_accountreceivable-itemno_acc = lv_posnr_acc.   "会计凭证行项目编号 POSNR_ACCNUMC10|0gs_accountreceivable-customer   = <fs_data>-kunnr."客户编号KUNNRCHAR10|0
*          gs_accountreceivable-gl_account = <fs_data>-kunnr_akont."总分类帐帐目HKONTCHAR10|0gs_accountreceivable-alloc_nmbr = ls_bsid-zuonr."分配号 ACPI_ZUONRCHAR18|0gs_accountreceivable-item_text  = lv_item_text."项目文本SGTXTCHAR50|0gs_accountreceivable-ref_key_3  = <fs_data>-kunnr.gs_accountreceivable-c_ctr_area = <fs_data>-vkorg."信贷控制范围*          gs_accountreceivable-bline_date = sy-datum."到期日计算的基限日期ACPI_ZFBDTDATS8|0SELECT SINGLE * INTO @DATA(ls_bsid_1) FROM bsidWHERE   bukrs = @<fs_data>-vkorg AND kunnr = @<fs_data>-kunnrAND gjahr = @ls_bsid-gjahr AND belnr = @ls_bsid-belnr  AND buzei = @ls_bsid-buzei .IF sy-subrc = 0.gs_accountreceivable-bline_date = ls_bsid_1-zfbdt."到期日计算的基限日期ACPI_ZFBDTDATS8|0ENDIF.CLEAR:ls_bsid_1.*         gs_accountreceivable-ref_key_3  = .  "行项目的参考码XREF3CHAR20|0APPEND gs_accountreceivable TO gt_accountreceivable.gs_currencyamount-itemno_acc   =  lv_posnr_acc.           "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency     =  <fs_data>-tradecurrency."货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur   =  ls_bsid-in_wrbtr .  "分配金额  凭证货币金额BAPIDOCCUR|DEC23|4APPEND gs_currencyamount TO gt_currencyamount.wa_zexten-posnr = lv_posnr_acc.             " 凭证行项目wa_zexten-bschl = '09'.                     " 特别总账标识 借方wa_zexten-umskz = '1'.                      " 特别总账标识                         "wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.ENDLOOP."-- 佣金 冲 应收LOOP AT lt_bsid INTO ls_bsid WHERE zid = <fs_data>-zid AND  oa_no = '' AND  rstgr = '15' ." other conditionlv_posnr_acc = lv_posnr_acc + 1.CLEAR:gs_accountreceivable ,gs_currencyamount,wa_zexten."客户统驭科目gs_accountreceivable-itemno_acc = lv_posnr_acc."会计凭证行项目编号 POSNR_ACCNUMC10|0gs_accountreceivable-customer   = <fs_data>-kunnr."客户编号KUNNRCHAR10|0*          gs_accountreceivable-gl_account = <fs_data>-kunnr_akont."总分类帐帐目HKONTCHAR10|0gs_accountreceivable-c_ctr_area = <fs_data>-vkorg."信贷控制范围gs_accountreceivable-alloc_nmbr = ls_bsid-zuonr."分配号 ACPI_ZUONRCHAR18|0gs_accountreceivable-item_text  = lv_item_text. "项目文本SGTXTCHAR50|0gs_accountreceivable-ref_key_3  = <fs_data>-kunnr.*          gs_accountreceivable-bline_date = sy-datum."到期日计算的基限日期ACPI_ZFBDTDATS8|0SELECT SINGLE * INTO @ls_bsid_1 FROM bsidWHERE   bukrs = @<fs_data>-vkorg AND kunnr = @<fs_data>-kunnrAND gjahr = @ls_bsid-gjahr AND belnr = @ls_bsid-belnr   AND buzei = @ls_bsid-buzei .IF sy-subrc = 0.gs_accountreceivable-bline_date = ls_bsid_1-zfbdt."到期日计算的基限日期ACPI_ZFBDTDATS8|0ENDIF.CLEAR:ls_bsid_1.*         gs_accountreceivable-ref_key_3  = .  "行项目的参考码XREF3CHAR20|0APPEND gs_accountreceivable TO gt_accountreceivable.gs_currencyamount-itemno_acc   =  lv_posnr_acc.           "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency     =  <fs_data>-tradecurrency."货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur   =  ls_bsid-in_wrbtr .  "分配金额  凭证货币金额BAPIDOCCUR|DEC23|4APPEND gs_currencyamount TO gt_currencyamount.wa_zexten-posnr = lv_posnr_acc.            "凭证行项目wa_zexten-bschl = '09'.                    "特别总账标识 借方wa_zexten-umskz = '9'.                     "特别总账标识                         "wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.ENDLOOP."-- (OA)折扣冲应收 ,走主营业务收入折扣LOOP AT lt_bsid INTO ls_bsid WHERE zid = <fs_data>-zid AND  oa_no <> ''  ." other conditionlv_posnr_acc = lv_posnr_acc + 1.CLEAR: gs_accountgl.gs_accountgl-itemno_acc =  lv_posnr_acc.       "会计凭证行项目编号 类型POSNR_ACCNUMC10gs_accountgl-gl_account =  ls_ztsd017-hkont_in2. "''.折扣科目gs_accountgl-item_text  =  lv_item_text.       "项目文本SGTXTCHAR50gs_accountgl-acct_type  =  <fs_data>-acct_type."帐户类型KOARTCHAR1gs_accountgl-alloc_nmbr =  ls_bsid-oa_no .      "分配号 ACPI_ZUONRCHAR18gs_accountgl-costcenter = <fs_data>-kostl.*          gs_accountgl-value_date =  sy-datum."起息日 VALUTDATS8
*          gs_accountgl-de_cre_ind = 'S' ."标识: 后续借/贷 ACPI_TBTKZCHAR1
*          gs_accountgl-sales_grp  = '1015'."销售组
*          gs_accountgl-sales_off  = '110'. "销售办事处APPEND gs_accountgl TO gt_accountgl.CLEAR: wa_zexten.wa_zexten-bschl = '40'.wa_zexten-posnr = lv_posnr_acc.           "凭证行项目wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.CLEAR:gs_currencyamount.gs_currencyamount-itemno_acc  =  lv_posnr_acc.            "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency    =  <fs_data>-tradecurrency ."货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur  =  ls_bsid-in_wrbtr.  "凭证货币金额BAPIDOCCUR|DEC23|4APPEND gs_currencyamount TO gt_currencyamount.ls_pos-posnr = lv_posnr_acc+8(2).APPEND ls_pos TO lt_pos.ENDLOOP."-- 手工凭证,被冲LOOP AT lt_bsid INTO ls_bsid WHERE zid = <fs_data>-zid AND  oa_no = '' AND rstgr = '13'.lv_posnr_acc = lv_posnr_acc + 1.CLEAR:gs_accountreceivable ,gs_currencyamount,wa_zexten."客户统驭科目gs_accountreceivable-itemno_acc = lv_posnr_acc."会计凭证行项目编号 POSNR_ACCNUMC10|0gs_accountreceivable-customer   = <fs_data>-kunnr."客户编号KUNNRCHAR10|0*          gs_accountreceivable-gl_account = <fs_data>-kunnr_akont."总分类帐帐目HKONTCHAR10|0gs_accountreceivable-c_ctr_area = <fs_data>-vkorg.        "信贷控制范围gs_accountreceivable-alloc_nmbr = ls_bsid-zuonr."分配号 ACPI_ZUONRCHAR18|0gs_accountreceivable-item_text  = lv_item_text."项目文本SGTXTCHAR50|0gs_accountreceivable-ref_key_3  = <fs_data>-kunnr.SELECT SINGLE * INTO @ls_bsid_1 FROM bsidWHERE   bukrs = @<fs_data>-vkorg AND kunnr = @<fs_data>-kunnrAND gjahr = @ls_bsid-gjahr AND belnr = @ls_bsid-belnr  AND buzei = @ls_bsid-buzei .IF sy-subrc = 0.gs_accountreceivable-bline_date = ls_bsid_1-zfbdt."到期日计算的基限日期ACPI_ZFBDTDATS8|0ENDIF.CLEAR:ls_bsid_1.*         gs_accountreceivable-ref_key_3  = .  "行项目的参考码XREF3CHAR20|0APPEND gs_accountreceivable TO gt_accountreceivable.gs_currencyamount-itemno_acc   =  lv_posnr_acc.           "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency     =  <fs_data>-tradecurrency."货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur   =  ls_bsid-in_wrbtr * -1.  "分配金额  凭证货币金额BAPIDOCCUR|DEC23|4APPEND gs_currencyamount TO gt_currencyamount.wa_zexten-posnr = lv_posnr_acc.                  "凭证行项目wa_zexten-bschl = '11'.                          "wa_zexten-rstgr = <fs_data>-rstgr_kunnr.         "原因代码wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2." Added by zhong on 20221221ls_pos_for_v-posnr = lv_posnr_acc+8(2).APPEND ls_pos_for_v TO lt_pos_for_v.ENDLOOP."-- 应收发票,被冲LOOP AT lt_bsid INTO ls_bsid WHERE zid = <fs_data>-zid AND  oa_no = '' AND rstgr = '' AND blart = 'RV'." other conditionlv_posnr_acc = lv_posnr_acc + 1.CLEAR:gs_accountreceivable ,gs_currencyamount,wa_zexten."客户统驭科目gs_accountreceivable-itemno_acc = lv_posnr_acc."会计凭证行项目编号 POSNR_ACCNUMC10|0gs_accountreceivable-customer   = <fs_data>-kunnr."客户编号KUNNRCHAR10|0*          gs_accountreceivable-gl_account = <fs_data>-kunnr_akont."总分类帐帐目HKONTCHAR10|0gs_accountreceivable-alloc_nmbr = ls_bsid-zuonr."分配号 ACPI_ZUONRCHAR18|0gs_accountreceivable-item_text  = lv_item_text."项目文本SGTXTCHAR50|0gs_accountreceivable-ref_key_3  = <fs_data>-kunnr.gs_accountreceivable-c_ctr_area = <fs_data>-vkorg.        "信贷控制范围SELECT SINGLE * INTO @ls_bsid_1 FROM bsidWHERE   bukrs = @<fs_data>-vkorg AND kunnr = @<fs_data>-kunnrAND gjahr = @ls_bsid-gjahr AND belnr = @ls_bsid-belnr  AND buzei = @ls_bsid-buzei .IF sy-subrc = 0.gs_accountreceivable-bline_date = ls_bsid_1-zfbdt."到期日计算的基限日期ACPI_ZFBDTDATS8|0ENDIF.CLEAR:ls_bsid_1.gs_accountreceivable-c_ctr_area = <fs_data>-vkorg."信贷控制范围*         gs_accountreceivable-ref_key_3  = .  "行项目的参考码XREF3CHAR20|0APPEND gs_accountreceivable TO gt_accountreceivable.gs_currencyamount-itemno_acc   =  lv_posnr_acc.           "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency     =  <fs_data>-tradecurrency."货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur   =  ls_bsid-in_wrbtr * -1.  "分配金额  凭证货币金额BAPIDOCCUR|DEC23|4*          gs_currencyamount-exch_rate = '6.123456'.APPEND gs_currencyamount TO gt_currencyamount.wa_zexten-posnr = lv_posnr_acc.                  "凭证行项目wa_zexten-bschl = '11'.                          "wa_zexten-rstgr = <fs_data>-rstgr_kunnr.         "原因代码wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2." Added by zhong on 20221221ls_pos_for_v-posnr = lv_posnr_acc+8(2).APPEND ls_pos_for_v TO lt_pos_for_v.ENDLOOP." Added by zhong on 20221102 退货发票被冲"-- 应收发票,被冲LOOP AT lt_bsid INTO ls_bsid WHERE zid = <fs_data>-zid AND  oa_no = '' AND rstgr = 'ZZ' AND blart = 'RV'." other conditionlv_posnr_acc = lv_posnr_acc + 1.CLEAR:gs_accountreceivable ,gs_currencyamount,wa_zexten."客户统驭科目gs_accountreceivable-itemno_acc = lv_posnr_acc."会计凭证行项目编号 POSNR_ACCNUMC10|0gs_accountreceivable-customer   = <fs_data>-kunnr."客户编号KUNNRCHAR10|0*          gs_accountreceivable-gl_account = <fs_data>-kunnr_akont."总分类帐帐目HKONTCHAR10|0gs_accountreceivable-alloc_nmbr = ls_bsid-zuonr."分配号 ACPI_ZUONRCHAR18|0gs_accountreceivable-item_text  = lv_item_text."项目文本SGTXTCHAR50|0gs_accountreceivable-ref_key_3  = <fs_data>-kunnr.SELECT SINGLE * INTO @ls_bsid_1 FROM bsidWHERE   bukrs = @<fs_data>-vkorg AND kunnr = @<fs_data>-kunnrAND gjahr = @ls_bsid-gjahr AND belnr = @ls_bsid-belnr  AND buzei = @ls_bsid-buzei .IF sy-subrc = 0.gs_accountreceivable-bline_date = ls_bsid_1-zfbdt."到期日计算的基限日期ACPI_ZFBDTDATS8|0ENDIF.CLEAR:ls_bsid_1.gs_accountreceivable-c_ctr_area = <fs_data>-vkorg."信贷控制范围*         gs_accountreceivable-ref_key_3  = .  "行项目的参考码XREF3CHAR20|0APPEND gs_accountreceivable TO gt_accountreceivable.gs_currencyamount-itemno_acc   =  lv_posnr_acc.           "会计凭证行项目编号 POSNR_ACC|NUMC10|0gs_currencyamount-currency     =  <fs_data>-tradecurrency."货币码 WAERS|CUKY5|0gs_currencyamount-amt_doccur   =  ls_bsid-in_wrbtr.  "分配金额  凭证货币金额BAPIDOCCUR|DEC23|4*          gs_currencyamount-exch_rate = '6.123456'.APPEND gs_currencyamount TO gt_currencyamount.wa_zexten-posnr = lv_posnr_acc.                  "凭证行项目wa_zexten-bschl = '01'.                          "wa_zexten-rstgr = '10'.         "原因代码wa_zexten-bstat = lv_bstat.gs_extension2-structure  = 'ZEXTEN_FI'.gs_extension2-valuepart1 = wa_zexten.APPEND gs_extension2 TO gt_extension2.ENDLOOP."CHECK 凭证 -----------CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'EXPORTINGdocumentheader    = gs_documentheader
*           CUSTOMERCPD       = CUSTOMERCPD
*           CONTRACTHEADER    = CONTRACTHEADERTABLESaccountgl         = gt_accountglaccountreceivable = gt_accountreceivableaccountpayable    = gt_accountpayableaccounttax        = gt_accounttaxcurrencyamount    = gt_currencyamount
*           CRITERIA          = GT_CRITERIA
*           VALUEFIELD        =
*           EXTENSION1        =return            = gt_return
*           PAYMENTCARD       =
*           CONTRACTITEM      =extension2        = gt_extension2
*           REALESTATE        =
*           ACCOUNTWT         =.IF sy-subrc = 0.CLEAR:lv_message,lv_type.LOOP AT gt_return INTO gs_return.<fs_data>-status     = gs_return-type.<fs_data>-message    = gs_return-message.<fs_data>-status_inc = icon_led_green.IF gs_return-type = 'E'.lv_type    = gs_return-type.lv_message = lv_message && '|' && gs_return-message.ENDIF.ENDLOOP.IF lv_type = 'E'.<fs_data>-status_inc = icon_led_red.<fs_data>-status     = lv_type.<fs_data>-message    = lv_message.CONTINUE.ENDIF.ENDIF.SELECT SINGLE * INTO @DATA(ls_ztsd010) FROM ztsd010 WHERE ztsd010~id = 'ZSD076'.IF sy-subrc = 0 AND ls_ztsd010-status = 'X'.ELSE.<fs_data>-status_inc = icon_led_red.<fs_data>-status     = 'E'.<fs_data>-message    = '凭证创建功能未启用'.CONTINUE.ENDIF.CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'EXPORTINGdocumentheader    = gs_documentheader
*           CUSTOMERCPD       = CUSTOMERCPD
*           CONTRACTHEADER    = CONTRACTHEADERTABLESaccountgl         = gt_accountglaccountreceivable = gt_accountreceivableaccountpayable    = gt_accountpayableaccounttax        = gt_accounttaxcurrencyamount    = gt_currencyamountcriteria          = gt_criteria
*           VALUEFIELD        =
*           EXTENSION1        =return            = gt_return
*           PAYMENTCARD       =
*           CONTRACTITEM      =extension2        = gt_extension2
*           REALESTATE        =
*           ACCOUNTWT         =.IF sy-subrc = 0.CLEAR:lv_message,lv_type.LOOP AT gt_return INTO gs_return.<fs_data>-status  = gs_return-type.<fs_data>-message = gs_return-message.IF gs_return-type = 'E'.lv_type    = gs_return-type.lv_message = lv_message && '|' && gs_return-message.ENDIF.ENDLOOP.IF lv_type <> 'E'.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.READ TABLE gt_return INTO gs_return WITH  KEY type = 'S'.IF sy-subrc = 0.<fs_data>-status       = gs_return-type.<fs_data>-message      = gs_return-message.<fs_data>-zin          = 'X'.<fs_data>-gjahr        = gs_return-message_v2+14(4).<fs_data>-belnr        = gs_return-message_v2+0(10).<fs_data>-status_inc_p = icon_led_yellow.<fs_data>-status_inc   = icon_led_green.<fs_data>-bstat        = 'V'.UPDATE ztsd015 SET zp = 'X'  belnr = <fs_data>-belnr  gjahr = <fs_data>-gjahr  WHERE zid = <fs_data>-zid."Added by zhong on 20221212UPDATE ztsd018 SET zp = 'X'  WHERE ztsd015_id = <fs_data>-zid."Added by zhong on 20221208 修改预制凭证-----------------------------DATA:lv_fvkorg TYPE bdcdata-fval.DATA:lv_fbelnr TYPE bdcdata-fval.DATA:lv_fgjahr TYPE bdcdata-fval.IF lt_pos IS NOT INITIAL.LOOP AT lt_pos INTO ls_pos.CLEAR:lv_fvkorg,lv_fbelnr,lv_fgjahr.lv_fvkorg = <fs_data>-vkorg.lv_fbelnr = <fs_data>-belnr.lv_fgjahr = <fs_data>-gjahr.CALL FUNCTION 'ZFM_EX_SD011'EXPORTING
*                     CTU       = 'X'
*                     MODE      = 'N'
*                     UPDATE    = 'L'
*                     GROUP     =
*                     USER      =
*                     KEEP      =
*                     HOLDDATE  =
*                     NODATA    = '/'bukrs_001 = lv_fvkorgbelnr_002 = lv_fbelnrgjahr_003 = lv_fgjahr
*                     XBLNR_004 = '1'
*                     BKTXT_005 = '11/19 HA021 入中行'
*                     WRBTR_006 = '50.00'
*                     DMBTR_007 = '336.25'
*                     ZUONR_008 = '10001'
*                     SGTXT_009 = '11/19 HA021 入中行1'
*                     FMORE_010 = 'X'
*                     KOSTL_011 = ''char2     = ls_pos-posnr
*             IMPORTING
*                     SUBRC     =
*             TABLES
*                     MESSTAB   =.ENDLOOP.ENDIF.IF lt_pos_for_v IS NOT INITIAL.LOOP AT lt_pos_for_v INTO ls_pos_for_v.CLEAR:lv_fvkorg,lv_fbelnr,lv_fgjahr.lv_fvkorg = <fs_data>-vkorg.lv_fbelnr = <fs_data>-belnr.lv_fgjahr = <fs_data>-gjahr.CALL FUNCTION 'ZFM_EX_SD012_1'EXPORTING
*                     CTU       = 'X'
*                     MODE      = 'N'
*                     UPDATE    = 'L'
*                     GROUP     =
*                     USER      =
*                     KEEP      =
*                     HOLDDATE  =
*                     NODATA    = '/'bukrs_001 = lv_fvkorgbelnr_002 = lv_fbelnrgjahr_003 = lv_fgjahr
*                     XBLNR_004 = '1'
*                     BKTXT_005 = '日期HA021入中行'
*                     WRBTR_006 = '10.00'
*                     DMBTR_007 = '67.25'
*                     ZFBDT_008 = '2022.11.19'
*                     REBZG_009 = ''
*                     ZUONR_010 = '20221121'
*                     SGTXT_011 = '日期HA021入中行'char2     = ls_pos_for_v-posnr
*                 IMPORTING
*                     SUBRC     =
*                 TABLES
*                     MESSTAB   =.ENDLOOP.ENDIF.ENDIF.FREE: lt_pos_for_v ,lt_pos.ELSE.<fs_data>-status_inc = icon_led_red.<fs_data>-status     = lv_type.<fs_data>-message    = lv_message.ENDIF.ENDIF.ENDLOOP.WHEN 'ZCLOSE1'.READ TABLE gt_data INTO gs_data WITH  KEY checked  = 'X'.IF sy-subrc = 0.SET PARAMETER ID 'BUK'   FIELD gs_data-vkorg.SET PARAMETER ID 'KUN'   FIELD gs_data-kunnr.
*        SET PARAMETER ID 'X_KUNNR'   FIELD 'X'.
*        SET PARAMETER ID 'X_TESTL'   FIELD ''.CALL TRANSACTION 'F.13' .
*        CALL TRANSACTION 'F.13' AND SKIP FIRST SCREEN.ENDIF.WHEN 'ZCLOSE'. " 清账READ TABLE gt_data INTO gs_data WITH  KEY checked  = 'X'.IF sy-subrc = 0.SELECT SINGLE * INTO @DATA(ls_ztsd015) FROM ztsd015 WHERE ztsd015~zid = @gs_data-zid.IF ls_ztsd015-za = '' AND ls_ztsd015-zin = 'X'.DELETE  FROM ztsd015 WHERE zid = gs_data-zid.MESSAGE '删除成功' TYPE 'I'.ENDIF.ENDIF.
**    WHEN 'ZCLOSE'. " 清账
**
**
**      DATA: lv_f_vkorg  LIKE  bdcdata-fval, "  '1010'  公司代码
**
**            lv_f_gjahr  LIKE  bdcdata-fval , " '2022'  年度
**
**            x_kunnr_003 LIKE  bdcdata-fval , "  'X' 选择客户
**            lv_f_kunnr  LIKE  bdcdata-fval , "  'BC004' 客户编号
**            lv_f_augdt  LIKE  bdcdata-fval , "  '2022.07.18'  清账日期
**            lv_f_zuonr  LIKE  bdcdata-fval , "     分配号
**            x_testl_006 LIKE  bdcdata-fval . "  ''  选择执行
**
**      DATA:lt_messtab  TYPE TABLE OF bdcmsgcoll .
**
**      DATA:lv_vkorg TYPE ztsd015-vkorg.
**      DATA:lv_kunnr TYPE bsid-kunnr.
**
**      LOOP AT  gt_data ASSIGNING <fs_data> WHERE checked  = 'X'.
**        lv_vkorg =  <fs_data>-vkorg.
**        lv_kunnr =  <fs_data>-kunnr.
**
**        LOOP AT lt_bsid INTO ls_bsid WHERE zid = <fs_data>-zid." other condition
***
**          lv_f_vkorg = <fs_data>-vkorg.
**          lv_f_gjahr = ls_bsid-gjahr.
***          CLEAR: lv_f_gjahr .
**          lv_f_kunnr = <fs_data>-kunnr.
***          CLEAR:  lv_f_zuonr .
**          CLEAR:  lv_f_zuonr .
**
**          lv_f_zuonr  = ls_bsid-zuonr.
**          lv_f_augdt = sy-datum.
**
******          CALL FUNCTION 'ZFM_EX_SD007'
******            EXPORTING
*******             CTU          = 'X'
*******             MODE         = 'N'
*******             UPDATE       = 'L'
*******             GROUP        =
*******             USER         =
*******             KEEP         =
*******             HOLDDATE     =
*******             NODATA       = '/'
******              low_001      = lv_f_vkorg
******              low_002      = lv_f_gjahr
******              x_kunnr_003  = 'X'
******              low_004      = lv_f_kunnr
******              augdt_005    = lv_f_augdt
******              so_zuonr_low = lv_f_zuonr
******              x_testl_006  = ''
******              xausbel_007  = 'X'
******              xnausbel_008 = 'X'
******              x_fehler_009 = 'X'
*******           IMPORTING
*******             SUBRC        =
*******             STATUS       =
*******             MESSAGE      =
*******             BELNR        =
******            TABLES
******              messtab      = lt_messtab.
**
**
**          READ TABLE lt_messtab INTO DATA(ls_1) WITH  KEY msgtyp = 'S'.
**          IF sy-subrc = 0.
**
**            LOOP AT lt_messtab INTO DATA(ls_messtab).
**              CLEAR: lv_message.
**              CALL FUNCTION 'MESSAGE_TEXT_BUILD'
**                EXPORTING
**                  msgid               = ls_messtab-msgid
**                  msgnr               = ls_messtab-msgnr
**                  msgv1               = ls_messtab-msgv1
**                  msgv2               = ls_messtab-msgv2
**                  msgv3               = ls_messtab-msgv3
**                  msgv4               = ls_messtab-msgv4
**                IMPORTING
**                  message_text_output = lv_message.
**            ENDLOOP.
**            MESSAGE lv_message TYPE 'I'.
**          ENDIF.
**
**        ENDLOOP.
**
**      ENDLOOP.*      PERFORM get_data_for_bsid_by2 USING lv_vkorg lv_kunnr.
*      PERFORM dear_data_for_bsid    USING lv_vkorg lv_kunnr.WHEN OTHERS.ENDCASE.ls_stbl-row = 'X'.ls_stbl-col = 'X'.CALL METHOD g_grid1->refresh_table_displayEXPORTINGis_stable = ls_stbl.ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  INIT_CON  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE init_con OUTPUT.*  BREAK cyit5.IF gv_init = 'X'.CLEAR:gv_init."显示第一个ALV-------------------------------------------------------------------------------------------------IF con1_ref IS INITIAL.gs_layo1-cwidth_opt = 'X'.gs_layo1-grid_title = '客户收款流水明细'.gs_layo1-zebra      = 'X'.ENDIF.add_fcat1:'序号' 'ZINDEX' 'X' '' '' '' '' '' '','选框' 'CHECKED' 'X' 'X' 'X' '' '' '' '','In' 'STATUS_INC_I' 'X' '' '' '' '' '' '', "流水初始确认'A' 'STATUS_INC_A' 'X' '' '' '' '' '' '',  "流水业务员确认'P' 'STATUS_INC_P' 'X' '' '' '' '' '' '',  "凭证过账
*       'C' 'STATUS_INC_C' 'X' '' '' '' '' '' '', "凭证清账'EV' 'STATUS_INC' 'X' '' '' '' '' '' '','凭证编号' 'BELNR' 'X' '' '' '' '' '' '','财年'     'GJAHR' 'X' '' '' '' '' '' '','凭证状态' 'BSTAT' 'X' '' '' '' '' '' '','销售机构' 'VKORG' 'X' '' '' '' '' '' '','售达方'   'KUNNR' 'X' '' '' '' '' '' '','送达方'   'KUNNR2' 'X' '' '' '' '' '' '','售达方名称' 'KUNNR_DESC' 'X' '' '' '' '' '' '','客户付款名称I' 'KUNNR_DESC_YH' 'X' '' '' '' '' '' '',
*     '送达方名称' 'KUNNR_DESC2' 'X' '' '' '' '' '' '','业务员编号' 'PERNR' 'X' '' '' '' '' '' '','业务员'     'SNAME' 'X' '' '' '' '' '' '','交易日期I' 'TRANSACTIONDATE' 'X' '' '' '' '' '' '','交易货币I' 'TRADECURRENCY' 'X' '' '' '' '' '' '','到账金额I' 'WRBTR' 'X' '' '' '' '' '' '','手续费 I' 'WRBTR_CHARGE' '' '' '' '' '' '' '','手续费2'  'WRBTR_CHARGE2' '' '' '' '' '' '' '','分配余额' 'WRBTR_2' '' '' '' '' '' '' '','挂预收'   'WRBTR_3' '' '' '' '' '' '' '','挂佣金'   'WRBTR_4' '' '' '' '' '' '' '','P/I号'    'BSTKD' '' '' '' '' '' '' '','水单备注|'   'BANK_BAK' 'X' '' '' '' '' '' '',
*       '分配状态' 'ZSTATUS' 'X' 'X' '' '' '' '' '','+银行科目'   'HKONT' '' '' '' '' '' '' '','原因(银行)' 'RSTGR' '' '' 'X' '' '' '' '','+损益科目'   'HKONT_IN' '' '' '' '' '' '' '','-应收科目'   'KUNNR_AKONT' '' '' '' '' '' '' '','原因(客户)' 'RSTGR_KUNNR' '' '' 'X' '' '' '' '','-+预收科目'   'KUNNR_AKONT2' '' '' '' '' '' '' '','+主营*折扣'   'HKONT_IN2' '' '' 'X' '' '' '' '',
*       '成本中心'     'KOSTL' '' '' 'X' '' '' '' '','帐户类型'   'ACCT_TYPE' '' '' '' '' '' '' '','凭证类型'   'DOC_TYPE' '' '' '' '' '' '' '','过账日期'   'BUDAT' '' '' 'X' '' '' '' '',
*       '换算日期'   'TRANS_DATE' '' '' 'X' '' '' '' '','参照'         'XBLNR' '' '' '' '' '' '' '','行项目文本'   'ITEM_TEXT' '' '' 'X' '' '' '' '',
*       '交易流水 I' 'TRANSACTIONTYPE' 'X' '' '' '' '' '' '',
*       '交易类型 I' 'TRANSACTIONTYPE' 'X' '' '' '' '' '' '',
*       '业务类型 I' 'BUSINESSTYPE' 'X' '' '' '' '' '' '',
*       '付款人开户行号 I' 'ACCOUNTPAYER' 'X' '' '' '' '' '' '',
*       '付款人开户行名 I' 'PAYER' 'X' '' '' '' '' '' '',
*       '付款人账号 I' 'DEBITACCOUNT' 'X' '' '' '' '' '' '',
*       '付款人名称 I' 'PAYERNAME' 'X' '' '' '' '' '' '',
*       '会计确认' 'ZIN' 'X' 'X' '' '' '' '' '',
*       '业务确认' 'ZA' 'X' '' '' '' '' '' '',
*       '清账凭证' 'ZBELNR' 'X' '' '' '' '' '' '','水单确认日期' 'MODIFIYDATE' 'X' '' '' '' '' '' '','水单确认时间' 'MODIFIYTIME' 'X' '' '' '' '' '' '','水单确认人'   'MODIFIEDBY'  'X' '' '' '' '' '' '','业务确认日期' 'MODIFIYDATE_ZA' 'X' '' '' '' '' '' '','业务确认时间' 'MODIFIYTIME_ZA' 'X' '' '' '' '' '' '','业务确认人'   'MODIFIEDBY_ZA' 'X' '' '' '' '' '' '','EV状态'   'STATUS' 'X' '' '' '' '' '' '','消息文本' 'MESSAGE' 'X' '' '' '' '' '' '','交易流水I' 'TRANSACTIONNO' 'X' '' '' '' '' '' '','收款银行I' 'ZNAME' 'X' '' '' '' '' '' '','收款单ID' 'ZID' 'X' '' '' 'X' '' '' ''.CREATE OBJECT con1_refEXPORTINGcontainer_name = 'CON1'.CREATE OBJECT g_grid1EXPORTINGi_parent = con1_ref.CREATE OBJECT event_receiver. "创建事件SET HANDLER event_receiver->handle_user_command FOR g_grid1.     "将用户交互事件分配ALVSET HANDLER event_receiver->handle_toolbar      FOR g_grid1.     "将按扭事件分配ALVSET HANDLER event_receiver->catch_hotspotclick  FOR g_grid1.     "将按扭事件分配ALVSET HANDLER event_receiver->catch_change        FOR g_grid1.     "将按扭事件分配ALVSET HANDLER event_receiver->handle_double_click  FOR g_grid1.     "将按扭事件分配ALVCALL METHOD g_grid1->register_edit_eventEXPORTINGi_event_id = cl_gui_alv_grid=>mc_evt_modified.CALL METHOD g_grid1->register_edit_eventEXPORTINGi_event_id = cl_gui_alv_grid=>mc_evt_enter.CALL METHOD g_grid1->set_table_for_first_displayEXPORTINGis_layout       = gs_layo1CHANGINGit_outtab       = gt_datait_fieldcatalog = gt_fcat1."显示第二个ALV-------------------------------------------------------------------------------------------------IF con2_ref IS INITIAL.gs_layo2-cwidth_opt = 'X'.gs_layo2-grid_title = '客户发票未清明细'.gs_layo2-zebra      = 'X'.ENDIF.add_fcat2:'A' 'STATUS_INC_A' 'X' '' '' '' '' '' '',"流水业务员确认
*      'C' 'STATUS_INC_C' 'X' '' '' '' '' '' '',"凭证清账'财务年度' 'GJAHR' 'X' '' '' '' '' '' '','公司代码' 'BUKRS' 'X' '' '' '' '' '' '','客户编号' 'KUNNR' 'X' '' '' '10' '' '' '',
*    '事务类型' 'UMSKS' 'X' '' '' '' '' '' '',
*    '结算' 'AUGDT' 'X' '' '' '' '' '' '',
*    '清帐凭证' 'AUGBL' 'X' '' '' '' '' '' '','_凭证编号_' 'BELNR' 'X' '' '' '' '' '' '','行项目' 'BUZEI' 'X' '' '' '' '' '' '','_过帐日期_' 'BUDAT' 'X' '' '' '' '' '' '',
*      '期间' 'MONAT' 'X' '' '' '' '' '' '',
*    '凭证日期' 'BLDAT' 'X' '' '' '' '' '' '',
*    '录入日期' 'CPUDT' 'X' '' '' '' '' '' '',
*      '参照' 'XBLNR' 'X' '' '' '' '' '' '','凭证类型' 'BLART' 'X' '' '' '' '' '' '',
*      '记帐代码' 'BSCHL' 'X' '' '' '' '' '' '',
*      '特别总账标识' 'UMSKZ' 'X' '' '' '' '' '' '',
*    '特别总帐标志' 'ZUMSK' 'X' '' '' '' '' '' '','借方/贷方' 'SHKZG' 'X' '' '' '' '' '' '',
*      '业务范围' 'GSBER' 'X' '' '' '' '' '' '',
*      '文本' 'SGTXT' 'X' '' '' '' '' '' '','__分配号__' 'ZUONR' 'X' '' '' '' '' '' '',
*    '税码' 'MWSKZ' 'X' '' '' '' '' '' '',
*      '总帐科目' 'SAKNR' 'X' '' '' '' '' '' '',
*      '本币' 'WAERS' 'X' '' '' '' '' '' '',
*      '本位金额 I' 'DMBTR' 'X' '' '' '' '' '' '','交易货币' 'WAERS' 'X' '' '' '' '' '' '','凭证金额' 'WRBTR' 'X' '' '' '' '' '' '',
*    'LC 税额' 'MWSTS' 'X' '' '' '' '' '' '',
*    '税额' 'WMWST' 'X' '' '' '' '' '' '',
*    '估价差额' 'BDIFF' 'X' '' '' '' '' '' '',
*    '估价差额 2' 'BDIF2' 'X' '' '' '' '' '' '',
*    '未在使用中的' 'PROJN' 'X' '' '' '' '' '' '',
*    '订单' 'AUFNR' 'X' '' '' '' '' '' '',
*    '资产' 'ANLN1' 'X' '' '' '' '' '' '',
*    '次级编号' 'ANLN2' 'X' '' '' '' '' '' '',
*    '总帐' 'HKONT' 'X' '' '' '' '' '' '',
*    '财务预算' 'FKONT' 'X' '' '' '' '' '' '',
*    '分支' 'FILKD' 'X' '' '' '' '' '' '',
*    '基限日期' 'ZFBDT' 'X' '' '' '' '' '' '',
*    '付款条件' 'ZTERM' 'X' '' '' '' '' '' '',
*    '天数 1' 'ZBD1T' 'X' '' '' '' '' '' '',
*    '天数 2' 'ZBD2T' 'X' '' '' '' '' '' '',
*    '天内净额' 'ZBD3T' 'X' '' '' '' '' '' '',
*    '折扣百分比 1' 'ZBD1P' 'X' '' '' '' '' '' '',
*    '折扣百分比 2' 'ZBD2P' 'X' '' '' '' '' '' '','分配金额' 'IN_WRBTR' 'X' '' '' '' '' '' '',
*      '分配状态' 'ZSTATUS' 'X' 'X' '' '' '' '' ''
*      'PID' 'ZID' 'X' '' '' '' '' '' ''.'原因代码' 'RSTGR' 'X' '' '' '' '' '' '','OA流程编号' 'OA_NO' 'X' '' '' '' '' '' ''.CREATE OBJECT con2_refEXPORTINGcontainer_name = 'CON2'.CREATE OBJECT g_grid2EXPORTINGi_parent = con2_ref.CALL METHOD g_grid2->set_table_for_first_displayEXPORTINGis_layout       = gs_layo2CHANGINGit_outtab       = lt_bsidit_fieldcatalog = gt_fcat2.ENDIF.ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  CANCEL  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE cancel INPUT.BREAK cyit5.IF 1 = 1.ENDIF.ENDMODULE.PROCESS BEFORE OUTPUT.MODULE status_9001.MODULE init_con.PROCESS AFTER INPUT.MODULE cancel AT EXIT-COMMAND.MODULE user_command_9001.

1.2 屏幕绘制

 1.3 实现效果

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/58339.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【单片机】有人WH-LTE-7S1 4G cat1 模块连接服务器,教程,记录

文章目录 4G cat1 模块封装引脚名称功能拓扑图串口模块调试WH-LTE-7S1 4G cat1 模块 我买的这个模块内置了电信卡&#xff0c;不用插电话卡就能用&#xff0c;要插也行&#xff0c;在背面。 ⚫ 5-16V 宽电压供电 ⚫ LTE Cat 1&#xff0c;搭载 4G 网络&#xff0c;低时延&…

继承AndroidView Model的错误

ViewModelProvider(this)[RegisterViewModel::class.java] 一行简单的代码&#xff0c;总是报这个错误 Caused by: java.lang.NoSuchMethodException: com.xinfa.registerlogin.viewmodel.LoginViewModel. [class android.app.Application] 经过一下午的思索&#xff0c;终于找…

RocketMQ mqadmin java springboot python 调用笔记

命令 mqadmin命令列表 yeqiangyeqiang-MS-7B23:/opt/rocketmq-all-5.1.3-bin-release$ sh bin/mqadmin The most commonly used mqadmin commands are:updateTopic Update or create topicdeleteTopic Delete topic from broker and NameServer.…

Java集合sort排序报错UnsupportedOperationException处理

文章目录 报错场景排查解决UnmodifiableList类介绍 报错场景 我们使用的是PostgreSQL数据库&#xff0c;存储业务数据&#xff0c;业务代码使用的是Spring JPA我们做的是智慧交通信控平台&#xff0c;有个功能是查询展示区域的交通态势&#xff0c;需要按照不同维度排序展示区…

执行jmeter端口不够用报错(Address not available)

执行jmeter端口不够用报错(Address not available) linux解决方案 // 增加本地端口范围 echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range// 启用快速回收TIME_WAIT套接字 sudo sysctl -w net.ipv4.tcp_tw_recycle1// 启用套接字的重用 sudo sysctl -w net.ipv4.t…

循环结构(个人学习笔记黑马学习)

while循环语句 在屏幕中打印0~9这十个数字 #include <iostream> using namespace std;int main() {int i 0;while (i < 10) {cout << i << endl;i;}system("pause");return 0; } 练习案例: 猜数字 案例描述:系统随机生成一个1到100之间的数字&…

远程教育:别催了,在线巡课真爽啊

随着远程教育和在线学习的兴起&#xff0c;教学活动的场景正逐渐从传统的实体教室转向虚拟的线上平台&#xff0c;这也催生了对教学质量监管的新需求。 在线巡课系统在这一背景下应运而生&#xff0c;它不仅能够实时观察教师的教学过程&#xff0c;还能够量化评估教学效果&…

ADS 错误 1808可能原因 ADSError 1808

​ 调试问题记录&#xff1a; 背景&#xff1a; Ads调试时遇到错误&#xff0c;返回码是 1808&#xff0c;查询倍福官网 得出1808错误原因是 symbol not found 原因&#xff1a; ADSError: symbol not found (1808). Possible incorrect runtime port selected 可能是ads的地…

极氪汽车的云资源治理细探

作者&#xff1a;极氪汽车吴超 前言 2021 年&#xff0c;极氪 001 迅速崭露头角&#xff0c;仅用 110 天便创下了首款车型交付量“最快破万”的纪录。2022 年 11 月&#xff0c;极氪 009 在短短 76 天内便率先完成了首批交付&#xff0c;刷新了中国豪华纯电品牌交付速度的纪录…

内网实战1

1、信息收集&#xff1a; 使用nmap做端口扫描&#xff1a; nmap -sV -Pn -T4 192.168.26.174重要端口&#xff1a;80、445、139、135、3306 目录扫描&#xff1a; 访问80端口&#xff1a;发现一个网站是phpstudy搭建的&#xff1b; 发现一个mysql数据库&#xff0c;那我们…

11-Manager 和 模型Model

准备工作: 一. Manager 库: Manager: 用于管理相关操作端命令和使用相关操作端命令 (1). 安装flask-script: pip install flask-script2.0.3 (2). 在app.py中 包装 app from apps import create_app# Manager类用于管理相关操作端命令和使用相关操作端命令 from flask_scrip…

Unity实现UI图片面板滚动播放效果第二弹

效果&#xff1a; 场景结构&#xff1a; 特殊物体&#xff1a;panel下面用排列组件horizent layout group放置多个需要显示的面板&#xff0c;用mask遮罩好。 主要思路&#xff1a; 这次是要在最后一个toggle的地方&#xff0c;依然向左滚动回1&#xff0c;这是难点。因此实际…

CTFhub-sqli注入-报错注入

用到的函数 updatexml(1&#xff0c; &#xff0c;1) concat(0x7e, ,0x7e) group_concat(目标值) right(&#xff0c;32) 1 1 1 union select updatexml(1,concat(0x7e,database(),0x7e),1) 1 union select updatexml(1,concat(0x7e,(select(group_concat(ta…

ZIP压缩文件如何设置密码保护?

想要保护ZIP压缩文件&#xff0c;我们可以设置打开密码&#xff0c;下面来说说设置ZIP文件密码的两种方法。 方法一&#xff1a;单次设置打开密码 如果只需要对当前的ZIP压缩包进行加密&#xff0c;我们可以单独设置这个压缩包的密码。 使用WinRAR压缩文件的时候可以同时设置…

Redis下载与安装

文章目录 Redis简介下载&#xff0c;安装和配置&#xff08;cmd&#xff09;图形化工具 Redis 简介 下载&#xff0c;安装和配置&#xff08;cmd&#xff09; 开启redis服务 1.在解压出来的文件夹中打开cmd 2.输入 redis-server.exe redis.windows.conf即可开启服务 可以看到…

ElasticSearch总结

ES是什么 ES是一个天生支持分布式的搜索、聚合分析的存储引擎 基于Java开发 基于Lucene的开源分布式搜索引擎 ELK &#xff1a; elasticSearch Logstah Kibana 加入 Beats 后 ELK 改为 &#xff1a;Elastic stack ES解决了什么问题 ES解决的核心问题 &#xff1a; 1.海量数…

Linux Day11---mbash项目(二)

观看本文之前请先阅读Linux Day10的相关内容 1.touch 1.1 open系统调用 int open(const char*path,int oflags,mode_t mode); oflags参数&#xff1a; O_APPEND:把写入数据追加在文件的末尾 O_TRUNC:把文件长度设置为0&#xff0c;丢弃已有的内容 O_CREAT:如果需要&#…

如何自己实现一个丝滑的流程图绘制工具(一)vue如何使用

背景 项目需求突然叫我实现一个类似processOn一样的在线流程图绘制工具。 这可难倒我了&#xff0c;立马去做调研&#xff0c;在github上找了很多个开源的流程图绘制工具&#xff0c; 对比下来我还是选择了 bpmn-js 原因&#xff1a; 1、他的流程图是涉及到业务的&#xff0c…

idea上利用JDBC连接MySQL数据库(8.1.0版)

1.了解jdbc概念 JDBC(Java DataBase Connectivity,java数据库连接)是一种用于执行SQL语句的Java API&#xff0c;可以为多种 关系数据库提供统一访问&#xff0c;它由一组用Java语言编写的类和接口组成。JDBC提供了一种基准&#xff0c;据此可以构建 更高级的工具和接口&#…

顺序表链表OJ题(3)——【数据结构】

W...Y的主页 &#x1f60a; 代码仓库分享 &#x1f495; 前言&#xff1a; 今天是链表顺序表OJ练习题最后一次分享&#xff0c;每一次的分享题目的难度也再有所提高&#xff0c;但是我相信大家都是非常机智的&#xff0c;希望看到博主文章能学到东西的可以一键三连关注一下博主…