SAP ABAP代码模板CLASS

news2024/11/15 12:45:32

此模板也使用OO ALV,创建新程序简单,功能包装独立,用到一个独立的CLASS.

1.ALV类

class ZCL_CM_GUI_ALV definition
  public
  final
  create public .

public section.

  data REPID type SYREPID .
  data DYNNR type SYDYNNR .
  data TOOLBAR type CHAR30 .
  data USER_COMMAND type CHAR30 .
  data MENU_FORMNAME type CHAR30 .
  data DOUBLE_CLICK type CHAR30 .
  data DATA_CHANGED type CHAR30 .
  data NODE_DOUBLE_CLICK type CHAR30 .
  data CHANGED_FINISHED type CHAR30 .

  methods CONSTRUCTOR .
  methods CREATE_CUSTOM_CONTAINER
    importing
      !IO_CONTAINER type C optional
    changing
      !IO_GRID type ref to CL_GUI_ALV_GRID optional
      !IT_FCAT type LVC_T_FCAT optional
      !IS_LAYO type LVC_S_LAYO optional
      !IT_TABL type DATA optional
      !IS_VARIANT type DISVARIANT optional .
  methods CREATE_DOCKING_CONTAINER
    changing
      !IO_GRID type ref to CL_GUI_ALV_GRID optional
      !IT_FCAT type LVC_T_FCAT optional
      !IS_LAYO type LVC_S_LAYO optional
      !IT_TABL type DATA optional
      !IT_EXCLUDE type UI_FUNCTIONS optional
      !IS_VARIANT type DISVARIANT optional .
  methods REFRESH_ALV
    changing
      !IO_GRID type ref to CL_GUI_ALV_GRID optional
    raising
      CX_SY_REF_IS_INITIAL .
  methods CREATE_EDITOR
    importing
      !IO_CONTAINER type C optional
      !IV_LENGTH type I optional
    changing
      !IO_EDITOR type ref to CL_GUI_TEXTEDIT optional .
  methods CREATE_SIMPLE_TREE
    importing
      !IO_CONTAINER type C optional
    changing
      !IO_TREE type ref to CL_GUI_SIMPLE_TREE optional .
  methods HANDLE_USER_COMMAND
    for event USER_COMMAND of CL_GUI_ALV_GRID
    importing
      !E_UCOMM .
  methods HANDLE_DOUBLE_CLICK
    for event DOUBLE_CLICK of CL_GUI_ALV_GRID
    importing
      !E_ROW
      !E_COLUMN .
  methods HANDLE_TOOLBAR
    for event TOOLBAR of CL_GUI_ALV_GRID
    importing
      !E_OBJECT
      !E_INTERACTIVE .
  methods HANDLE_MENU_BUTTON
    for event MENU_BUTTON of CL_GUI_ALV_GRID
    importing
      !E_OBJECT
      !E_UCOMM .
  methods HANDLE_NODE_DOUBLE_CLICK
    for event NODE_DOUBLE_CLICK of CL_GUI_SIMPLE_TREE
    importing
      !NODE_KEY .
  methods HANDLE_DATA_CHANGED
    for event DATA_CHANGED of CL_GUI_ALV_GRID
    importing
      !ER_DATA_CHANGED
      !E_ONF4
      !E_ONF4_BEFORE
      !E_ONF4_AFTER
      !E_UCOMM .
  methods HANDLE_CHANGED_FINISHED
    for event DATA_CHANGED_FINISHED of CL_GUI_ALV_GRID
    importing
      !E_MODIFIED
      !ET_GOOD_CELLS .
protected section.
private section.
ENDCLASS.



CLASS ZCL_CM_GUI_ALV IMPLEMENTATION.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->CONSTRUCTOR
* +-------------------------------------------------------------------------------------------------+
* +--------------------------------------------------------------------------------------</SIGNATURE>
  method CONSTRUCTOR.
  endmethod.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->CREATE_CUSTOM_CONTAINER
* +-------------------------------------------------------------------------------------------------+
* | [--->] IO_CONTAINER                   TYPE        C(optional)
* | [<-->] IO_GRID                        TYPE REF TO CL_GUI_ALV_GRID(optional)
* | [<-->] IT_FCAT                        TYPE        LVC_T_FCAT(optional)
* | [<-->] IS_LAYO                        TYPE        LVC_S_LAYO(optional)
* | [<-->] IT_TABL                        TYPE        DATA(optional)
* | [<-->] IS_VARIANT                     TYPE        DISVARIANT(optional)
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD CREATE_CUSTOM_CONTAINER.

    DATA:
         LCL_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.


    CREATE OBJECT LCL_CONTAINER
      EXPORTING
        CONTAINER_NAME = IO_CONTAINER.

    CREATE OBJECT IO_GRID
      EXPORTING
        I_PARENT = LCL_CONTAINER.


    CALL METHOD IO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        IS_LAYOUT       = IS_LAYO
        IS_VARIANT      = IS_VARIANT
        I_SAVE          = 'A'
        I_DEFAULT       = 'X'
        "IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
      CHANGING
        IT_OUTTAB       = IT_TABL
        IT_FIELDCATALOG = IT_FCAT.

  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->CREATE_DOCKING_CONTAINER
* +-------------------------------------------------------------------------------------------------+
* | [<-->] IO_GRID                        TYPE REF TO CL_GUI_ALV_GRID(optional)
* | [<-->] IT_FCAT                        TYPE        LVC_T_FCAT(optional)
* | [<-->] IS_LAYO                        TYPE        LVC_S_LAYO(optional)
* | [<-->] IT_TABL                        TYPE        DATA(optional)
* | [<-->] IT_EXCLUDE                     TYPE        UI_FUNCTIONS(optional)
* | [<-->] IS_VARIANT                     TYPE        DISVARIANT(optional)
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD CREATE_DOCKING_CONTAINER.

    DATA:
         LCL_CONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER.


    CREATE OBJECT LCL_CONTAINER
      EXPORTING
        DYNNR                       = ME->DYNNR
        REPID                       = ME->REPID
        SIDE                        = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_TOP "居上部
        EXTENSION                   = 3000                       "输出的宽度
*       RATIO                       = 90                         "屏幕显示百分比
      EXCEPTIONS
        CNTL_ERROR                  = 1
        CNTL_SYSTEM_ERROR           = 2
        CREATE_ERROR                = 3
        LIFETIME_ERROR              = 4
        LIFETIME_DYNPRO_DYNPRO_LINK = 5.

    CREATE OBJECT IO_GRID
      EXPORTING
        I_PARENT = LCL_CONTAINER.
*
*
    CALL METHOD IO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        IS_LAYOUT            = IS_LAYO
        IS_VARIANT           = IS_VARIANT
        I_SAVE               = 'A'
        I_DEFAULT            = 'X'
        IT_TOOLBAR_EXCLUDING = IT_EXCLUDE
      CHANGING
        IT_OUTTAB            = IT_TABL
        IT_FIELDCATALOG      = IT_FCAT.

  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->CREATE_EDITOR
* +-------------------------------------------------------------------------------------------------+
* | [--->] IO_CONTAINER                   TYPE        C(optional)
* | [--->] IV_LENGTH                      TYPE        I(optional)
* | [<-->] IO_EDITOR                      TYPE REF TO CL_GUI_TEXTEDIT(optional)
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD CREATE_EDITOR.

    DATA:
      LCL_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.


    CREATE OBJECT LCL_CONTAINER
      EXPORTING
        CONTAINER_NAME = IO_CONTAINER.


    CREATE OBJECT IO_EDITOR
      EXPORTING
        PARENT                     = LCL_CONTAINER
        WORDWRAP_MODE              = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
        WORDWRAP_POSITION          = IV_LENGTH
        WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.




  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->CREATE_SIMPLE_TREE
* +-------------------------------------------------------------------------------------------------+
* | [--->] IO_CONTAINER                   TYPE        C(optional)
* | [<-->] IO_TREE                        TYPE REF TO CL_GUI_SIMPLE_TREE(optional)
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD CREATE_SIMPLE_TREE.

    DATA:
         LCL_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

    CREATE OBJECT LCL_CONTAINER
      EXPORTING
        CONTAINER_NAME = IO_CONTAINER.

    CREATE OBJECT IO_TREE
      EXPORTING
        PARENT              = LCL_CONTAINER
        NODE_SELECTION_MODE = CL_GUI_SIMPLE_TREE=>NODE_SEL_MODE_SINGLE.



  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->HANDLE_CHANGED_FINISHED
* +-------------------------------------------------------------------------------------------------+
* | [--->] E_MODIFIED                     LIKE
* | [--->] ET_GOOD_CELLS                  LIKE
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD HANDLE_CHANGED_FINISHED.

    PERFORM (ME->CHANGED_FINISHED) IN PROGRAM (ME->REPID)
                     USING E_MODIFIED
                           ET_GOOD_CELLS.
  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->HANDLE_DATA_CHANGED
* +-------------------------------------------------------------------------------------------------+
* | [--->] ER_DATA_CHANGED                LIKE
* | [--->] E_ONF4                         LIKE
* | [--->] E_ONF4_BEFORE                  LIKE
* | [--->] E_ONF4_AFTER                   LIKE
* | [--->] E_UCOMM                        LIKE
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD HANDLE_DATA_CHANGED.

    PERFORM (ME->DATA_CHANGED) IN PROGRAM (ME->REPID)
                         USING ER_DATA_CHANGED
                               E_ONF4
                               E_ONF4_BEFORE
                               E_ONF4_AFTER
                               E_UCOMM.
  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->HANDLE_DOUBLE_CLICK
* +-------------------------------------------------------------------------------------------------+
* | [--->] E_ROW                          LIKE
* | [--->] E_COLUMN                       LIKE
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD HANDLE_DOUBLE_CLICK.


    PERFORM (ME->DOUBLE_CLICK) IN PROGRAM (ME->REPID)
                               USING E_ROW
                                     E_COLUMN.

  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->HANDLE_MENU_BUTTON
* +-------------------------------------------------------------------------------------------------+
* | [--->] E_OBJECT                       LIKE
* | [--->] E_UCOMM                        LIKE
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD HANDLE_MENU_BUTTON.

    PERFORM (ME->MENU_FORMNAME) IN PROGRAM (ME->REPID)
                             USING E_OBJECT
                                   E_UCOMM.
  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->HANDLE_NODE_DOUBLE_CLICK
* +-------------------------------------------------------------------------------------------------+
* | [--->] NODE_KEY                       LIKE
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD HANDLE_NODE_DOUBLE_CLICK.

    PERFORM (ME->NODE_DOUBLE_CLICK) IN PROGRAM (ME->REPID)
                           USING NODE_KEY.

  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->HANDLE_TOOLBAR
* +-------------------------------------------------------------------------------------------------+
* | [--->] E_OBJECT                       LIKE
* | [--->] E_INTERACTIVE                  LIKE
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD HANDLE_TOOLBAR.


    PERFORM (ME->TOOLBAR) IN PROGRAM (ME->REPID)
                              USING E_OBJECT
                                    E_INTERACTIVE.


  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->HANDLE_USER_COMMAND
* +-------------------------------------------------------------------------------------------------+
* | [--->] E_UCOMM                        LIKE
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD HANDLE_USER_COMMAND.

    PERFORM (ME->USER_COMMAND) IN PROGRAM (ME->REPID)
                             USING E_UCOMM.


  ENDMETHOD.


* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_CM_GUI_ALV->REFRESH_ALV
* +-------------------------------------------------------------------------------------------------+
* | [<-->] IO_GRID                        TYPE REF TO CL_GUI_ALV_GRID(optional)
* | [!CX!] CX_SY_REF_IS_INITIAL
* +--------------------------------------------------------------------------------------</SIGNATURE>
  METHOD REFRESH_ALV.

    DATA:LS_STABLE TYPE LVC_S_STBL.

    LS_STABLE-ROW = 'X'.
    LS_STABLE-COL = 'X'.

    CALL METHOD IO_GRID->REFRESH_TABLE_DISPLAY
      EXPORTING
        IS_STABLE = LS_STABLE
      EXCEPTIONS
        FINISHED  = 1
        OTHERS    = 2.

    IF SY-SUBRC <> 0.

    ENDIF.

    CALL METHOD CL_GUI_CFW=>FLUSH.


  ENDMETHOD.
ENDCLASS.

2.功能程序

主程序

REPORT ZFID_002.

INCLUDE ZFID_002_TOP.      "Definition

INCLUDE ZFID_002_SEL.      "screen

INCLUDE ZFID_002_PBO.      "screen PBO

INCLUDE ZFID_002_PAI.      "Screen PAI

INCLUDE ZFID_002_FRM.      "Frogram

ZFID_002_FRM

*&---------------------------------------------------------------------*
*& 包含               ZFID_002_FRM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form FRM_GET_DATA
*&---------------------------------------------------------------------*
*& 获取数据
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_GET_DATA .

  DATA:LT_DDV1 TYPE TABLE OF DD07V,
       LT_DDV2 TYPE TABLE OF DD07V,
       LS_ALV  TYPE TY_ALV.

  DATA: LV_DATE TYPE SY-DATUM.

*----获取银行汇票信息数据

  SELECT
         BOE_NUMBER
         EBR_DATE
         SRL_NO
         BUKRS
         BUTXT
         KUNNR
         NAME1
         GSBER
         BOE_TYPE
         WRBTR
         WAERS
         WEFAE
         WDATE
         BOE_RECEIVE_DATE
         HBKID
         HKTID
         HBAKN
         HBAKL
         BANKL
         BANKN
         BANKA
         BOE_ACC_NAME
         BOE_DEPOSIT_ACCOUNT
         BOE_ACC_BANK_NUMBER
         BOE_ACC_BANK
         WBZOG
         BOE_DRAWEE_ACCOUNT
         BOE_DRAWEE_BANK_NUMBER
         BOE_DRAWEE_BANK
         WNAME
         BOE_DRAWER_ACCOUNT
         BOE_DRAWER_BANK_NUMBER
         BOE_DRAWER_BANK
         ZSFZL
         A~BOE_STATUS
         B~LTEXT
         BOE_NEGOT
         BOE_OVERDUE
         ZSFYDJ
         BUSCODE
         TRANSCODE
         FSEQNO
         ZPRINT
    INTO CORRESPONDING FIELDS OF TABLE GT_ALV
    FROM ZTFI_071 AS A LEFT JOIN ZTFI_069_02 AS B
                              ON A~BOE_STATUS = B~BOE_STATUS
   WHERE BUKRS        IN S_BUKRS
     AND HBKID        IN S_HBKID
     AND HKTID        IN S_HKTID
     AND KUNNR        IN S_KUNNR
     AND A~BOE_STATUS NE '06'  "去除已驳回票据
     AND LOEKZ        NE 'X'
     AND BOE_TYPE     IN S_TYPE
     AND ZSFYDJ       = ''.

  "排序规则  1.公司代码;2.开户行;3.汇票号
  SORT GT_ALV BY BUKRS HBKID BOE_NUMBER WEFAE .

*&-----获取其他数据
  IF GT_ALV[] IS NOT INITIAL.
*&-----获取公司数据
    SELECT BUKRS ,
           BUTXT
      INTO TABLE @DATA(LT_T001)
      FROM T001
       FOR ALL ENTRIES IN @GT_ALV
     WHERE BUKRS = @GT_ALV-BUKRS.

    "排序
    SORT LT_T001 BY BUKRS.

**&-----获取客户名称
*    SELECT KUNNR ,
*           NAME1
*      INTO TABLE @DATA(LT_KNA1)
*      FROM KNA1
*       FOR ALL ENTRIES IN @GT_ALV
*     WHERE KUNNR = @GT_ALV-KUNNR.
*
*    "排序
*    SORT LT_KNA1 BY KUNNR.

*&----获取业务部门描述
    SELECT GSBER ,
           GTEXT
      INTO TABLE @DATA(LT_TGSBT)
      FROM TGSBT
       FOR ALL ENTRIES IN @GT_ALV
     WHERE GSBER = @GT_ALV-GSBER
       AND SPRAS = @SY-LANGU.

    "排序
    SORT LT_TGSBT BY GSBER.

  ENDIF.

*&------赋值汇兑类型
  "定义承兑类型
  TYPES:BEGIN OF TY_BOE_TYPE,
          BOE_TYPE      TYPE BOE_TYP,        "汇票承兑类型
          BOE_TYPE_TEXT TYPE STRING,         "汇兑承兑类型描述
        END OF TY_BOE_TYPE.

  DATA:LT_BOE_TYPE TYPE TABLE OF TY_BOE_TYPE.

  "获取域值
  CALL FUNCTION 'DD_DOMA_GET'
    EXPORTING
      DOMAIN_NAME = 'BOE_TYP'
      GET_STATE   = 'M  '
      LANGU       = SY-LANGU
      PRID        = 0
      WITHTEXT    = 'X'
    TABLES
      DD07V_TAB_A = LT_DDV1
      DD07V_TAB_N = LT_DDV2.

  IF SY-SUBRC = 0.

    LOOP AT LT_DDV1 INTO DATA(LS_DDV1) .

      LT_BOE_TYPE = VALUE #( BASE LT_BOE_TYPE
                                ( BOE_TYPE       = LS_DDV1-DOMVALUE_L
                                  BOE_TYPE_TEXT  = LS_DDV1-DDTEXT
                                )
                             ).
    ENDLOOP.

  ENDIF.

  "排序
  SORT LT_BOE_TYPE BY BOE_TYPE.

  "获取当前日期后六个月的日期
  CALL FUNCTION 'MONTH_PLUS_DETERMINE'
    EXPORTING
      MONTHS  = 6
      OLDDATE = SY-DATUM   "输入日期
    IMPORTING
      NEWDATE = LV_DATE.   "返回日期


*&----内表赋值
  LOOP AT GT_ALV ASSIGNING FIELD-SYMBOL(<FS_ALV>).

    "如果到期日大于六个月的日期
    IF <FS_ALV>-WEFAE > LV_DATE.
      <FS_ALV>-COLOR =  GC_COLOR .
    ENDIF.

    IF <FS_ALV>-BOE_TYPE = 'Y'.
      <FS_ALV>-COLOR =  GC_RED .

    ENDIF.

*&---赋值公司名称
    READ TABLE LT_T001 INTO DATA(LS_T001)  WITH KEY BUKRS = <FS_ALV>-BUKRS BINARY SEARCH.
    IF SY-SUBRC = 0.
      <FS_ALV>-BUTXT = LS_T001-BUTXT.
    ENDIF.

*&---赋值客户名称
*    READ TABLE LT_KNA1 INTO DATA(LS_KNA1) WITH KEY KUNNR = <FS_ALV>-KUNNR BINARY SEARCH.
*    IF SY-SUBRC = 0.
*      <FS_ALV>-NAME1 = LS_KNA1-NAME1.
*    ENDIF.

*&----赋值业务部门描述
    READ TABLE LT_TGSBT INTO DATA(LS_TGSBT) WITH KEY  GSBER = <FS_ALV>-GSBER BINARY SEARCH.
    IF SY-SUBRC = 0.
      <FS_ALV>-GTEXT = LS_TGSBT-GTEXT.
    ENDIF.

*&---赋值汇兑类型
    READ TABLE LT_BOE_TYPE INTO DATA(LS_BOE_TYPE) WITH KEY  BOE_TYPE = <FS_ALV>-BOE_TYPE BINARY SEARCH.
    IF SY-SUBRC = 0.
      <FS_ALV>-BOE_TYPE_TEXT = LS_BOE_TYPE-BOE_TYPE_TEXT.
    ENDIF.

  ENDLOOP.

*----取银行通讯配置表数据

  IF GT_ALV IS NOT INITIAL.

    DATA(LT_TAB) = GT_ALV.
    SORT LT_TAB BY BUKRS HBKID HKTID.
    DELETE ADJACENT DUPLICATES FROM LT_TAB COMPARING BUKRS HBKID HKTID.

    SELECT A~*
      FROM ZTFI_070 AS A  INNER JOIN @LT_TAB AS B
        ON A~BUKRS = B~BUKRS
       AND A~HBKID = B~HBKID
       AND A~HKTID = B~HKTID
     WHERE A~BUKRS IN @S_BUKRS
      INTO TABLE @GT_070.

  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SET_LAYOUT
*&---------------------------------------------------------------------*
*& ALV 布局
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_SET_LAYOUT .
* ALV  布局
  CLEAR GS_LAYOUT.
*  GS_LAYOUT-ZEBRA      = 'X'.        "斑马线
  GS_LAYOUT-CWIDTH_OPT = 'X'.        "自动调整ALVL列宽
  GS_LAYOUT-SEL_MODE   = 'D'.        "选择方式
  GS_LAYOUT-BOX_FNAME  = 'BOX'.
  GS_LAYOUT-INFO_FNAME = 'COLOR'.     "行颜色

*ALV 变式
  CLEAR  GS_VARIANT.
  GS_VARIANT-REPORT = |{ SY-REPID }{ SY-DYNNR }|.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SET_FDCATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_SET_FDCATA .
  CLEAR:GT_FCAT_00.

  GT_FCAT_00 = VALUE #( ( FIELDNAME = 'BOE_NUMBER'             COLTEXT = TEXT-001   REF_TABLE = 'ZTFI_071'  REF_FIELD = 'BOE_NUMBER'           )
                        ( FIELDNAME = 'BUKRS'                  COLTEXT = TEXT-002   REF_TABLE = 'ZTFI_071'  REF_FIELD = 'BUKRS'                )
                        ( FIELDNAME = 'BUTXT'                  COLTEXT = TEXT-003   REF_TABLE = 'ZTFI_071'  REF_FIELD = 'BUTXT'                )
                        ( FIELDNAME = 'KUNNR'                  COLTEXT = TEXT-004   REF_TABLE = 'ZTFI_071'  REF_FIELD = 'KUNNR'                )
                        ( FIELDNAME = 'NAME1'                  COLTEXT = TEXT-005   REF_TABLE = 'ZTFI_071'  REF_FIELD = 'NAME1'                )
                        ( FIELDNAME = 'GSBER'                   COLTEXT = TEXT-006       "业务范围
                          REF_TABLE = 'ZTFI_071'              REF_FIELD = 'GSBER' )      "业务范围
*                        ( FIELDNAME = 'GTEXT'                   COLTEXT = TEXT-006       "业务范围
*                          REF_TABLE = 'ZTFI_071'              REF_FIELD = 'GSBER' )      "业务范围
*                        ( FIELDNAME = 'BOE_STATUS'             COLTEXT = TEXT-025        "汇票状态
*                          REF_TABLE = 'ZTFI_071'             REF_FIELD = 'BOE_STATUS')   "汇票状态
                        ( FIELDNAME = 'LTEXT'                  COLTEXT = TEXT-025       "汇票状态
                          REF_TABLE = 'ZTFI_071'             REF_FIELD = 'BOE_STATUS')   "汇票状态
                        ( FIELDNAME = 'BOE_TYPE'                COLTEXT = TEXT-007       "汇票承兑类型
                          REF_TABLE = 'ZTFI_071'              REF_FIELD = 'BOE_TYPE' )   "汇票承兑类型
*                        ( FIELDNAME = 'BOE_TYPE_TEXT'           COLTEXT = TEXT-007       "汇票承兑类型
*                          REF_TABLE = 'ZTFI_071'              REF_FIELD = 'BOE_TYPE' )   "汇票承兑类型
                        ( FIELDNAME = 'ZSFZL'                  COLTEXT = TEXT-023   REF_TABLE = 'ZTFI_071' REF_FIELD = 'ZSFZL'                  )
                        ( FIELDNAME = 'WRBTR'                  COLTEXT = TEXT-008   REF_TABLE = 'ZTFI_071' REF_FIELD = 'WRBTR'                  )
                        ( FIELDNAME = 'WAERS'                  COLTEXT = TEXT-058   REF_TABLE = 'ZTFI_071' REF_FIELD = 'WAERS'                  )
                        ( FIELDNAME = 'WEFAE'                  COLTEXT = TEXT-009   REF_TABLE = 'ZTFI_071' REF_FIELD = 'WEFAE'                  )
                        ( FIELDNAME = 'WDATE'                  COLTEXT = TEXT-051   REF_TABLE = 'ZTFI_071' REF_FIELD = 'WDATE'                  )
                        ( FIELDNAME = 'BOE_RECEIVE_DATE'       COLTEXT = TEXT-052   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_RECEIVE_DATE'       )
                        ( FIELDNAME = 'EBR_DATE'               COLTEXT = TEXT-094   REF_TABLE = 'ZTFI_071' REF_FIELD = 'EBR_DATE'               ) "银行回单日期
                        ( FIELDNAME = 'HBKID'                  COLTEXT = TEXT-053   REF_TABLE = 'ZTFI_071' REF_FIELD = 'HBKID'                  )
                        ( FIELDNAME = 'HKTID'                  COLTEXT = TEXT-054   REF_TABLE = 'ZTFI_071' REF_FIELD = 'HKTID'                  )
                        ( FIELDNAME = 'HBAKN'                  COLTEXT = TEXT-055   REF_TABLE = 'ZTFI_071' REF_FIELD = 'HBAKN'                  )
                        ( FIELDNAME = 'HBAKL'                  COLTEXT = TEXT-056   REF_TABLE = 'ZTFI_071' REF_FIELD = 'HBAKL'                  )
                        ( FIELDNAME = 'BANKL'                  COLTEXT = TEXT-010   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BANKL'                  )
                        ( FIELDNAME = 'BANKN'                  COLTEXT = TEXT-011   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BANKN'                  )
                        ( FIELDNAME = 'BANKA'                  COLTEXT = TEXT-012   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BANKA'                  )

                        ( FIELDNAME = 'BOE_ACC_NAME'           COLTEXT = TEXT-104   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_ACC_NAME'           )"承兑人名称
                        ( FIELDNAME = 'BOE_DEPOSIT_ACCOUNT'    COLTEXT = TEXT-105   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_DEPOSIT_ACCOUNT'    )"承兑人银行账号

                        ( FIELDNAME = 'BOE_ACC_BANK_NUMBER'    COLTEXT = TEXT-013   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_ACC_BANK_NUMBER'    )
                        ( FIELDNAME = 'BOE_ACC_BANK'           COLTEXT = TEXT-014   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_ACC_BANK'           )
                        ( FIELDNAME = 'WBZOG'                  COLTEXT = TEXT-015   REF_TABLE = 'ZTFI_071' REF_FIELD = 'WBZOG'                  )
                        ( FIELDNAME = 'BOE_DRAWEE_ACCOUNT'     COLTEXT = TEXT-016   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_DRAWEE_ACCOUNT'     )
                        ( FIELDNAME = 'BOE_DRAWEE_BANK_NUMBER' COLTEXT = TEXT-017   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_DRAWEE_BANK_NUMBER' )
                        ( FIELDNAME = 'BOE_DRAWEE_BANK'        COLTEXT = TEXT-018   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_DRAWEE_BANK'        )
                        ( FIELDNAME = 'WNAME'                  COLTEXT = TEXT-019   REF_TABLE = 'ZTFI_071' REF_FIELD = 'WNAME'                  )
                        ( FIELDNAME = 'BOE_DRAWER_ACCOUNT'     COLTEXT = TEXT-020   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_DRAWER_ACCOUNT'     )
                        ( FIELDNAME = 'BOE_DRAWER_BANK_NUMBER' COLTEXT = TEXT-021   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_DRAWER_BANK_NUMBER' )
                        ( FIELDNAME = 'BOE_DRAWER_BANK'        COLTEXT = TEXT-022   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_DRAWER_BANK'        )
                        ( FIELDNAME = 'BOE_NEGOT'              COLTEXT = TEXT-071   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_NEGOT'              )
                        ( FIELDNAME = 'BOE_OVERDUE'            COLTEXT = TEXT-072   REF_TABLE = 'ZTFI_071' REF_FIELD = 'BOE_OVERDUE'            )
                        ( FIELDNAME = 'ZPRINT'                 COLTEXT = TEXT-135   REF_TABLE = 'ZTFI_071' REF_FIELD = 'ZPRINT'                 )
                        ).
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CALL_ALV_CLASS
*&---------------------------------------------------------------------*
*& 创建ALV容器&显示ALV&注册事件
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_CALL_ALV_CLASS .

  IF GCL_GRID_00 IS INITIAL.
*----创建容器
    TRY.
        GCL_CLS_00->CREATE_DOCKING_CONTAINER(
              CHANGING
                IO_GRID    = GCL_GRID_00
                IT_FCAT    = GT_FCAT_00
                IS_LAYO    = GS_LAYOUT
                IT_TABL    = GT_ALV
                IS_VARIANT = GS_VARIANT
                IT_EXCLUDE = GT_EXCLUDE
                 ).

      CATCH CX_SY_REF_IS_INITIAL INTO DATA(LC_ERROR).

        DATA(LV_ERROR) = LC_ERROR->IF_MESSAGE~GET_TEXT( ).

    ENDTRY.

*----注册事件

*---类属性赋值
    GCL_CLS_00->REPID               = SY-REPID.
    GCL_CLS_00->DYNNR               = GC_DYNNR_00.
    GCL_CLS_00->TOOLBAR             = 'FRM_HANDLE_TOOLBAR'.
    GCL_CLS_00->MENU_FORMNAME       = 'FRM_HANDLE_MENU_BUTTON'.
    GCL_CLS_00->USER_COMMAND        = 'FRM_HANDLE_USER_COMMAND'.
    GCL_CLS_00->DOUBLE_CLICK        = 'FRM_HANDLE_DOUBLE_CLICK'.

    SET HANDLER GCL_CLS_00->HANDLE_TOOLBAR       FOR GCL_GRID_00.
    SET HANDLER GCL_CLS_00->HANDLE_MENU_BUTTON   FOR GCL_GRID_00.
    SET HANDLER GCL_CLS_00->HANDLE_USER_COMMAND  FOR GCL_GRID_00.
    SET HANDLER GCL_CLS_00->HANDLE_DOUBLE_CLICK  FOR GCL_GRID_00.


    CALL METHOD GCL_GRID_00->SET_TOOLBAR_INTERACTIVE.

    CALL METHOD GCL_GRID_00->REGISTER_EDIT_EVENT
      EXPORTING
        I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.


  ELSE.
    GCL_CLS_00->REFRESH_ALV(
      CHANGING
          IO_GRID = GCL_GRID_00
    ).

  ENDIF.

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  FRM_DISPLAY                                              *
*&---------------------------------------------------------------------*
*&      9000 screen ALV工具栏命令                                                 *
*&---------------------------------------------------------------------*
*&  -->  p1    text                                                    *
*&  <--  p2    text                                                    *
*&---------------------------------------------------------------------*
FORM FRM_USER_COMMAND.

  CLEAR SAVE_OK.
  SAVE_OK = OK_CODE.
  CLEAR OK_CODE.

  CASE SAVE_OK.
    WHEN 'BACK' OR 'CANCLE'.
      LEAVE TO SCREEN 0.
    WHEN 'CONFIRM'.
      "进行状态校验
      PERFORM FRM_CHECK_LINE USING 'MANUAL'.
*---手动辨识确认
      PERFORM FRM_CONFIRM_INDTFIY.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
    WHEN 'SAVE'.


    WHEN OTHERS.
  ENDCASE.


ENDFORM.
*&---------------------------------------------------------------------*
*&      Module  MOD_AT_EXIT  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MOD_AT_EXIT INPUT.
  CLEAR SAVE_OK.
  SAVE_OK = OK_CODE.
  CLEAR OK_CODE.

  CASE SAVE_OK.
    WHEN  'CANCLE'.
      LEAVE TO SCREEN 0.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Form FRM_HANDLE_TOOLBAR
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> E_OBJECT
*&---------------------------------------------------------------------*
FORM FRM_HANDLE_TOOLBAR USING E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET
                              E_INTERACTIVE TYPE CHAR01.

  DATA: LS_TOOLBAR TYPE STB_BUTTON,
        L_LINES    TYPE I.

  IF SY-DYNNR  = GC_DYNNR_00 OR SY-DYNNR = GC_DYNNR_20.

    E_OBJECT->MT_TOOLBAR =
            VALUE #( BASE E_OBJECT->MT_TOOLBAR
                     ( BUTN_TYPE = '3' )

                    "--打印
                    (  FUNCTION  = 'PRINT'    ICON = ICON_PRINT )

                     "---获取回单
                     (  FUNCTION  = 'RECEIPT'  ICON = ICON_PROPOSITION
                        QUICKINFO = TEXT-027   TEXT = TEXT-027 )
                    "--辨识
                    (  FUNCTION  = 'IDENTIFY' ICON = ICON_ZOOM_IN
                       BUTN_TYPE = '1'
                       QUICKINFO = TEXT-030   TEXT = TEXT-030 )

                     "--签收
                     (  FUNCTION  = 'SIGN'     ICON = ICON_WORKFLOW_INBOX
                        QUICKINFO = TEXT-028   TEXT = TEXT-028 )
                     "--驳回
                     (  FUNCTION  = 'REJECT'   ICON = ICON_REJECT
                        QUICKINFO = TEXT-029   TEXT = TEXT-029 )
                     "--查询
                     (  FUNCTION  = 'QUERY'    ICON = ICON_QUERY
                        QUICKINFO = TEXT-031   TEXT = TEXT-031 )
                      "--流转信息查询
                     (  FUNCTION  = 'CIRCULATION'    ICON = ICON_QUERY
                        QUICKINFO = TEXT-078         TEXT = TEXT-078 )
                    "--移除
                    (  FUNCTION  = 'DELETE'   ICON = ICON_DELETE
                       QUICKINFO = TEXT-111   TEXT = TEXT-111 )

                        ).


  ELSEIF SY-DYNNR  = GC_DYNNR_10.


    E_OBJECT->MT_TOOLBAR =
            VALUE #( BASE E_OBJECT->MT_TOOLBAR
                     ( BUTN_TYPE = '3' )
                     "---发送查询
                     (  FUNCTION  = 'SEND'   ICON = ICON_MAIL
                        QUICKINFO = TEXT-045 TEXT = TEXT-045 ) ).

  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_HAND_MENU_BUTTON
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> E_OBJECT
*&      --> E_UCOMM
*&---------------------------------------------------------------------*
FORM FRM_HANDLE_MENU_BUTTON USING E_OBJECT TYPE REF TO CL_CTMENU
                                  E_UCOMM.

  IF E_UCOMM = 'IDENTIFY'.
*----自动辨识
    CALL METHOD E_OBJECT->ADD_FUNCTION
      EXPORTING
        FCODE = 'AUTO'        "FUNCTION CODE
        TEXT  = TEXT-032.    "SUBMENU TEXT

*----手动辨识
    CALL METHOD E_OBJECT->ADD_FUNCTION
      EXPORTING
        FCODE = 'MANUAL'        "FUNCTION CODE
        TEXT  = TEXT-033.    "SUBMENU TEXT

  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_HANDLE_USER_COMMAND
*&---------------------------------------------------------------------*
*& 按钮动作
*&---------------------------------------------------------------------*
*&      --> E_OBJECT
*&      --> E_UCOMM
*&---------------------------------------------------------------------*
FORM FRM_HANDLE_USER_COMMAND  USING E_UCOMM.


  CASE E_UCOMM.
    WHEN 'RECEIPT'.
*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.

*-----获取回单
      "查询直连银行账户信息
      PERFORM FRM_GET_RECEIPT_ACC.

      "数据展示
      PERFORM FRM_RECEIPT_BANK_ORDER.

    WHEN 'SIGN'.

*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.
*-----签收
      "选择行
      PERFORM FRM_ALV_SLE_ROW.
      "检查行状态
      PERFORM FRM_CHECK_LINE USING E_UCOMM.

      "确认签收
      PERFORM FRM_CONFIRM_SCREEN USING 'X'.

      PERFORM FRM_ALV_DEQUEUE.

    WHEN 'REJECT'.

*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.

*-----拒绝
      "选择行
      PERFORM FRM_ALV_SLE_ROW.
      "检查行状态
      PERFORM FRM_CHECK_LINE USING E_UCOMM.

      "确认驳回
      PERFORM FRM_CONFIRM_SCREEN USING ''.

      PERFORM FRM_ALV_DEQUEUE.


    WHEN 'QUERY'.

*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.

*-----查询
      "选择行
      PERFORM FRM_ALV_SLE_ROW.
      "检查行状态
      PERFORM FRM_CHECK_LINE USING E_UCOMM.
      "查询
      PERFORM FRM_QUERY_DATA.

      PERFORM FRM_ALV_DEQUEUE.


    WHEN 'AUTO'.
*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.

*----自动辨识
      "选择行
      PERFORM FRM_ALV_SLE_ROW.

      PERFORM FRM_CHECK_LINE USING E_UCOMM.

      PERFORM FRM_AUTO_INDET.

      PERFORM FRM_ALV_DEQUEUE.

    WHEN 'MANUAL'.

*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.
*----手动辨识
      "选择行
      PERFORM FRM_ALV_SLE_ROW.

      PERFORM FRM_ALV_CHECK_MANUAL.

      PERFORM FRM_MANUAL_INDET.

      PERFORM FRM_ALV_DEQUEUE.


    WHEN 'SEND'.

*-----查询回单
      "检查屏幕输入查询回单日期
      PERFORM FRM_CHECK_DATE.

      "选择行
      PERFORM FRM_RECEIPT_SLE_ROW.

      "发送银行
      PERFORM FRM_SEND_BANK.

      "解锁
      PERFORM FRM_RECIPT_DEQUEUE.

      "刷新屏幕
      PERFORM FRM_REFRESH_RECIPT.

    WHEN 'CIRCULATION'.

*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.

*-----流转信息查询
      PERFORM FRM_ALV_SLE_ROW.

      "流转信息查询
      PERFORM FRM_DATA_CIRCULATION USING 'CIRCULATION'.

      "解锁
      PERFORM FRM_ALV_DEQUEUE.

    WHEN 'DELETE'.
*&-----移除
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.

      "选择行
      PERFORM FRM_ALV_SLE_ROW.

      "检查汇票状态
      PERFORM FRM_DELETE_STATUS.

      "移除汇票
      PERFORM FRM_DATA_DELETE.
    WHEN 'PRINT'.

*------按钮权限检查 ADD 20200610
      PERFORM FRM_BNT_AUTH_CHECK USING GC_MAINTAIN.

*-----流转信息查询
      PERFORM FRM_ALV_SLE_ROW.

*-----批量打印
      PERFORM FRM_DATA_PRINT.

*-----解锁
      PERFORM FRM_ALV_DEQUEUE.

    WHEN OTHERS.
  ENDCASE.

  "清空消息框
  CLEAR:GT_MSG.

  "删除选中记录
  DATA:LS_ALV TYPE TY_ALV.

  LS_ALV-BOX        = ''.

  "更新选中信息
  MODIFY GT_ALV FROM LS_ALV TRANSPORTING BOX WHERE BOX = 'X'.

*&---刷新屏幕
  IF GCL_GRID_00 IS NOT  INITIAL.
    GCL_CLS_00->REFRESH_ALV(
    CHANGING
      IO_GRID = GCL_GRID_00
      ).
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_RECEIPT_BANK_ORDER
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_RECEIPT_BANK_ORDER .

  IF GT_MSG IS NOT INITIAL.

    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    RETURN.


  ELSE.
*---调用获取回单屏幕

    CALL SCREEN 9010.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SET_FACT_10
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_SET_FACT_10 .

  GT_FCAT_10 = VALUE #( ( FIELDNAME = 'BUKRS' COLTEXT = TEXT-035 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'BUKRS' )
                        ( FIELDNAME = 'BUTXT' COLTEXT = TEXT-036 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'BUTXT' )
                        ( FIELDNAME = 'HBKID' COLTEXT = TEXT-037 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'HBKID' )
                        ( FIELDNAME = 'HKTID' COLTEXT = TEXT-038 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'HKTID' )
                        ( FIELDNAME = 'BANKS' COLTEXT = TEXT-039 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'BANKS' )
                        ( FIELDNAME = 'BANKN' COLTEXT = TEXT-040 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'BANKN' )
                        ( FIELDNAME = 'BANKL' COLTEXT = TEXT-041 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'BANKL' )
                        ( FIELDNAME = 'BANKA' COLTEXT = TEXT-042 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'BANKA' )
                        ( FIELDNAME = 'HKONT' COLTEXT = TEXT-043 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'HKONT' )
                        ( FIELDNAME = 'TEXT1' COLTEXT = TEXT-044 REF_TABLE = 'ZTFI_070'  REF_FIELD = 'TEXT1' ) ).


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CALL_RECIPT_ALV
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_CALL_RECIPT_ALV .

  IF GCL_GRID_10 IS INITIAL.
*----创建容器
    TRY.
        GCL_CLS_10->CREATE_DOCKING_CONTAINER(
              CHANGING
                IO_GRID  = GCL_GRID_10
                IT_FCAT  = GT_FCAT_10
                IS_LAYO  = GS_LAYOUT
                IT_TABL  = GT_RECEIPT_ALV
                IS_VARIANT = GS_VARIANT
                 ).

      CATCH CX_SY_REF_IS_INITIAL INTO DATA(LC_ERROR).

        DATA(LV_ERROR) = LC_ERROR->IF_MESSAGE~GET_TEXT( ).

    ENDTRY.

*---类属性赋值
    GCL_CLS_10->REPID         = SY-REPID.
    GCL_CLS_10->DYNNR         = GC_DYNNR_10.
    GCL_CLS_10->TOOLBAR       = 'FRM_HANDLE_TOOLBAR'.
    GCL_CLS_10->USER_COMMAND  = 'FRM_HANDLE_USER_COMMAND'.

    SET HANDLER GCL_CLS_10->HANDLE_TOOLBAR       FOR GCL_GRID_10.
    SET HANDLER GCL_CLS_10->HANDLE_USER_COMMAND  FOR GCL_GRID_10.


    CALL METHOD GCL_GRID_10->SET_TOOLBAR_INTERACTIVE.


  ELSE.
    GCL_CLS_10->REFRESH_ALV(
      CHANGING
          IO_GRID = GCL_GRID_10
    ).

  ENDIF.



ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_GET_RECEIPT_ACC
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_GET_RECEIPT_ACC .

  CHECK GT_MSG IS INITIAL.

*----查询直连银行账户信息

  CLEAR GT_RECEIPT_ALV.
  SELECT BUKRS
         BUTXT
         HBKID
         HKTID
         BANKS
         BANKN
         BANKL
         BANKA
         HKONT
         TEXT1
         RFCDEST
    INTO CORRESPONDING FIELDS OF TABLE GT_RECEIPT_ALV
    FROM ZTFI_070
   WHERE BUKRS IN S_BUKRS
     AND HBKID IN S_HBKID
     AND HKTID IN S_HKTID.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_DATE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_CHECK_DATE .

*----回单查询日期不能超过31天
  CLEAR:GT_MSG.
  IF S_ERDAT-HIGH IS INITIAL OR S_ERDAT-LOW IS INITIAL.

    GT_MSG = VALUE #( BASE GT_MSG
                      ( MSGID = 'ZMFI01'  MSGTY = 'E'
                        MSGNO = '002'     MSGV1 = TEXT-046  ) ).

  ELSE.

    IF S_ERDAT-HIGH - S_ERDAT-LOW > 31.

      GT_MSG = VALUE #( BASE GT_MSG
                        ( MSGID = 'ZMFI01'  MSGTY = 'E'
                          MSGNO = '002'     MSGV1 = TEXT-047  ) ).

    ENDIF.

  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_RECEIPT_SLE_ROW
*&---------------------------------------------------------------------*
*& 选择行
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_RECEIPT_SLE_ROW .

  DATA: LT_ROW    TYPE LVC_T_ROW,
        LS_ROW    TYPE LVC_S_ROW,
        LS_ALV    TYPE TY_RECEIPT,
        LV_VARKEY TYPE RSTABLE-VARKEY.


  CALL METHOD GCL_GRID_10->GET_SELECTED_ROWS
    IMPORTING
      ET_INDEX_ROWS = LT_ROW.

*----判断选择行
  IF LT_ROW[] IS INITIAL.

    GT_MSG = VALUE #( BASE GT_MSG
                      ( MSGID = 'EPIC_EBR_UI' MSGTY = 'E'
                        MSGNO = '034'         "MSGV1 = TEXT-048
                          ) ).

  ELSE.
    LOOP AT LT_ROW INTO LS_ROW.
      CLEAR LS_ALV.

      READ TABLE GT_RECEIPT_ALV INTO LS_ALV INDEX  LS_ROW-INDEX.
      IF SY-SUBRC EQ 0.
        LS_ALV-BOX = 'X'.
*----条目锁
        CLEAR:LV_VARKEY.

        LV_VARKEY = |{ LS_ALV-BUKRS }{ LS_ALV-HBKID }{ LS_ALV-HKTID }|.

        PERFORM FRM_ENQUEUE_OBJECT USING LV_VARKEY.

        MODIFY GT_RECEIPT_ALV FROM LS_ALV INDEX LS_ROW-INDEX TRANSPORTING BOX.
      ENDIF.
    ENDLOOP.
  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SEND_BANK
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_SEND_BANK .
  DATA:LT_ZT071      TYPE TABLE OF ZTFI_071,
       LT_CHECK_DEL  TYPE TABLE OF ZTFI_071,
       LT_CHECK_SAVE TYPE TABLE OF ZTFI_071,
       LT_SAVE       TYPE TABLE OF ZTFI_071,
       LS_SAVE       TYPE          ZTFI_071,
       LS_T070       TYPE          ZTFI_070,
       LT_RET_MSG    TYPE          ESP1_MESSAGE_TAB_TYPE,
       LT_MSG        TYPE          ESP1_MESSAGE_TAB_TYPE,
       LS_MSG        TYPE          ESP1_MESSAGE_WA_TYPE,
       LV_VARKEY     TYPE          RSTABLE-VARKEY,
       LT_LOG        TYPE TABLE OF ZTCM_004,
       LT_RET_LOG    TYPE TABLE OF ZTCM_004.

  DATA:LV_ERROR TYPE C.
  DATA:LV_DATE TYPE SY-DATUM.

  IF GT_MSG IS NOT INITIAL.
*---错误消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR: GT_MSG.
    RETURN.

  ELSE.


*---取待签收票据的业务类型配置信息
    SELECT
           RFCDEST,
           FNAME
      INTO TABLE @DATA(LT_FNAME)
      FROM ZTFI_069_03
     WHERE BCTYP = '010'.

    CLEAR:LT_LOG,
          LT_SAVE.

    LOOP AT GT_RECEIPT_ALV INTO DATA(LS_RECEIPT) WHERE BOX = GC_X.

      READ TABLE LT_FNAME INTO DATA(LS_FNAME) WITH KEY RFCDEST = LS_RECEIPT-RFCDEST.

      IF SY-SUBRC EQ 0.

        CLEAR:LT_ZT071,
              LS_T070,
              LT_RET_MSG,
              LT_RET_LOG.

        LS_T070 = CORRESPONDING #( LS_RECEIPT ).

        TRY.
            CALL FUNCTION LS_FNAME-FNAME
              EXPORTING
                I_RQT_STU  = LS_T070
                I_START    = S_ERDAT-LOW
                I_END      = S_ERDAT-HIGH
*      IMPORTING
*               E_MESSAG   =
              TABLES
                ET_RECIPET = LT_ZT071
                ET_MSG     = LT_RET_MSG
                ET_LOG     = LT_RET_LOG.

          CATCH CX_ROOT INTO DATA(LC_ERROR).
*----函数调用失败异常消息
            LT_MSG = VALUE #( BASE LT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                            MSGNO = '002'     MSGV1 = LC_ERROR->GET_TEXT( ) ) ).

        ENDTRY.

        IF LT_ZT071 IS NOT INITIAL.

          APPEND LINES OF LT_ZT071 TO LT_SAVE.

          CLEAR:LT_RET_MSG,LT_ZT071.

        ENDIF.

        IF LT_RET_MSG IS NOT INITIAL.
          APPEND LINES OF LT_RET_MSG TO LT_MSG.
          CLEAR:LT_RET_MSG.
        ENDIF.

        IF LT_RET_LOG IS NOT INITIAL.
          APPEND LINES OF LT_RET_LOG TO LT_LOG.
          CLEAR:LT_RET_LOG.
        ENDIF.

      ELSE.
        GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                        MSGNO = '000'     MSGV1 = TEXT-103 ) ).

      ENDIF.

    ENDLOOP.

    "获取当前日期后六个月的日期
    CALL FUNCTION 'MONTH_PLUS_DETERMINE'
      EXPORTING
        MONTHS  = 6
        OLDDATE = SY-DATUM   "输入日期
      IMPORTING
        NEWDATE = LV_DATE.   "返回日期

*----取数据库
    SELECT
           A~BUKRS,
           A~SRL_NO,
           A~BOE_NUMBER,
           A~LOEKZ

      FROM ZTFI_071 AS A INNER JOIN @LT_SAVE AS B
                                 ON A~BUKRS  = B~BUKRS
                                AND A~SRL_NO = B~SRL_NO
                                AND A~BOE_NUMBER = B~BOE_NUMBER
     WHERE A~LOEKZ <> 'X'
      INTO TABLE @DATA(LT_TAB).

    SORT LT_TAB BY BUKRS
                   SRL_NO
                   BOE_NUMBER.

*&--20200831 HAND_ZBH
*&--添加获取回单检查逻辑
*&---根据回单的公司代码汇票编号查询ZTFI_071
    SELECT A~*
      FROM ZTFI_071 AS A INNER JOIN @LT_SAVE AS B
                                 ON A~BUKRS  = B~BUKRS
                                AND A~BOE_NUMBER = B~BOE_NUMBER
     WHERE A~LOEKZ <> 'X'
      INTO TABLE @LT_CHECK_DEL.

    SORT LT_CHECK_DEL BY BUKRS
                         BOE_NUMBER.

    DATA:LS_ALV TYPE TY_ALV.
    LOOP AT LT_SAVE INTO LS_SAVE.

      "防止回单拉取重复
      READ TABLE LT_TAB WITH KEY BOE_NUMBER = LS_SAVE-BOE_NUMBER
                                 BUKRS      = LS_SAVE-BUKRS
                                 SRL_NO     = LS_SAVE-SRL_NO TRANSPORTING NO FIELDS.
      IF SY-SUBRC EQ 0.
        DELETE LT_SAVE  WHERE BOE_NUMBER = LS_SAVE-BOE_NUMBER
                          AND BUKRS      = LS_SAVE-BUKRS
                          AND SRL_NO     = LS_SAVE-SRL_NO.
      ELSE.

        LOOP AT LT_CHECK_DEL INTO DATA(LS_CHECK_DEL) WHERE BOE_NUMBER = LS_SAVE-BOE_NUMBER AND BUKRS = LS_SAVE-BUKRS.

          IF LS_CHECK_DEL-BOE_STATUS = '01'
           OR  LS_CHECK_DEL-BOE_STATUS = '02'
           OR  LS_CHECK_DEL-BOE_STATUS = '20'
           OR  LS_CHECK_DEL-BOE_STATUS = '21'.
            "状态为“回单已创建”或“已辨识”或“签收失败”或“驳回失败”
            "则将该汇票打上删除标记X
            LS_CHECK_DEL-LOEKZ      = 'X'       .
            LS_CHECK_DEL-UPNAM      = SY-UNAME  .
            LS_CHECK_DEL-UPDAT      = SY-DATUM  .
            LS_CHECK_DEL-UPTIM      = SY-UZEIT  .

            "添加到修改表中去
            APPEND LS_CHECK_DEL TO LT_CHECK_SAVE.

            "删除内表中的数据
            READ TABLE GT_ALV WITH KEY BOE_NUMBER = LS_CHECK_DEL-BOE_NUMBER
                                       BUKRS      = LS_CHECK_DEL-BUKRS
                                       SRL_NO     = LS_CHECK_DEL-SRL_NO TRANSPORTING NO FIELDS.
            IF SY-SUBRC EQ 0.

              DELETE GT_ALV  WHERE BOE_NUMBER  = LS_CHECK_DEL-BOE_NUMBER
                                AND BUKRS      = LS_CHECK_DEL-BUKRS
                                AND SRL_NO     = LS_CHECK_DEL-SRL_NO.
            ENDIF.

          ELSEIF LS_CHECK_DEL-BOE_STATUS = '03'
            OR  LS_CHECK_DEL-BOE_STATUS = '04'.
            "汇票状态为“签收中”或“驳回中”
            "则将该汇票打上删除标记X,并将汇票状态改为“已辨识”
            LS_CHECK_DEL-LOEKZ      = 'X'       .
            LS_CHECK_DEL-BOE_STATUS = '02'      .
            LS_CHECK_DEL-UPNAM      = SY-UNAME  .
            LS_CHECK_DEL-UPDAT      = SY-DATUM  .
            LS_CHECK_DEL-UPTIM      = SY-UZEIT  .

            "添加到修改表中去
            APPEND LS_CHECK_DEL TO LT_CHECK_SAVE.

            "删除内表中的数据
            READ TABLE GT_ALV WITH KEY BOE_NUMBER = LS_CHECK_DEL-BOE_NUMBER
                                       BUKRS      = LS_CHECK_DEL-BUKRS
                                       SRL_NO     = LS_CHECK_DEL-SRL_NO TRANSPORTING NO FIELDS.
            IF SY-SUBRC EQ 0.

              DELETE GT_ALV  WHERE BOE_NUMBER  = LS_CHECK_DEL-BOE_NUMBER
                                AND BUKRS      = LS_CHECK_DEL-BUKRS
                                AND SRL_NO     = LS_CHECK_DEL-SRL_NO.
            ENDIF.

          ENDIF.

        ENDLOOP.


*---将取到得数据追加到ALV
        LS_ALV = CORRESPONDING #( LS_SAVE ).
        LS_ALV-LTEXT = TEXT-075.

        IF LS_ALV-BOE_TYPE = 'X'.
          LS_ALV-BOE_TYPE_TEXT = TEXT-076."X  电子银行承兑
        ELSEIF LS_ALV-BOE_TYPE = 'Y'.
          LS_ALV-BOE_TYPE_TEXT = TEXT-077."Y  电子商业承兑
        ENDIF.

        "如果到期日大于六个月的日期
        IF LS_ALV-WEFAE > LV_DATE.
          LS_ALV-COLOR =  GC_COLOR .
        ENDIF.

        IF LS_ALV-BOE_TYPE = 'Y'.
          LS_ALV-COLOR =  GC_RED .
        ENDIF.

        APPEND LS_ALV TO GT_ALV.

        LS_MSG-MSGTY = 'S'.
        LS_MSG-MSGID = 'ZMFI01'.
        LS_MSG-MSGNO = '000'.
        LS_MSG-MSGV1 = |{ TEXT-057 }{ LS_SAVE-BOE_NUMBER(30) }|.
        LS_MSG-MSGV2 =  LS_SAVE-BOE_NUMBER+30(25).
        APPEND LS_MSG TO LT_MSG.

        CLEAR LS_ALV.
      ENDIF.

    ENDLOOP.

    "修改的数据
    IF LT_CHECK_SAVE IS NOT INITIAL.
      APPEND LINES OF LT_CHECK_SAVE TO LT_SAVE.

    ENDIF.


    IF LT_SAVE IS NOT INITIAL.
      "更新数据表
      MODIFY ZTFI_071 FROM TABLE LT_SAVE.
      IF SY-SUBRC NE 0.
        LV_ERROR = 'X'.
      ENDIF.
    ELSE.
      LS_MSG-MSGTY = 'E'.
      LS_MSG-MSGID = 'ZMFI01'.
      LS_MSG-MSGNO = '002'.
      LS_MSG-MSGV1 = TEXT-096.
      APPEND LS_MSG TO LT_MSG.

    ENDIF.

    IF LV_ERROR = 'X'.
      ROLLBACK WORK.

    ELSE.
      COMMIT WORK AND WAIT.

    ENDIF.


    "先判断日志是否为空
    IF LT_LOG IS NOT INITIAL.
      "更新日志表
      MODIFY ZTCM_004 FROM TABLE LT_LOG.
      IF SY-SUBRC NE 0.
        ROLLBACK WORK.
      ELSE.
        COMMIT WORK AND WAIT.
      ENDIF.

    ENDIF.


*---消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = LT_MSG.
    RETURN.

  ENDIF.

  LEAVE TO SCREEN 0.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_INIT_DATE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_INIT_DATE .

*---回单日期默认
  S_ERDAT[] = VALUE #( (  SIGN = 'I' OPTION = 'BT' HIGH = SY-DATUM + 1   )  ).

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_ALV_SLE_ROW
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_ALV_SLE_ROW .
  DATA: LT_ROW    TYPE LVC_T_ROW,
        LS_ROW    TYPE LVC_S_ROW,
        LS_ALV    TYPE TY_ALV,
        LV_VARKEY TYPE RSTABLE-VARKEY.

  CHECK GT_MSG IS INITIAL.


  CALL METHOD GCL_GRID_00->GET_SELECTED_ROWS
    IMPORTING
      ET_INDEX_ROWS = LT_ROW.

*----判断选择行
  CLEAR:GT_MSG.
  IF LT_ROW[] IS INITIAL.


    GT_MSG = VALUE #( BASE GT_MSG
                      ( MSGID = 'EPIC_EBR_UI' MSGTY = 'E'
                        MSGNO = '034'         "MSGV1 = TEXT-048
                          ) ).

  ELSE.
    LOOP AT LT_ROW INTO LS_ROW.
      CLEAR LS_ALV.
      READ TABLE GT_ALV INTO LS_ALV INDEX LS_ROW-INDEX.
      IF SY-SUBRC EQ 0.

        LS_ALV-BOX = 'X'.
*----条目锁
        CLEAR:LV_VARKEY.
        LV_VARKEY = |{ LS_ALV-BUKRS }{ LS_ALV-BOE_NUMBER }{ LS_ALV-SRL_NO }|.
        PERFORM FRM_ENQUEUE_OBJECT USING LV_VARKEY.

        MODIFY GT_ALV FROM LS_ALV INDEX LS_ROW-INDEX TRANSPORTING BOX.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_AUTO_INDET
*&---------------------------------------------------------------------*
*& 自动辨识
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_AUTO_INDET .


  DATA:LV_TRUE  TYPE I,
       LV_FALSE TYPE I,
       LV_UUID  TYPE SYSUUID_X16,
       LS_LOG   TYPE ZTCM_004,
       LT_LOG   TYPE TABLE OF ZTCM_004,
       LV_TZ    TYPE TTZZ-TZONE VALUE 'UTC'.


  CLEAR:LV_TRUE    ,
        LV_FALSE   ,
        LV_UUID    ,
        LS_LOG     ,
        LT_LOG     .

  IF GT_MSG IS NOT INITIAL.
*---错误消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR: GT_MSG.
    RETURN.

  ELSE.


*-----取选中数据
    DATA(LT_ALV) = GT_ALV.
    DELETE LT_ALV WHERE BOX IS INITIAL.

    IF LT_ALV[] IS NOT INITIAL.

      "获取业务部门描述
      SELECT GSBER ,
             GTEXT ,
             VKORG ,
             VKBUR
        INTO TABLE @DATA(LT_ZTFI_011)
        FROM ZTFI_011.


    ENDIF.

    "取客户信息
    SORT LT_ALV BY BANKN NAME1.
    DELETE ADJACENT DUPLICATES FROM LT_ALV COMPARING BANKN NAME1.

    SELECT
           A~KUNNR,
           A~NAME1,
           A~BANKN,
           A~BUKRS,
           A~VKBUR
      FROM ZVFI_001_CDS AS A INNER JOIN @LT_ALV AS B
                       ON ( ( A~BANKN = B~BANKN )
                            OR ( A~NAME1 = B~NAME1 ) )
                      AND A~BUKRS = B~BUKRS
      INTO TABLE @DATA(LT_KUN).

    "去重
    DELETE ADJACENT DUPLICATES FROM LT_KUN COMPARING ALL FIELDS.

*----计算行数
    LT_ALV = GT_ALV.
    DELETE LT_ALV WHERE BOX NE GC_X.

    DATA(LV_LINE) = LINES( LT_ALV ).
    LV_FALSE      = LV_LINE.
    CLEAR LT_ALV.

*&----获取UUID
    TRY.
        CLEAR LV_UUID.
        CALL METHOD CL_SYSTEM_UUID=>IF_SYSTEM_UUID_STATIC~CREATE_UUID_X16
          RECEIVING
            UUID = LV_UUID.
        .
      CATCH CX_UUID_ERROR INTO DATA(CX_ERROR).
    ENDTRY.
*---获取时间戳
    "GET TIME STAMP FIELD DATA(LV_TIMESTAMP).
    CONVERT DATE SY-DATUM
          TIME SY-UZEIT
          INTO TIME STAMP DATA(LV_TIMESTAMP) TIME ZONE LV_TZ.


    LOOP AT GT_ALV  INTO DATA(LS_ALV) WHERE BOX = GC_X.

*----根据银行编码和公司代码辨识
      DATA(LT_TMP) = LT_KUN.

      "删除不符合的条件
      DELETE LT_TMP WHERE BANKN NE LS_ALV-BANKN OR BUKRS NE LS_ALV-BUKRS.


*&----如果能取到公司代码和银行编码
      IF LT_TMP IS NOT INITIAL AND LINES( LT_TMP ) = 1.
        DATA(LS_TMP) = LT_TMP[ 1 ].

        "从表ZTFI_011中取出业务范围GSBER和业务范围描述GTEXT
        READ TABLE LT_ZTFI_011 INTO DATA(LS_ZTFI_011) WITH KEY VKORG = LS_TMP-BUKRS VKBUR = LS_TMP-VKBUR.
        IF SY-SUBRC = 0.

          LS_ALV-KUNNR      = LS_TMP-KUNNR.      "客户
*          LS_ALV-NAME1      = LS_TMP-NAME1.      "客户名称
          LS_ALV-GSBER      = LS_ZTFI_011-GSBER. "业务范围
          LS_ALV-GTEXT      = LS_ZTFI_011-GTEXT. "业务范围描述
          LS_ALV-BOE_STATUS = '02'.              "已辨识
          LS_ALV-LTEXT      = TEXT-049.          "已辨识

          ADD 1 TO LV_TRUE.                         "成功行数 + 1

          SUBTRACT 1 FROM LV_FALSE.                 "失败行数 - 1

        ELSE.
          MESSAGE TEXT-133 TYPE 'S' DISPLAY LIKE 'E' .

          RETURN.
*           MESSAGE TEXT-133 TYPE 'E'.

        ENDIF.

      ELSE.
*----根据客户名称进行辨识
        CLEAR LT_TMP.
        LT_TMP = LT_KUN.
        DELETE LT_TMP WHERE NAME1 NE LS_ALV-NAME1.
        IF LT_TMP IS NOT INITIAL AND LINES( LT_TMP ) = 1.
          LS_TMP = LT_TMP[ 1 ].

          "从表ZTFI_011中取出业务范围GSBER和业务范围描述GTEXT
          READ TABLE LT_ZTFI_011 INTO LS_ZTFI_011 WITH KEY VKORG = LS_TMP-BUKRS VKBUR = LS_TMP-VKBUR.

          IF SY-SUBRC = 0.

            LS_ALV-KUNNR      = LS_TMP-KUNNR.     "客户
*            LS_ALV-NAME1      = LS_TMP-NAME1.     "客户名称
            LS_ALV-GSBER      = LS_ZTFI_011-GSBER."业务范围
            LS_ALV-BOE_STATUS = '02'.             "已辨识
            LS_ALV-LTEXT      = TEXT-049.         "已辨识

            ADD 1 TO LV_TRUE.                        "成功行数 + 1

            SUBTRACT 1 FROM LV_FALSE.                "失败行数 - 1

          ELSE.
            MESSAGE TEXT-133 TYPE 'S' DISPLAY LIKE 'E' .

*           MESSAGE TEXT-133 TYPE 'E'.

            RETURN.


          ENDIF.


        ENDIF.
      ENDIF.
      CLEAR LT_TMP.

*----更新表
      IF LS_ALV-BOE_STATUS = '02'.

        CLEAR LS_LOG.
        "更新数据
        UPDATE ZTFI_071
           SET BOE_STATUS = '02'
               KUNNR      = LS_ALV-KUNNR
*               NAME1      = LS_ALV-NAME1
               GSBER      = LS_ALV-GSBER
               UPNAM      = SY-UNAME
               UPDAT      = SY-DATUM
               UPTIM      = SY-UZEIT
         WHERE BOE_NUMBER = LS_ALV-BOE_NUMBER
           AND SRL_NO     = LS_ALV-SRL_NO
           AND BUKRS      = LS_ALV-BUKRS.

        IF SY-SUBRC EQ 0.

          COMMIT WORK AND WAIT .

          MODIFY GT_ALV FROM LS_ALV.

          LS_LOG-MTYPE   = 'S'.
          LS_LOG-MESSAGE = TEXT-049.

        ELSE.
          ROLLBACK WORK.

          LS_LOG-MTYPE   = 'E'.
          LS_LOG-MESSAGE = TEXT-065.

        ENDIF.

        LS_LOG-UUID       = LV_UUID.
        LS_LOG-TIMESTAMP  = LV_TIMESTAMP.
        LS_LOG-BUKRS      = LS_ALV-BUKRS.
        LS_LOG-BOE_NUMBER = LS_ALV-BOE_NUMBER.
        LS_LOG-BOE_STATUS = LS_ALV-BOE_STATUS.
        LS_LOG-BANKN      = LS_ALV-BANKN.
        LS_LOG-REPID      = SY-REPID.
        LS_LOG-CRNAM      = SY-UNAME.
        LS_LOG-RQTDD      = SY-DATUM.
        LS_LOG-RQTDT      = SY-UZEIT.

        APPEND LS_LOG TO LT_LOG.

        CLEAR: LS_LOG.

      ENDIF.

    ENDLOOP.


    IF LT_LOG IS NOT INITIAL.
      MODIFY ZTCM_004 FROM TABLE LT_LOG.
      IF SY-SUBRC EQ 0.
        COMMIT WORK AND WAIT .
      ELSE.
        ROLLBACK WORK.
      ENDIF.

    ENDIF.

    IF LV_TRUE > 0.

      MESSAGE S085(EPIC_EBR) WITH LV_TRUE  DISPLAY LIKE 'S'.

    ENDIF.

    IF LV_FALSE > 0 .
      MESSAGE S086(EPIC_EBR) WITH LV_FALSE DISPLAY LIKE 'E'.

    ENDIF.


*&---刷新页面
    IF GCL_GRID_00 IS NOT INITIAL.
      GCL_CLS_00->REFRESH_ALV(
      CHANGING
        IO_GRID = GCL_GRID_00
        ).

    ENDIF.

  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_MANUAL_INDET
*&---------------------------------------------------------------------*
*& 手动辨识
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_MANUAL_INDET .
  CLEAR GS_INDT.

  IF GT_MSG IS NOT INITIAL.
*---错误消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR: GT_MSG.
    RETURN.

  ELSE.

*--调用手动辨识窗口
    CALL SCREEN 9020 STARTING AT 60 3 .

  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CONFIRM_INDTFIY
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_CONFIRM_INDTFIY .
  DATA:LS_ALV  TYPE TY_ALV,
       LT_LOG  TYPE TABLE OF ZTCM_004,
       LS_LOG  TYPE          ZTCM_004,
       LV_UUID TYPE         SYSUUID_X16.

  DATA:LV_TRUE  TYPE I,
       LV_FALSE TYPE I.

  DATA:LT_KNVV TYPE TABLE OF KNVV,
       LV_TZ   TYPE TTZZ-TZONE VALUE 'UTC'.


  CLEAR:LS_ALV     ,
        LT_LOG     ,
        LS_LOG     ,
        LV_UUID    ,
        LT_KNVV    .

  IF GT_MSG IS NOT INITIAL.
*---错误消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR: GT_MSG.
    RETURN.

  ELSE.

*&--获取业务范围及描述信息
*-----取选中数据
    DATA(LT_ALV) = GT_ALV.
    DELETE LT_ALV WHERE BOX IS INITIAL.

    IF LT_ALV[] IS NOT INITIAL.

      "获取业务部门描述
      SELECT GSBER ,
             GTEXT,
             VKORG,
             VKBUR
        INTO TABLE @DATA(LT_ZTFI_011)
        FROM ZTFI_011.

    ENDIF.


    DATA(LV_LINE) = LINES( LT_ALV ).

*&----获取UUID
    TRY.
        CLEAR LV_UUID.
        CALL METHOD CL_SYSTEM_UUID=>IF_SYSTEM_UUID_STATIC~CREATE_UUID_X16
          RECEIVING
            UUID = LV_UUID.
        .
      CATCH CX_UUID_ERROR INTO DATA(CX_ERROR).
    ENDTRY.


*---获取时间戳
    "GET TIME STAMP FIELD DATA(LV_TIMESTAMP).
    CONVERT DATE SY-DATUM
          TIME SY-UZEIT
          INTO TIME STAMP DATA(LV_TIMESTAMP) TIME ZONE LV_TZ.


    SELECT *
       INTO CORRESPONDING FIELDS OF TABLE @LT_KNVV
       FROM KNVV
      WHERE KUNNR = @GS_INDT-KUNNR.

    IF LT_KNVV IS NOT INITIAL.

*&-----获取客户名称
      SELECT SINGLE
             KUNNR ,
             NAME1
        INTO @DATA(LS_KNA1)
        FROM KNA1
       WHERE KUNNR = @GS_INDT-KUNNR.


      CLEAR LS_ALV.
      LOOP AT GT_ALV INTO LS_ALV WHERE BOX = GC_X.

        CLEAR LS_LOG.

        "业务范围
        READ TABLE LT_KNVV INTO DATA(LS_KNVV) WITH KEY KUNNR = GS_INDT-KUNNR  VKORG = LS_ALV-BUKRS.
        IF SY-SUBRC = 0.

          "从表ZTFI_011中取出业务范围GSBER和业务范围描述GTEXT
          READ TABLE LT_ZTFI_011 INTO DATA(LS_ZTFI_011) WITH KEY VKORG = LS_ALV-BUKRS  VKBUR = LS_KNVV-VKBUR.
          IF SY-SUBRC = 0.
            SELECT SINGLE *
              INTO @DATA(LS_ZTFI_070)
              FROM ZTFI_070
             WHERE BUKRS = @LS_ALV-BUKRS
               AND HBKID = @LS_ALV-HBKID
               AND HKTID = @LS_ALV-HKTID.
            IF LS_ZTFI_070-RFCDEST = 'ZABC' AND ZCL_TR_DRAFT=>ZIF_NEW( I_DRAFT =  CONV #( LS_ALV-BOE_NUMBER )  ) = 'N' .
              CLEAR:LS_ZTFI_070.
*农行新票据更新客户名称信息
              "更新数据
              UPDATE ZTFI_071 SET BOE_STATUS = '02'
                                  KUNNR      = GS_INDT-KUNNR
                                  NAME1      = LS_KNA1-NAME1
                                  GSBER      = LS_ZTFI_011-GSBER
                                  UPNAM      = SY-UNAME
                                  UPDAT      = SY-DATUM
                                  UPTIM      = SY-UZEIT
                            WHERE BOE_NUMBER = LS_ALV-BOE_NUMBER
                              AND SRL_NO     = LS_ALV-SRL_NO
                              AND BUKRS      = LS_ALV-BUKRS.
             LS_ALV-NAME1      = LS_KNA1-NAME1.

            ELSE.
              CLEAR:LS_ZTFI_070.
              "更新数据
              UPDATE ZTFI_071 SET BOE_STATUS = '02'
                                  KUNNR      = GS_INDT-KUNNR
*                                NAME1      = LS_KNA1-NAME1
                                  GSBER      = LS_ZTFI_011-GSBER
                                  UPNAM      = SY-UNAME
                                  UPDAT      = SY-DATUM
                                  UPTIM      = SY-UZEIT
                            WHERE BOE_NUMBER = LS_ALV-BOE_NUMBER
                              AND SRL_NO     = LS_ALV-SRL_NO
                              AND BUKRS      = LS_ALV-BUKRS.

            ENDIF.
            IF SY-SUBRC EQ 0.

              COMMIT WORK AND WAIT .

              ADD 1 TO LV_TRUE.                         "成功行数 + 1

              LS_ALV-KUNNR      = GS_INDT-KUNNR.
*              LS_ALV-NAME1      = LS_KNA1-NAME1.
              LS_ALV-GSBER      = LS_ZTFI_011-GSBER.
              LS_ALV-GTEXT      = LS_ZTFI_011-GTEXT.
              LS_ALV-BOE_STATUS = '02'.
              LS_ALV-LTEXT      = TEXT-049.
              MODIFY GT_ALV  FROM LS_ALV TRANSPORTING KUNNR NAME1 GSBER BOE_STATUS LTEXT GTEXT.


              LS_LOG-MTYPE   = 'S'.
              LS_LOG-MESSAGE = TEXT-049.

            ELSE.
              ROLLBACK WORK.

              ADD 1 TO LV_FALSE.                         "失败行数 + 1.

              LS_LOG-MTYPE   = 'E'.
              LS_LOG-MESSAGE = TEXT-065.

            ENDIF.

            LS_LOG-UUID       = LV_UUID.
            LS_LOG-TIMESTAMP  = LV_TIMESTAMP.
            LS_LOG-BUKRS      = LS_ALV-BUKRS.
            LS_LOG-BOE_NUMBER = LS_ALV-BOE_NUMBER.
            LS_LOG-BOE_STATUS = LS_ALV-BOE_STATUS.
            LS_LOG-BANKN      = LS_ALV-BANKN.
            LS_LOG-REPID      = SY-REPID.
            LS_LOG-CRNAM      = SY-UNAME.
            LS_LOG-RQTDD      = SY-DATUM.
            LS_LOG-RQTDT      = SY-UZEIT.

            APPEND LS_LOG TO LT_LOG.

            CLEAR: LS_LOG,
            LS_ALV.
          ELSE.
            ADD 1 TO LV_FALSE.                         "失败行数 + 1.

          ENDIF.
        ELSE.
          ADD 1 TO LV_FALSE.                         "失败行数 + 1

        ENDIF.

      ENDLOOP.

      IF LT_LOG IS NOT INITIAL.
        MODIFY ZTCM_004 FROM TABLE LT_LOG.
        IF SY-SUBRC EQ 0.
          COMMIT WORK AND WAIT .
        ELSE.
          ROLLBACK WORK.
        ENDIF.

      ENDIF.

      "刷新界面
      IF GCL_GRID_00 IS  NOT INITIAL.

        GCL_CLS_00->REFRESH_ALV(
        CHANGING
          IO_GRID = GCL_GRID_00
          ).

      ENDIF.


      IF LV_TRUE > 0.
        "已手动辨识 &1 个银行回单
        MESSAGE S000(ZMFI01) WITH TEXT-066 LV_TRUE TEXT-067.

      ENDIF.

      IF LV_FALSE > 0 .
        "有 &1 个银行回单尚未手动辨识
        MESSAGE S000(ZMFI01) WITH TEXT-068 LV_FALSE TEXT-069 DISPLAY LIKE 'E'.
      ENDIF.

    ELSE.
      "未查询到该客户业务范围
      MESSAGE TEXT-074  TYPE 'S' DISPLAY LIKE 'E'.

    ENDIF.

  ENDIF.

  "关闭SCREEN
  LEAVE TO SCREEN 0.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SIGN_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_SIGN_DATA  USING LS_RSPFLAG .

  DATA:LV_SNUM TYPE I,
       LV_FNUM TYPE I.

  DATA:LV_SSING   TYPE I,
       LV_FSING   TYPE I,
       LV_SREFUSE TYPE I,
       LV_FREFUSE TYPE I.



  DATA LV_SUM TYPE I.

  DATA: LV_STRING  TYPE STRING,
        LV_STRING2 TYPE STRING.


  IF GT_MSG IS NOT INITIAL.
*---错误消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR: GT_MSG.
    RETURN.

  ELSE.

    CLEAR:LV_SNUM,
          LV_FNUM.

*---取签收/拒绝业务配置信息
    SELECT
           RFCDEST,
           FNAME
      INTO TABLE @DATA(LT_FNAME)
      FROM ZTFI_069_03
     WHERE BCTYP = '020'.

*&---对选中的数据循环取值
    LOOP AT GT_ALV INTO DATA(LS_ALV) WHERE BOX = GC_X.

      "查询客户配置表中的信息
      SELECT SINGLE *
        INTO @DATA(LS_ZTFI_070)
        FROM ZTFI_070
       WHERE BUKRS = @LS_ALV-BUKRS
         AND HBKID = @LS_ALV-HBKID
         AND HKTID = @LS_ALV-HKTID.

      "对比银行通信标识
      READ TABLE LT_FNAME INTO DATA(LS_FNAME) WITH KEY RFCDEST = LS_ZTFI_070-RFCDEST.

      IF SY-SUBRC EQ 0.

        DATA:LS_ZTFI_071 TYPE ZTFI_071.

        CLEAR:LS_ZTFI_071,
              LS_MES,
              LS_LOG,
              LS_RQT.

        "根据ALV赋值临时变量
        LS_ZTFI_071 = CORRESPONDING #( LS_ALV ).

        "调用配置函数
        TRY.
            CALL FUNCTION LS_FNAME-FNAME
              EXPORTING
                I_RQT_STU = LS_ZTFI_071
                I_RSPFLAG = LS_RSPFLAG
              IMPORTING
                E_MSG     = LS_MES
                E_LOG     = LS_LOG
                E_RQT     = LS_RQT.

          CATCH CX_ROOT INTO DATA(LC_ERROR).
*----函数调用失败异常消息
            GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                            MSGNO = '002'     MSGV1 = LC_ERROR->GET_TEXT( ) ) ).

        ENDTRY.

*&---工行 FSEQNO 更新 ADD_BY BAOHUI.ZHOU 20200721
        IF LS_RQT IS NOT INITIAL.
          "更新状态
          UPDATE ZTFI_071
             SET BOE_STATUS       = LS_RQT-BOE_STATUS
                 BOE_RECEIVE_DATE = LS_RQT-BOE_RECEIVE_DATE
                 FSEQNO           = LS_RQT-FSEQNO
                 UPNAM            = SY-UNAME
                 UPDAT            = SY-DATUM
                 UPTIM            = SY-UZEIT
           WHERE BOE_NUMBER       = LS_RQT-BOE_NUMBER
             AND SRL_NO           = LS_RQT-SRL_NO
             AND BUKRS            = LS_RQT-BUKRS.

          IF SY-SUBRC EQ 0.

            ADD 1 TO LV_SNUM.
            COMMIT WORK AND WAIT.
*----更新ALV
            LS_ALV-BOE_STATUS = LS_RQT-BOE_STATUS.
            LS_ALV-LTEXT      = COND #( WHEN LS_RQT-BOE_STATUS = '03' THEN TEXT-059
                                        WHEN LS_RQT-BOE_STATUS = '04' THEN TEXT-060 ).
            LS_ALV-FSEQNO           = LS_RQT-FSEQNO .
            LS_ALV-BOE_RECEIVE_DATE = LS_RQT-BOE_RECEIVE_DATE .

            MODIFY GT_ALV FROM LS_ALV.

            IF LS_RSPFLAG = 'X'.
              CLEAR:LV_STRING.
              ADD 1 TO LV_SSING.

              LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
              LV_STRING2 =  LS_RQT-BOE_NUMBER+30(25).

              "汇票XXX发送签收申请成功
              GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'S'
                                              MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 =  LV_STRING2
                                              MSGV3 =  TEXT-119
                                             )
                              ).

            ELSE.

              CLEAR:LV_STRING.

              ADD 1 TO LV_SREFUSE.

              LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
              LV_STRING2 =  LS_RQT-BOE_NUMBER+30(25).

              "汇票XXX发送驳回申请成功
              GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'S'
                                              MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 =  LV_STRING2
                                              MSGV3 =  TEXT-123
                                             )
                              ).

            ENDIF.

          ELSE.

            CLEAR:LV_STRING.

            ADD 1 TO LV_FNUM.

            LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
            LV_STRING2 =  LS_RQT-BOE_NUMBER+30(25).

            "汇票XXX更新汇票状态失败
            GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'S'
                                            MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 =  LV_STRING2
                                            MSGV3 =  TEXT-124
                                           )
                            ).


            ROLLBACK WORK.


          ENDIF.
        ELSE.

          IF LS_RSPFLAG = 'X'.

            ADD 1 TO LV_FSING.

          ELSE.

            ADD 1 TO LV_FREFUSE.

          ENDIF.

          "如果返回错误消息
          IF LS_MES IS NOT INITIAL.
            "赋值消息内容
            APPEND LS_MES TO GT_MSG.
          ENDIF.

        ENDIF.

        IF LS_LOG IS NOT INITIAL.
          LS_LOG-BOE_STATUS = LS_ALV-BOE_STATUS.
          MODIFY ZTCM_004 FROM LS_LOG.

          IF SY-SUBRC EQ 0.
            COMMIT WORK AND WAIT.

          ELSE.
            ROLLBACK WORK.

          ENDIF.

        ENDIF.



      ELSE.
        GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                        MSGNO = '000'     MSGV1 = TEXT-103 ) ).


      ENDIF.
*----更改ALV 状态

      ADD 1 TO LV_SUM.

    ENDLOOP.

    IF LV_SSING > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_SSING }{ TEXT-106 }|.

      "XX张汇票发送签收申请成功
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'S'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.

    IF LV_FSING > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_FSING }{ TEXT-107 }|.

      "XX张汇票发送签收申请失败
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'E'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.

    IF LV_SREFUSE > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_SREFUSE }{ TEXT-125 }|.

      "XX张汇票发送驳回申请成功
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'S'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.


    IF LV_FREFUSE > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_FREFUSE }{ TEXT-126 }|.

      "XX张汇票发送驳回申请失败
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'E'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.


    IF LV_FNUM > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_FNUM }{ TEXT-122 }|.

      "XX张汇票更新状态失败
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'E'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.


    IF GT_MSG IS NOT INITIAL.
*---消息内容输出
      CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
        TABLES
          I_MESSAGE_TAB = GT_MSG.
      RETURN.

    ENDIF.


  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_LINE
*&---------------------------------------------------------------------*
*& 检查行状态
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_CHECK_LINE USING E_UCOMM .

  DATA:LV_STR1     TYPE STRING,
       LV_STR2     TYPE STRING,
       LV_ZBOE_SUB TYPE STRING.


  CHECK GT_MSG IS INITIAL.

  DATA(LT_ALV) = GT_ALV.
  DELETE LT_ALV WHERE BOX IS INITIAL.

*&---检查汇票状态
  "从数据库中获取选中的数据
  SELECT A~BUKRS,
         A~BOE_NUMBER,
         A~SRL_NO,
         A~BOE_STATUS,"汇票状态
         A~ZSFYDJ,    "汇票已登记
         A~LOEKZ,     "删除标识
         A~UPNAM      "更新人信息
    FROM ZTFI_071 AS A INNER JOIN @LT_ALV AS B
                               ON A~BUKRS            = B~BUKRS
                              AND A~BOE_NUMBER       = B~BOE_NUMBER
                              AND A~SRL_NO           = B~SRL_NO
    INTO TABLE @DATA(LT_SELECT).

  DATA(LT_TAB) = LT_SELECT.

  CASE E_UCOMM.
    WHEN 'SIGN'.
      "允许已辨识和银行处理失败的操作 02 已辨识   20签收失败  21驳回失败
      DELETE LT_TAB WHERE BOE_STATUS = '02' OR BOE_STATUS = '20' OR  BOE_STATUS = '21'.
      LV_STR2 = TEXT-048.

    WHEN 'REJECT'.
      "允许已辨识和银行处理失败的操作 02 已辨识   20签收失败  21驳回失败
      DELETE LT_TAB WHERE BOE_STATUS = '02' OR BOE_STATUS = '20' OR  BOE_STATUS = '21'.
      LV_STR2 = TEXT-101.

    WHEN 'QUERY'.
      "允许签收中和驳回中的操作 03签收中 04 驳回中
      DELETE LT_TAB WHERE BOE_STATUS = '03' OR  BOE_STATUS =  '04' .
      LV_STR2 = TEXT-095.

    WHEN 'AUTO'.
      "汇票状态需为“回单已创建”
      DELETE LT_TAB WHERE BOE_STATUS = '01' .
      LV_STR2 = TEXT-102.

    WHEN 'MANUAL'.
      "汇票状态需为“回单已创建”
      DELETE LT_TAB WHERE BOE_STATUS = '01'  OR BOE_STATUS = '02'.
      LV_STR2 = TEXT-102.

    WHEN OTHERS.
  ENDCASE.

  IF LT_TAB IS NOT  INITIAL.
    READ TABLE LT_TAB INTO DATA(LS_TAB) INDEX 1.

    "汇票XXX
    LV_STR1 = |{ TEXT-097 }{ LS_TAB-BOE_NUMBER(30) }|.
    LV_ZBOE_SUB =  LS_TAB-BOE_NUMBER+30(25).

    GT_MSG = VALUE #( BASE GT_MSG
                       (  MSGID = 'ZMFI01' MSGTY = 'E'
                          MSGNO = '000'    MSGV1 = LV_STR1 MSGV2 = LV_ZBOE_SUB
                          MSGV3 = LV_STR2
                       )
                   ).
    RETURN.
  ENDIF.

  "检查是否已登记
  DATA(LT_CHECK) = LT_SELECT.
  DELETE LT_CHECK WHERE ZSFYDJ IS INITIAL.

  IF LT_CHECK IS NOT INITIAL.

    READ TABLE LT_CHECK INTO DATA(LS_STAT) INDEX 1.
    "汇票XXX
    LV_STR1 = |{ TEXT-097 }{ LS_STAT-BOE_NUMBER(30) }|.
    LV_ZBOE_SUB = LS_STAT-BOE_NUMBER+30(25).
    "已被XXXX进行登记
    LV_STR2 = |{ TEXT-098 }{ LS_STAT-UPNAM }{ TEXT-099 }|.

    GT_MSG = VALUE #( BASE GT_MSG
                     (  MSGID = 'ZMFI01' MSGTY = 'E'
                        MSGNO = '000'    MSGV1 = LV_STR1 MSGV2 = LV_ZBOE_SUB
                        MSGV3 = LV_STR2
                     )
                 ).



  ENDIF.

  CLEAR: LT_CHECK.

  "检查是否已删除
  LT_CHECK = LT_SELECT.
  DELETE LT_CHECK WHERE LOEKZ IS INITIAL.

  IF LT_CHECK IS NOT INITIAL.
    READ TABLE LT_CHECK INTO LS_STAT INDEX 1.
    "汇票XXX
    LV_STR1 = |{ TEXT-097 }{ LS_STAT-BOE_NUMBER(30) }|.
    LV_ZBOE_SUB =  LS_TAB-BOE_NUMBER+30(25).

    "已被XXXX删除
    LV_STR2 = |{ TEXT-098 }{ LS_STAT-UPNAM }{ TEXT-100 }|.

    GT_MSG = VALUE #( BASE GT_MSG
                     (  MSGID = 'ZMFI01' MSGTY = 'E'
                        MSGNO = '000'    MSGV1 = LV_STR1  MSGV2 = LV_ZBOE_SUB
                        MSGV3 = LV_STR2
                     )
                 ).


  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_REJECT_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_REJECT_DATA .

  CHECK GT_MSG IS INITIAL.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_QUERY_DATA
*&---------------------------------------------------------------------*
*& 签收/驳回结果查询
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_QUERY_DATA .

  DATA:LV_SSIGN   TYPE I,
       LV_FSIGN   TYPE I,
       LV_SREFUSE TYPE I,
       LV_FREFUSE TYPE I,
       LV_FNUM    TYPE I,
       LV_NUM     TYPE I,
       LV_EXCE    TYPE I.

  DATA:LV_YYCLZ    TYPE I.

  DATA: LV_STRING  TYPE STRING,
        LV_STRING2 TYPE STRING.


  DATA:LV_FLAG TYPE C.

  IF GT_MSG IS NOT INITIAL.
*---错误消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.
    CLEAR:GT_MSG.
    RETURN.

  ELSE.

*---取签收/驳回业务结果查询
    SELECT
           RFCDEST,
           FNAME
      INTO TABLE @DATA(LT_FNAME)
      FROM ZTFI_069_03
     WHERE BCTYP = '030'.

*&---对选中的数据循环取值
    LOOP AT GT_ALV INTO DATA(LS_ALV) WHERE BOX = GC_X.

      "查询客户配置表中的信息
      SELECT SINGLE *
        INTO @DATA(LS_ZTFI_070)
        FROM ZTFI_070
       WHERE BUKRS = @LS_ALV-BUKRS
         AND HBKID = @LS_ALV-HBKID
         AND HKTID = @LS_ALV-HKTID.

      "对比银行通信标识
      READ TABLE LT_FNAME INTO DATA(LS_FNAME) WITH KEY RFCDEST = LS_ZTFI_070-RFCDEST.

      IF SY-SUBRC EQ 0.

        DATA:LS_ZTFI_071 TYPE ZTFI_071.

        CLEAR:LS_ZTFI_071,
              LS_MES,
              LS_LOG,
              LS_RQT.

        "根据ALV赋值临时变量
        LS_ZTFI_071 = CORRESPONDING #( LS_ALV ).

        "调用配置函数
        TRY.
            CALL FUNCTION LS_FNAME-FNAME
              EXPORTING
                I_RQT_STU = LS_ZTFI_071
              IMPORTING
                E_MSG     = LS_MES
                E_LOG     = LS_LOG
                E_RQT     = LS_RQT.


          CATCH CX_ROOT INTO DATA(LC_ERROR).
*----函数调用失败异常消息
            GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                            MSGNO = '002'     MSGV1 = LC_ERROR->GET_TEXT( ) ) ).

        ENDTRY.

        IF  LS_RQT IS NOT INITIAL.

          CLEAR:LV_FLAG.

          "更新数据
          UPDATE ZTFI_071
             SET BOE_STATUS = LS_RQT-BOE_STATUS
                 UPNAM      = SY-UNAME
                 UPDAT      = SY-DATUM
                 UPTIM      = SY-UZEIT
           WHERE BOE_NUMBER = LS_RQT-BOE_NUMBER
             AND SRL_NO     = LS_RQT-SRL_NO
             AND BUKRS      = LS_RQT-BUKRS.

          IF SY-SUBRC EQ 0.
            COMMIT WORK AND WAIT.

            IF LS_RQT-BOE_STATUS = '05'.
              ADD 1 TO LV_SSIGN.
              "汇票XXX签收成功

              CLEAR:LV_STRING.

              LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
              LV_STRING2 = LS_RQT-BOE_NUMBER+30(25).
              "汇票XXX签收成功
              GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'S'
                                              MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 = LV_STRING2
                                              MSGV3 =  TEXT-127
                                             )
                              ).




            ELSEIF LS_RQT-BOE_STATUS = '20'.
              "汇票XXX签收失败
              ADD 1 TO LV_FSIGN.

              CLEAR:LV_STRING.

              LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
              LV_STRING2 = LS_RQT-BOE_NUMBER+30(25).
              "汇票XXX签收失败
              GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                              MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 = LV_STRING2
                                              MSGV3 =  TEXT-128
                                             )
                              ).




            ELSEIF LS_RQT-BOE_STATUS = '06'.
              "汇票XXX驳回成功
              ADD 1 TO LV_SREFUSE.

              CLEAR:LV_STRING.

              LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
              LV_STRING2 = LS_RQT-BOE_NUMBER+30(25).
              "汇票XXX驳回成功
              GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'S'
                                              MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 = LV_STRING2
                                              MSGV3 =  TEXT-129
                                             )
                              ).



            ELSEIF LS_RQT-BOE_STATUS = '21'.
              "汇票XXX驳回失败
              ADD 1 TO LV_FREFUSE.

              CLEAR:LV_STRING.

              LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
              LV_STRING2 = LS_RQT-BOE_NUMBER+30(25).

              "汇票XXX驳回失败
              GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                              MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 = LV_STRING2
                                              MSGV3 =  TEXT-130
                                             )
                              ).


            ENDIF.

          ELSE.
            ADD 1 TO LV_FNUM.
            "汇票XXX更新状态失败
            CLEAR:LV_STRING.

            LV_FLAG = 'X'.

            LV_STRING = |{ TEXT-118 }{ LS_RQT-BOE_NUMBER(30) }|.
            LV_STRING2 = LS_RQT-BOE_NUMBER+30(25).


            "汇票XXX更新汇票状态失败
            GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                            MSGNO = '000'     MSGV1 =  LV_STRING MSGV2 = LV_STRING2
                                            MSGV3 =  TEXT-124
                                           )
                            ).



            ROLLBACK WORK.
          ENDIF.
*----更新ALV
          LS_ALV-BOE_STATUS = LS_RQT-BOE_STATUS.
          LS_ALV-LTEXT      = COND #( WHEN LS_RQT-BOE_STATUS = '03' THEN TEXT-059
                                      WHEN LS_RQT-BOE_STATUS = '04' THEN TEXT-060
                                      WHEN LS_RQT-BOE_STATUS = '05' THEN TEXT-061
                                      WHEN LS_RQT-BOE_STATUS = '06' THEN TEXT-062
                                      WHEN LS_RQT-BOE_STATUS = '20' THEN TEXT-063
                                      WHEN LS_RQT-BOE_STATUS = '21' THEN TEXT-064 ).

          "如果汇票的状态为06已驳回
          IF LS_RQT-BOE_STATUS = '06'.
            DELETE GT_ALV WHERE BUKRS       = LS_ALV-BUKRS
                            AND SRL_NO      = LS_ALV-SRL_NO
                            AND BOE_NUMBER  = LS_ALV-BOE_NUMBER .

          ELSE.
            IF LV_FLAG <> 'X'.

              MODIFY GT_ALV FROM LS_ALV.

            ENDIF.

          ENDIF.

        ELSE.
          "如果返回错误消息
          IF LS_MES IS NOT INITIAL.

            IF LS_MES-MSGTY = 'W' .

              ADD 1 TO LV_YYCLZ.

            ELSE.

              ADD 1 TO LV_EXCE.

            ENDIF.

            "赋值消息内容
            APPEND LS_MES TO GT_MSG.

          ENDIF.
        ENDIF.

        IF LS_LOG IS NOT INITIAL.
          LS_LOG-BOE_STATUS = LS_ALV-BOE_STATUS.
          MODIFY ZTCM_004 FROM LS_LOG.

          IF SY-SUBRC EQ 0.
            COMMIT WORK AND WAIT.
          ELSE.
            ROLLBACK WORK.

          ENDIF.

        ENDIF.
      ELSE.
        GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                        MSGNO = '000'     MSGV1 = TEXT-103 ) ).


      ENDIF.

      ADD 1 TO LV_NUM.
    ENDLOOP.


    IF LV_SSIGN > 0.
      CLEAR:LV_STRING.
      LV_STRING = |{ LV_SSIGN }{ TEXT-108 }|.


      "XX张汇票已成功签收
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'S'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.

    IF LV_FSIGN > 0.
      CLEAR:LV_STRING.
      LV_STRING = |{ LV_FSIGN }{ TEXT-120 }|.

      "XX张汇票签收失败
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'E'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.




    IF LV_SREFUSE > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_SREFUSE }{ TEXT-109 }|.

      "XX张汇票已成功驳回
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'S'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.


    IF LV_FREFUSE > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_FREFUSE }{ TEXT-121 }|.

      "XX张汇票驳回失败
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'E'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.


    IF LV_FNUM > 0.

      CLEAR:LV_STRING.
      LV_STRING = |{ LV_FNUM }{ TEXT-122 }|.

      "XX张汇票更新状态失败
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'E'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).

    ENDIF.

    IF  LV_EXCE > 0.
      CLEAR:LV_STRING.
      LV_STRING = |{ LV_EXCE }{ TEXT-131 }|.

      "XX张汇票交易异常,请稍后再查询结果或联系银行处理
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'E'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).
    ENDIF.



    IF  LV_YYCLZ > 0.
      CLEAR:LV_STRING.
      LV_STRING = |{ LV_YYCLZ }{ TEXT-134 }|.

      "XX张汇票银行处理中
      GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = 'ZMFI01'  MSGTY = 'W'
                              MSGNO = '000'     MSGV1 = LV_STRING
                              )
                       ).
    ENDIF.




*---消息内容输出
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.
    RETURN.

  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_ENQUEUE_OBJECT
*&---------------------------------------------------------------------*
*& 条目锁
*&---------------------------------------------------------------------*
*&      --> LV_VARKEY
*&---------------------------------------------------------------------*
FORM FRM_ENQUEUE_OBJECT  USING  PV_VARKEY TYPE RSTABLE-VARKEY.

  DATA:LV_TABLE TYPE TABNAME.
  LV_TABLE = 'ZFID001'.
  CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
      MODE_RSTABLE   = 'E'
      TABNAME        = LV_TABLE
      VARKEY         = PV_VARKEY
*     X_TABNAME      = ' '
*     x_varkey       = '#'
      _SCOPE         = '3'
*     _WAIT          = ' '
*     _COLLECT       = ' '
    EXCEPTIONS
      FOREIGN_LOCK   = 1
      SYSTEM_FAILURE = 2
      OTHERS         = 3.
  IF SY-SUBRC <> 0.

    GT_MSG = VALUE #( BASE GT_MSG
                            ( MSGID = SY-MSGID      MSGTY = SY-MSGTY
                              MSGNO = SY-MSGNO      MSGV1 = SY-MSGV1
                              MSGV2 = SY-MSGV2      MSGV3 = SY-MSGV3 ) ).

  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DEQUEUE_OBJECT
*&---------------------------------------------------------------------*
*& 解锁
*&---------------------------------------------------------------------*
*&      --> LV_VARKEY
*&---------------------------------------------------------------------*
FORM FRM_DEQUEUE_OBJECT  USING    PV_VARKEY TYPE RSTABLE-VARKEY .
  DATA:LV_TABLE TYPE TABNAME.
  LV_TABLE = 'ZFID001'.
  CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
      MODE_RSTABLE = 'E'
      TABNAME      = LV_TABLE
      VARKEY       = PV_VARKEY
      _SCOPE       = '3'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_ALV_DEQUEUE
*&---------------------------------------------------------------------*
*& alv 选择解锁
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_ALV_DEQUEUE .

  DATA:LV_VARKEY TYPE RSTABLE-VARKEY.

  LOOP AT GT_ALV INTO DATA(LS_ALV) WHERE BOX = GC_X.
*---解锁
    CLEAR LV_VARKEY.

    LV_VARKEY = |{ LS_ALV-BUKRS }{ LS_ALV-BOE_NUMBER }{ LS_ALV-SRL_NO }|.

    PERFORM FRM_DEQUEUE_OBJECT USING LV_VARKEY.
  ENDLOOP.



ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_AUTHORIZATION_CHECK
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_AUTHORIZATION_CHECK .


  IF SY-UCOMM = 'ONLI'.

    SELECT BUKRS
    INTO TABLE @DATA(LT_BUK)
          FROM T001
          WHERE BUKRS IN @S_BUKRS.

    IF LT_BUK IS NOT INITIAL.

      LOOP AT LT_BUK INTO DATA(LS_BUK).
        AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
        ID 'ACTVT' FIELD '01'
        ID 'BUKRS' FIELD LS_BUK.
        IF SY-SUBRC NE 0.
          MESSAGE E004(ZMFIF01) WITH LS_BUK.
        ENDIF.
      ENDLOOP.

    ELSE.

      MESSAGE TEXT-070 TYPE 'E'.

    ENDIF.

  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DATA_CIRCULATION
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_DATA_CIRCULATION USING E_UCOMM.

  "判断检验是否通过
  IF  GT_MSG IS NOT INITIAL.
    "检验不通过输出消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR:GT_MSG.
    RETURN.
  ELSE.

    "获取流转信息
    PERFORM FRM_GET_CIRCULATION_DATA USING E_UCOMM.

    IF GT_MSG IS NOT INITIAL.
      "检验不通过输出消息
      CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
        TABLES
          I_MESSAGE_TAB = GT_MSG.

      CLEAR:GT_MSG.
      RETURN.
*    ELSE.
*
*      IF GT_CIRCULATION IS NOT INITIAL.
*
*        CALL SCREEN 9030.
*      ELSE.
*
*        MESSAGE TEXT-093 TYPE 'S' DISPLAY LIKE 'E'.
*      ENDIF.

    ENDIF.
  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_GET_CIRCULATION_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_GET_CIRCULATION_DATA USING E_UCOMM .
  "获取流转信息赋值到GT_CIRCULATION
  CLEAR:GT_CIRCULATION.

  DATA:LS_E_MSG TYPE ESP1_MESSAGE_WA_TYPE,
       LS_E_LOG TYPE ZTCM_004.

  DATA:LT_LOG TYPE TABLE OF ZTCM_004.

  DATA: LS_ZTFI_071 TYPE ZTFI_071,
        LT_ZTFI_071 TYPE TABLE OF ZTFI_071.

  DATA:LT_RECIPET     TYPE TABLE OF ZZS_FIIF_091,
       LT_CIRCULATION TYPE TABLE OF TY_CIRCULATION.

  DATA: LS_FI_006 TYPE ZZS_FI_006,
        LT_FI_007 TYPE ZZT_FI_007,
        LS_FI_007 TYPE ZZS_FI_007.


*---取票据流转信息配置信息
  SELECT
         RFCDEST,
         FNAME
    INTO TABLE @DATA(LT_FNAME)
    FROM ZTFI_069_03
   WHERE BCTYP = '210'.

  LOOP AT GT_ALV INTO DATA(LT_ALV) WHERE BOX = 'X' .

    "取银企直连配置,走银企直连接口
    READ TABLE GT_070 INTO DATA(LS_070) WITH KEY BUKRS = LT_ALV-BUKRS
                                                 HBKID = LT_ALV-HBKID
                                                 HKTID = LT_ALV-HKTID.
    IF SY-SUBRC EQ 0.

      READ TABLE LT_FNAME INTO DATA(LS_FNAME) WITH KEY RFCDEST = LS_070-RFCDEST.
      IF SY-SUBRC EQ 0.
        CLEAR:LS_E_MSG ,
              LS_E_LOG .

        LS_ZTFI_071 = CORRESPONDING #( LT_ALV ).

        TRY.

            CALL FUNCTION LS_FNAME-FNAME
              EXPORTING
                I_RQT_STU = LS_ZTFI_071
              IMPORTING
                E_MSG     = LS_E_MSG
                E_LOG     = LS_E_LOG
                E_FI_006  = LS_FI_006
              TABLES
                T_FI_007  = LT_FI_007.
          CATCH CX_ROOT INTO DATA(LC_ERROR).
*----函数调用失败异常消息
            GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                            MSGNO = '002'     MSGV1 = LC_ERROR->GET_TEXT( ) ) ).

        ENDTRY.
*STR BY HAND-ZRR 20230920*
        IF LS_FI_006 IS NOT INITIAL.

          LT_ALV-WBZOG = LS_FI_006-WBZOG.
          LT_ALV-BOE_DRAWEE_ACCOUNT = LS_FI_006-BOE_DRAWEE_ACCOUNT.
          LT_ALV-BOE_DRAWEE_BANK_NUMBER = LS_FI_006-BOE_DRAWEE_BANK_NUMBER.
          LT_ALV-BOE_DRAWEE_BANK = LS_FI_006-BOE_DRAWEE_BANK.
          MODIFY GT_ALV FROM LT_ALV.
        ENDIF.
*END BY HAND-ZRR 20230920*
        APPEND LS_E_LOG TO LT_LOG.

        IF LS_E_MSG IS NOT INITIAL.

          APPEND LS_E_MSG TO GT_MSG.

        ELSE.


*&---打印机参数设置
          DATA:L_CONTROL    TYPE SSFCTRLOP,
               LW_SSFCRESCL TYPE SSFCRESCL,
               LW_OUTPUT    TYPE SSFCOMPOP.

          DATA:LV_FLAG TYPE C .
          IF LT_FI_007[] IS INITIAL.

            LV_FLAG = 'X'.

          ELSE.

*            IF E_UCOMM = 'PRINT'.
            "重新赋值内表,只剩后两条数据
            DATA(LV_LINE) = LINES( LT_FI_007 ).

            "如果大于两行
            IF LV_LINE > 2.
              "计算需要删除的行数
              DATA(LV_END) = LV_LINE - 2 .
              "删除内表中其余数据
              DELETE LT_FI_007 FROM 1 TO LV_END .


            ENDIF.

*            ENDIF.

          ENDIF.



*&--开启批量打印
          L_CONTROL-NO_OPEN = 'X'.
          L_CONTROL-NO_CLOSE = 'X'.
          L_CONTROL-NO_DIALOG = ''.

          LW_OUTPUT-RQPOSNAME = ''.
          LW_OUTPUT-TDDATASET = ''.
          LW_OUTPUT-TDSUFFIX1 = ''.
          LW_OUTPUT-TDSUFFIX2 = ''.
          LW_OUTPUT-TDIMMED = 'X'.      "立即假脱机打印
          LW_OUTPUT-TDDELETE = 'X'.     "立即假脱机删除



*&---打开打印
          CALL FUNCTION 'SSF_OPEN'
            EXPORTING
              CONTROL_PARAMETERS = L_CONTROL
              OUTPUT_OPTIONS     = LW_OUTPUT
            EXCEPTIONS
              FORMATTING_ERROR   = 1
              INTERNAL_ERROR     = 2
              SEND_ERROR         = 3
              USER_CANCELED      = 4
              ERROR_MESSAGE      = 5
              OTHERS             = 6.

*&---检测打印是否打开
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.


*&--打印参数定义
          DATA:FM_NAME   TYPE RS38L_FNAM.
          CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
            EXPORTING
              FORMNAME = 'ZFI_001_SF'
            IMPORTING
              FM_NAME  = FM_NAME.


          CALL FUNCTION FM_NAME
            EXPORTING
              CONTROL_PARAMETERS = L_CONTROL
              GS_FI_006          = LS_FI_006
              GV_FLAG            = LV_FLAG
            TABLES
              GT_FI_007          = LT_FI_007
            EXCEPTIONS
              FORMATTING_ERROR   = 1
              INTERNAL_ERROR     = 2
              SEND_ERROR         = 3
              USER_CANCELED      = 4
              OTHERS             = 5.
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.

*&---关闭打印
          CALL FUNCTION 'SSF_CLOSE'
            IMPORTING
              JOB_OUTPUT_INFO  = LW_SSFCRESCL
            EXCEPTIONS
              FORMATTING_ERROR = 1
              INTERNAL_ERROR   = 2
              SEND_ERROR       = 3
              ERROR_MESSAGE    = 4
              OTHERS           = 5.
          IF SY-SUBRC <> 0.
            "弹出消息内容
            MESSAGE  TEXT-132 TYPE 'S' DISPLAY LIKE 'E'.

          ENDIF.

        ENDIF.

      ENDIF.

    ELSE.
      GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                      MSGNO = '000'     MSGV1 = TEXT-103 ) ).

    ENDIF.

  ENDLOOP.

  "先判断日志是否为空
  IF LT_LOG IS NOT INITIAL.
    "更新日志表
    MODIFY ZTCM_004 FROM TABLE LT_LOG.
    IF SY-SUBRC EQ 0.
      COMMIT WORK AND WAIT.
    ELSE.

      ROLLBACK WORK.
    ENDIF.
  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SET_FACT_30
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_SET_FACT_30 .

  CLEAR:GT_FCAT_30.

  GT_FCAT_30 = VALUE #( ( FIELDNAME = 'BOE_NUMBER  ' COLTEXT = TEXT-080  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'BOE_NUMBER  ' )"汇票编号
                        ( FIELDNAME = 'TRANSTYP    ' COLTEXT = TEXT-081  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'TRANSTYP    ' )"业务种类
                        ( FIELDNAME = 'TRANSTYPNAM ' COLTEXT = TEXT-082  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'TRANSTYPNAM ' )"业务种类名称
                        ( FIELDNAME = 'SIGNDATE    ' COLTEXT = TEXT-083  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNDATE    ' )"签收日期
                        ( FIELDNAME = 'SIGNTYP     ' COLTEXT = TEXT-084  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNTYP     ' )"签收人类别
                        ( FIELDNAME = 'SIGNTYPNAM  ' COLTEXT = TEXT-085  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNTYPNAM  ' )"签收人类别名称
                        ( FIELDNAME = 'SIGNNAM     ' COLTEXT = TEXT-086  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNNAM     ' )"签收人名称
                        ( FIELDNAME = 'SIGNORGCODE ' COLTEXT = TEXT-087  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNORGCODE ' )"签收人组织机构代码
                        ( FIELDNAME = 'SIGNOPBNK   ' COLTEXT = TEXT-088  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNOPBNK   ' )"签收人开户行号
                        ( FIELDNAME = 'SIGNOPBNKNAM' COLTEXT = TEXT-089  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNOPBNKNAM' )"签收人承接行行名
                        ( FIELDNAME = 'SIGNACCNO   ' COLTEXT = TEXT-090  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'SIGNACCNO   ' )"签收人账号
                        ( FIELDNAME = 'RATE        ' COLTEXT = TEXT-091  REF_TABLE = 'ZZS_FIIF_091'  REF_FIELD =  'RATE        ' )"利率
*                          ( FIELDNAME = 'NOTE        ' COLTEXT = TEXT-092 )"备注
                      ).
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CALL_CIRCULATION_ALV
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_CALL_CIRCULATION_ALV .

  IF GCL_GRID_30 IS INITIAL.
*----创建容器
    TRY.
        GCL_CLS_30->CREATE_DOCKING_CONTAINER(
        CHANGING
          IO_GRID  = GCL_GRID_30
          IT_FCAT  = GT_FCAT_30
          IS_LAYO  = GS_LAYOUT
          IT_TABL  = GT_CIRCULATION
          IS_VARIANT = GS_VARIANT
          ).

      CATCH CX_SY_REF_IS_INITIAL INTO DATA(LC_ERROR).

        DATA(LV_ERROR) = LC_ERROR->IF_MESSAGE~GET_TEXT( ).

    ENDTRY.

*---类属性赋值
    GCL_CLS_30->REPID         = SY-REPID.
    GCL_CLS_30->DYNNR         = GC_DYNNR_30.
    GCL_CLS_30->TOOLBAR       = 'FRM_HANDLE_TOOLBAR'.
    GCL_CLS_30->USER_COMMAND  = 'FRM_HANDLE_USER_COMMAND'.

    SET HANDLER GCL_CLS_30->HANDLE_TOOLBAR       FOR GCL_GRID_30.
    SET HANDLER GCL_CLS_30->HANDLE_USER_COMMAND  FOR GCL_GRID_30.


    CALL METHOD GCL_GRID_30->SET_TOOLBAR_INTERACTIVE.


  ELSE.
    GCL_CLS_30->REFRESH_ALV(
    CHANGING
      IO_GRID = GCL_GRID_30
      ).

  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_RECIPT_DEQUEUE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_RECIPT_DEQUEUE .


  DATA:LV_VARKEY TYPE RSTABLE-VARKEY.

  LOOP AT GT_RECEIPT_ALV INTO DATA(LS_ALV) WHERE BOX = GC_X.
*---解锁
    CLEAR LV_VARKEY.

    LV_VARKEY = |{ LS_ALV-BUKRS }{ LS_ALV-HBKID }{ LS_ALV-HKTID }|.

    PERFORM FRM_DEQUEUE_OBJECT USING LV_VARKEY.
  ENDLOOP.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_REFRESH_RECIPT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_REFRESH_RECIPT .

  "清空消息框
  CLEAR:GT_MSG.

  "删除选中记录
  DATA:LS_RECIPT TYPE TY_RECEIPT.

  LS_RECIPT-BOX        = ''.

  "更新选中信息
  MODIFY GT_RECEIPT_ALV FROM LS_RECIPT TRANSPORTING BOX WHERE BOX = 'X'.

*&---刷新屏幕
  IF GCL_GRID_10 IS NOT  INITIAL.
    GCL_CLS_10->REFRESH_ALV(
    CHANGING
      IO_GRID = GCL_GRID_10
      ).
  ENDIF.



ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_ALV_CHECK_MANUAL
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_ALV_CHECK_MANUAL .


  DATA:LV_STR1     TYPE STRING,
       LV_STR2     TYPE STRING,
       LV_ZBOE_SUB TYPE STRING.

  CHECK GT_MSG IS INITIAL.

  DATA(LT_ALV) = GT_ALV.
  DELETE LT_ALV WHERE BOX IS INITIAL.

  "汇票状态需为“回单已创建”或”已辨识“
  DELETE LT_ALV WHERE BOE_STATUS = '01'  OR BOE_STATUS = '02' .
  LV_STR2 = TEXT-102.


  IF LT_ALV IS NOT  INITIAL.
    READ TABLE LT_ALV INTO DATA(LS_TAB) INDEX 1.

    "汇票XXX
    LV_STR1 = |{ TEXT-097 }{ LS_TAB-BOE_NUMBER(30) }|.
    LV_ZBOE_SUB = LS_TAB-BOE_NUMBER+30(25).

    GT_MSG = VALUE #( BASE GT_MSG
                       (  MSGID = 'ZMFI01' MSGTY = 'E'
                          MSGNO = '000'    MSGV1 = LV_STR1 MSGV2 = LV_ZBOE_SUB
                          MSGV3 = LV_STR2
                       )
                   ).
    RETURN.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_BNT_AUTH_CHECK
*&---------------------------------------------------------------------*
*& 检查用户是否有维护票据得权限   ADD 20200610 BY HANDRRF
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_BNT_AUTH_CHECK USING PV_ACTVT TYPE ACTIV_AUTH.

  CLEAR:GT_MSG.

  AUTHORITY-CHECK OBJECT 'ZBOE01'
        ID 'ACTVT' FIELD PV_ACTVT.

  IF SY-SUBRC NE 0.

    GT_MSG = VALUE #( BASE GT_MSG
                         ( MSGID = 'ZMFIF01' MSGTY = 'E'
                           MSGNO = '076'
                             ) ).

  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DELETE_STATUS
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_DELETE_STATUS .

  DATA:LV_STR1     TYPE STRING,
       LV_STR2     TYPE STRING,
       LV_ZBOE_SUB TYPE STRING.

  CHECK GT_MSG IS  INITIAL.

  DATA(LT_ALV) = GT_ALV.
  DELETE LT_ALV WHERE BOX IS INITIAL.

*&---检查汇票状态
  "从数据库中获取选中的数据
  SELECT A~BUKRS,
         A~BOE_NUMBER,
         A~SRL_NO,
         A~BOE_STATUS,"汇票状态
         A~ZSFYDJ,    "汇票已登记
         A~LOEKZ,     "删除标识
         A~UPNAM      "更新人信息
   FROM ZTFI_071 AS A INNER JOIN @LT_ALV AS B
     ON A~BUKRS            = B~BUKRS
    AND A~BOE_NUMBER       = B~BOE_NUMBER
    AND A~SRL_NO           = B~SRL_NO
   INTO TABLE @DATA(LT_SELECT).

  DATA(LT_TAB) = LT_SELECT.

  DELETE LT_TAB WHERE BOE_STATUS =  '01' OR   BOE_STATUS =  '02'.
  "汇票状态是否为“回单已创建”或“已辨识”

  IF LT_TAB IS NOT INITIAL.

    "汇票XXXX状态不允许移除
    READ TABLE LT_TAB INTO DATA(LS_TAB) INDEX 1.

    "汇票XXX状态不允许移除
    LV_STR1 = |{ TEXT-097 }{ LS_TAB-BOE_NUMBER(30) }|.
    LV_STR2 = TEXT-112.
    LV_ZBOE_SUB = LS_TAB-BOE_NUMBER+30(25).

    GT_MSG = VALUE #( BASE GT_MSG
                       (  MSGID = 'ZMFI01' MSGTY = 'E'
                          MSGNO = '000'    MSGV1 = LV_STR1 MSGV2 = LV_ZBOE_SUB
                          MSGV3 = LV_STR2
                       )
                   ).
    RETURN.

  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DATA_DELETE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_DATA_DELETE .

  DATA:LV_RETURN TYPE C ."返回按钮

  "判断检验是否通过
  IF  GT_MSG IS NOT INITIAL.
    "检验不通过输出消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR:GT_MSG.
    RETURN.
  ELSE.

    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        TITLEBAR       = TEXT-111  "弹出标题
        TEXT_QUESTION  = TEXT-113  "文本内容
      IMPORTING
        ANSWER         = LV_RETURN
      EXCEPTIONS
        TEXT_NOT_FOUND = 1
        OTHERS         = 2.
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    IF LV_RETURN = '1' ."是

      "检查汇票状态
      PERFORM FRM_DELETE_STATUS.

      "移除汇票
      PERFORM FRM_DELETE_DATA.

    ENDIF.


  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DELETE_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_DELETE_DATA .

  DATA:LV_SNUM     TYPE I,
       LV_FNUM     TYPE I,
       LV_SUM      TYPE I,
       LV_STRING   TYPE STRING,
       LV_ZBOE_SUB TYPE STRING.


  "定义更新变量
  DATA: LV_UUID TYPE  SYSUUID_X16,
        LS_LOG  TYPE  ZTCM_004,
        LT_LOG  TYPE TABLE OF ZTCM_004,
        LV_TZ   TYPE TTZZ-TZONE VALUE 'UTC'.

  DATA:LV_VARKEY TYPE RSTABLE-VARKEY.

  "判断检验是否通过
  IF  GT_MSG IS NOT INITIAL.
    "检验不通过输出消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR:GT_MSG.
    RETURN.
  ELSE.

*&----获取UUID
    TRY.
        CLEAR LV_UUID.
        CALL METHOD CL_SYSTEM_UUID=>IF_SYSTEM_UUID_STATIC~CREATE_UUID_X16
          RECEIVING
            UUID = LV_UUID.
        .
      CATCH CX_UUID_ERROR INTO DATA(CX_ERROR).
    ENDTRY.
*---获取时间戳
    "GET TIME STAMP FIELD DATA(LV_TIMESTAMP).
    CONVERT DATE SY-DATUM
            TIME SY-UZEIT
       INTO TIME STAMP DATA(LV_TIMESTAMP) TIME ZONE LV_TZ.


    LOOP AT  GT_ALV INTO DATA(LS_ALV) WHERE BOX = 'X'.

      UPDATE ZTFI_071
         SET LOEKZ  = 'X'
             UPNAM  = SY-UNAME
             UPDAT  = SY-DATUM
             UPTIM  = SY-UZEIT
       WHERE BOE_NUMBER    = LS_ALV-BOE_NUMBER
         AND SRL_NO        = LS_ALV-SRL_NO
         AND BUKRS         = LS_ALV-BUKRS.
      IF SY-SUBRC EQ 0.

        COMMIT WORK AND WAIT.
        ADD 1 TO LV_SNUM.

        CLEAR:LV_STRING.

        "汇票XXXX已成功移除
        LV_STRING = |{ TEXT-097 }{ LS_ALV-BOE_NUMBER(30) }|.
        LV_ZBOE_SUB = LS_ALV-BOE_NUMBER+30(25).

        GT_MSG = VALUE #( BASE GT_MSG
                          ( MSGID = 'ZMFI01'  MSGTY = 'S'
                            MSGNO = '000'     MSGV1 = LV_STRING MSGV2 = LV_ZBOE_SUB
                            MSGV3 = TEXT-114
                          )
                        ).

        LS_LOG-MTYPE   = 'S'.
        LS_LOG-MESSAGE = |{ LV_STRING }{ TEXT-114 }|.

*---解锁
        CLEAR LV_VARKEY.

        LV_VARKEY = |{ LS_ALV-BUKRS }{ LS_ALV-BOE_NUMBER }{ LS_ALV-SRL_NO }|.

        PERFORM FRM_DEQUEUE_OBJECT USING LV_VARKEY.

        DELETE GT_ALV WHERE BUKRS       = LS_ALV-BUKRS
                        AND BOE_NUMBER  = LS_ALV-BOE_NUMBER
                        AND SRL_NO      = LS_ALV-SRL_NO.

      ELSE.
        ROLLBACK WORK.

        CLEAR:LV_STRING.

        "汇票XXXX移除失败
        LV_STRING = |{ TEXT-097 }{ LS_ALV-BOE_NUMBER(30) }|.
        LV_ZBOE_SUB = LS_ALV-BOE_NUMBER+30(25).

        GT_MSG = VALUE #( BASE GT_MSG
                  ( MSGID = 'ZMFI01'  MSGTY = 'E'
                    MSGNO = '000'     MSGV1 = LV_STRING MSGV2 = LV_ZBOE_SUB
                    MSGV3 = TEXT-115
                  )
                ).

        ADD 1 TO LV_FNUM.

        LS_LOG-MTYPE   = 'E'.
        LS_LOG-MESSAGE = |{ LV_STRING }{ TEXT-115 }|.


        LS_LOG-MESSAGE = |{ TEXT-072 }{ TEXT-110 }|.

      ENDIF.

      LT_LOG = VALUE #( BASE LT_LOG
                           ( UUID             = LV_UUID
                             TIMESTAMP        = LV_TIMESTAMP
                             BUKRS            = LS_ALV-BUKRS
                             BOE_NUMBER       = LS_ALV-BOE_NUMBER
                             BOE_STATUS       = LS_ALV-BOE_STATUS
                             BANKN            = LS_ALV-BANKN
                             REPID            = SY-REPID
                             CRNAM            = SY-UNAME
                             RQTDD            = SY-DATUM
                             RQTDT            = SY-UZEIT
                             MTYPE            = LS_LOG-MTYPE
                             MESSAGE          = LS_LOG-MESSAGE
                             )  ) .


    ENDLOOP.

    IF LV_SNUM > 0.
      "XX张汇票已成功移除
      LV_STRING = |{ LV_SNUM }{ TEXT-116 }|.
      GT_MSG = VALUE #( BASE GT_MSG
                  ( MSGID = 'ZMFI01'  MSGTY = 'S'
                    MSGNO = '000'     MSGV1 = LV_STRING
                  )
                ).



    ENDIF.

    IF LV_FNUM > 0.
      "XX张汇票移除失败
      LV_STRING = |{ LV_SNUM }{ TEXT-117 }|.
      GT_MSG = VALUE #( BASE GT_MSG
          ( MSGID = 'ZMFI01'  MSGTY = 'E'
            MSGNO = '000'     MSGV1 = LV_STRING
          )
        ).


    ENDIF.






    IF LT_LOG IS NOT INITIAL.
      MODIFY ZTCM_004 FROM TABLE LT_LOG.
      IF SY-SUBRC = 0.
        COMMIT WORK AND WAIT.
      ELSE.
        ROLLBACK WORK.
      ENDIF.
    ENDIF.


    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

*&---刷新屏幕
    IF GCL_GRID_00 IS NOT  INITIAL.
      GCL_CLS_00->REFRESH_ALV(
      CHANGING
        IO_GRID = GCL_GRID_00
        ).
    ENDIF.

  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SET_EXCLUDE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_SET_EXCLUDE .

  DATA: LS_EXCLUDE TYPE UI_FUNC.

  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_PRINT. "打印
  APPEND LS_EXCLUDE TO GT_EXCLUDE.



ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DATA_PRINT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_DATA_PRINT .


  "判断检验是否通过
  IF  GT_MSG IS NOT INITIAL.
    "检验不通过输出消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR:GT_MSG.
    RETURN.
  ELSE.

    "获取批量打印信息
    PERFORM FRM_GET_PRINT_DATA.

    IF GT_MSG IS NOT INITIAL.
      "检验不通过输出消息
      CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
        TABLES
          I_MESSAGE_TAB = GT_MSG.

      CLEAR:GT_MSG.
      RETURN.

    ENDIF.
  ENDIF.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_GET_PRINT_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_GET_PRINT_DATA .

  "获取流转信息赋值到GT_CIRCULATION
  CLEAR:GT_CIRCULATION.

  DATA:LS_E_MSG TYPE ESP1_MESSAGE_WA_TYPE,
       LS_E_LOG TYPE ZTCM_004.

  DATA:LT_LOG TYPE TABLE OF ZTCM_004.

  DATA: LS_ZTFI_071 TYPE ZTFI_071,
        LT_ZTFI_071 TYPE TABLE OF ZTFI_071.

  DATA:LT_RECIPET     TYPE TABLE OF ZZS_FIIF_091,
       LT_CIRCULATION TYPE TABLE OF TY_CIRCULATION.

  DATA: LS_FI_006 TYPE ZZS_FI_006,
        LT_FI_007 TYPE ZZT_FI_007,
        LS_FI_007 TYPE ZZS_FI_007.

  DATA:LS_FI_009 TYPE ZZS_FI_009,
       LT_FI_009 TYPE ZZT_FI_009.

  DATA:LS_ALV TYPE TY_ALV.

  CLEAR: LT_FI_009.

*---取票据流转信息配置信息
  SELECT
         RFCDEST,
         FNAME
    INTO TABLE @DATA(LT_FNAME)
    FROM ZTFI_069_03
   WHERE BCTYP = '210'.

  LOOP AT GT_ALV INTO DATA(LT_ALV) WHERE BOX = 'X' .

    "取银企直连配置,走银企直连接口
    READ TABLE GT_070 INTO DATA(LS_070) WITH KEY BUKRS = LT_ALV-BUKRS
                                                 HBKID = LT_ALV-HBKID
                                                 HKTID = LT_ALV-HKTID.
    IF SY-SUBRC EQ 0.

      READ TABLE LT_FNAME INTO DATA(LS_FNAME) WITH KEY RFCDEST = LS_070-RFCDEST.
      IF SY-SUBRC EQ 0.
        CLEAR:LS_E_MSG ,
              LS_E_LOG ,
              LS_FI_006,
              LT_FI_007.

        LS_ZTFI_071 = CORRESPONDING #( LT_ALV ).

        TRY.

            CALL FUNCTION LS_FNAME-FNAME
              EXPORTING
                I_RQT_STU = LS_ZTFI_071
              IMPORTING
                E_MSG     = LS_E_MSG
                E_LOG     = LS_E_LOG
                E_FI_006  = LS_FI_006
              TABLES
                T_FI_007  = LT_FI_007.
          CATCH CX_ROOT INTO DATA(LC_ERROR).
*----函数调用失败异常消息
            GT_MSG = VALUE #( BASE GT_MSG ( MSGID = 'ZMFI01'  MSGTY = 'E'
                                            MSGNO = '002'     MSGV1 = LC_ERROR->GET_TEXT( ) ) ).

        ENDTRY.

        APPEND LS_E_LOG TO LT_LOG.

        IF LS_E_MSG IS NOT INITIAL.

          APPEND LS_E_MSG TO GT_MSG.

        ELSE.

          DATA:LV_FLAG TYPE C .
          IF LT_FI_007[] IS INITIAL.

            LV_FLAG = 'X'.

          ELSE.

            "重新赋值内表,只剩后两条数据
            DATA(LV_LINE) = LINES( LT_FI_007 ).

            "如果大于两行
            IF LV_LINE > 2.
              "计算需要删除的行数
              DATA(LV_END) = LV_LINE - 2 .
              "删除内表中其余数据
              DELETE LT_FI_007 FROM 1 TO LV_END .

            ENDIF.

          ENDIF.

          CLEAR:LS_FI_009.

          "赋值内表数据
          LS_FI_009 = CORRESPONDING #( LS_FI_006 ).

          READ TABLE LT_FI_007 INTO DATA(LS_DATA1) INDEX 1.
          IF SY-SUBRC = 0.

            LS_FI_009-TITLE    = LS_DATA1-TITLE   .
            LS_FI_009-KEY1     = LS_DATA1-KEY1    .
            LS_FI_009-VLAUE1   = LS_DATA1-VLAUE1  .
            LS_FI_009-KEY2     = LS_DATA1-KEY2    .
            LS_FI_009-VLAUE2   = LS_DATA1-VLAUE2  .
            LS_FI_009-KEY3     = LS_DATA1-KEY3    .
            LS_FI_009-VLAUE3   = LS_DATA1-VLAUE3  .
            LS_FI_009-KEY4     = LS_DATA1-KEY4    .
            LS_FI_009-VLAUE4   = LS_DATA1-VLAUE4  .
            LS_FI_009-KEY5     = LS_DATA1-KEY5    .
            LS_FI_009-VLAUE5   = LS_DATA1-VLAUE5  .

          ELSE.
            LS_FI_009-FLAG       = 'X'.
            LS_FI_009-EX_FLAG    = 'X'.

          ENDIF.

          READ TABLE LT_FI_007 INTO DATA(LS_DATA2) INDEX 2.
          IF SY-SUBRC = 0.

            LS_FI_009-EX_TITLE   = LS_DATA2-TITLE   .
            LS_FI_009-EX_KEY1    = LS_DATA2-KEY1    .
            LS_FI_009-EX_VLAUE1  = LS_DATA2-VLAUE1  .
            LS_FI_009-EX_KEY2    = LS_DATA2-KEY2    .
            LS_FI_009-EX_VLAUE2  = LS_DATA2-VLAUE2  .
            LS_FI_009-EX_KEY3    = LS_DATA2-KEY3    .
            LS_FI_009-EX_VLAUE3  = LS_DATA2-VLAUE3  .
            LS_FI_009-EX_KEY4    = LS_DATA2-KEY4    .
            LS_FI_009-EX_VLAUE4  = LS_DATA2-VLAUE4  .
            LS_FI_009-EX_KEY5    = LS_DATA2-KEY5    .
            LS_FI_009-EX_VLAUE5  = LS_DATA2-VLAUE5  .

          ELSE.

            LS_FI_009-EX_FLAG    = 'X'.

          ENDIF.

          IF LS_FI_009 IS NOT INITIAL .

            APPEND LS_FI_009 TO LT_FI_009.

          ENDIF.


        ENDIF.


      ENDIF.

    ENDIF.

  ENDLOOP.

  IF GT_MSG[] IS INITIAL.

*&---打印机参数设置
    DATA:L_CONTROL    TYPE SSFCTRLOP,
         LW_SSFCRESCL TYPE SSFCRESCL,
         LW_OUTPUT    TYPE SSFCOMPOP.

*&--开启批量打印
    L_CONTROL-NO_OPEN = 'X'.
    L_CONTROL-NO_CLOSE = 'X'.
    L_CONTROL-NO_DIALOG = ''.

    LW_OUTPUT-RQPOSNAME = ''.
    LW_OUTPUT-TDDATASET = ''.
    LW_OUTPUT-TDSUFFIX1 = ''.
    LW_OUTPUT-TDSUFFIX2 = ''.
    LW_OUTPUT-TDIMMED = 'X'.      "立即假脱机打印
    LW_OUTPUT-TDDELETE = 'X'.     "立即假脱机删除


*&---打开打印
    CALL FUNCTION 'SSF_OPEN'
      EXPORTING
        CONTROL_PARAMETERS = L_CONTROL
        OUTPUT_OPTIONS     = LW_OUTPUT
      EXCEPTIONS
        FORMATTING_ERROR   = 1
        INTERNAL_ERROR     = 2
        SEND_ERROR         = 3
        USER_CANCELED      = 4
        ERROR_MESSAGE      = 5
        OTHERS             = 6.

*&---检测打印是否打开
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.


*&--打印参数定义
    DATA:FM_NAME   TYPE RS38L_FNAM.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME = 'ZFI_003_SF'
      IMPORTING
        FM_NAME  = FM_NAME.


    CALL FUNCTION FM_NAME
      EXPORTING
        CONTROL_PARAMETERS = L_CONTROL
      TABLES
        GT_FI_009          = LT_FI_009
      EXCEPTIONS
        FORMATTING_ERROR   = 1
        INTERNAL_ERROR     = 2
        SEND_ERROR         = 3
        USER_CANCELED      = 4
        OTHERS             = 5.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

*&---关闭打印
    CALL FUNCTION 'SSF_CLOSE'
      IMPORTING
        JOB_OUTPUT_INFO  = LW_SSFCRESCL
      EXCEPTIONS
        FORMATTING_ERROR = 1
        INTERNAL_ERROR   = 2
        SEND_ERROR       = 3
        ERROR_MESSAGE    = 4
        OTHERS           = 5.
    IF SY-SUBRC <> 0.
      "弹出消息内容
      MESSAGE  TEXT-132 TYPE 'S' DISPLAY LIKE 'E'.

    ENDIF.

  ENDIF.

  CLEAR:LS_ZTFI_071 ,
        LT_ZTFI_071 .

*&---判断是否打印
  IF LW_SSFCRESCL-OUTPUTDONE = 'X'.

    "获取选中的信息
    DATA(LT_TAB) = GT_ALV .
    DELETE LT_TAB WHERE BOX IS INITIAL.

    "获取所有选中的信息在ZTFI_071表中的信息
    SELECT
            A~*
      FROM ZTFI_071 AS A INNER JOIN @LT_TAB  AS B
                                 ON A~BUKRS  = B~BUKRS
                                AND A~SRL_NO = B~SRL_NO
                                AND A~BOE_NUMBER = B~BOE_NUMBER
     WHERE A~LOEKZ <> 'X'
      INTO TABLE @DATA(LT_SAVE).


    LOOP AT LT_SAVE ASSIGNING FIELD-SYMBOL(<FS_ALV>).

      CLEAR:LS_ZTFI_071.

      <FS_ALV>-UPNAM        = SY-UNAME .
      <FS_ALV>-UPDAT        = SY-DATUM .
      <FS_ALV>-UPTIM        = SY-UZEIT .
      <FS_ALV>-ZPRINT       = <FS_ALV>-ZPRINT + 1.

      LS_ZTFI_071 = CORRESPONDING #( <FS_ALV> ).

      APPEND LS_ZTFI_071 TO LT_ZTFI_071.

      CLEAR:LS_ALV.
      LS_ALV-ZPRINT = <FS_ALV>-ZPRINT .

      MODIFY GT_ALV FROM LS_ALV TRANSPORTING ZPRINT WHERE BUKRS      = <FS_ALV>-BUKRS
                                                      AND SRL_NO     = <FS_ALV>-SRL_NO
                                                      AND BOE_NUMBER = <FS_ALV>-BOE_NUMBER .
    ENDLOOP.

  ENDIF.

  "更新数据
  IF LT_ZTFI_071[] IS NOT INITIAL.

    MODIFY ZTFI_071 FROM TABLE LT_ZTFI_071.
    IF SY-SUBRC EQ 0.
      COMMIT WORK AND WAIT.
    ELSE.
      ROLLBACK WORK.
    ENDIF.

  ENDIF.

  "先判断日志是否为空
  IF LT_LOG[] IS NOT INITIAL.
    "更新日志表
    MODIFY ZTCM_004 FROM TABLE LT_LOG.
    IF SY-SUBRC EQ 0.
      COMMIT WORK AND WAIT.
    ELSE.

      ROLLBACK WORK.
    ENDIF.
  ENDIF.



ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_HANDLE_DOUBLE_CLICK
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM FRM_HANDLE_DOUBLE_CLICK USING
                                    I_ROW_ID TYPE LVC_S_ROW
                                 I_COLUMN_ID TYPE LVC_S_COL.

  TYPES:BEGIN OF TY_DISPLAY,
          FIELDNAME TYPE STRING,
          VALUE     TYPE STRING,
        END OF TY_DISPLAY.
  DATA:LS_DISPLAY TYPE TY_DISPLAY,
       LT_DISPLAY TYPE TABLE OF TY_DISPLAY.

  DATA:LV_NAME TYPE STRING.


  READ TABLE GT_ALV INTO DATA(LS_ALV) INDEX I_ROW_ID-INDEX.
  IF SY-SUBRC = 0 AND I_COLUMN_ID-FIELDNAME = 'BOE_NUMBER'.

    "赋值详细信息内容
    CLEAR:LS_DISPLAY  ,
          LT_DISPLAY  .

    CLEAR:LS_DISPLAY.

    LS_DISPLAY-FIELDNAME = TEXT-001 . LS_DISPLAY-VALUE = LS_ALV-BOE_NUMBER . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-002 . LS_DISPLAY-VALUE = LS_ALV-BUKRS      . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-003 . LS_DISPLAY-VALUE = LS_ALV-BUTXT      . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-004 . LS_DISPLAY-VALUE = LS_ALV-KUNNR      . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-005 . LS_DISPLAY-VALUE = LS_ALV-NAME1      . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-006 . LS_DISPLAY-VALUE = LS_ALV-GSBER      . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-025 . LS_DISPLAY-VALUE = LS_ALV-LTEXT       . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-007 . LS_DISPLAY-VALUE = LS_ALV-BOE_TYPE    . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-023 . LS_DISPLAY-VALUE = LS_ALV-ZSFZL            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-008 . LS_DISPLAY-VALUE = LS_ALV-WRBTR            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-058 . LS_DISPLAY-VALUE = LS_ALV-WAERS            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-009 . LS_DISPLAY-VALUE = LS_ALV-WEFAE            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-051 . LS_DISPLAY-VALUE = LS_ALV-WDATE            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-052 . LS_DISPLAY-VALUE = LS_ALV-BOE_RECEIVE_DATE . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-094 . LS_DISPLAY-VALUE = LS_ALV-EBR_DATE         . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-053 . LS_DISPLAY-VALUE = LS_ALV-HBKID            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-054 . LS_DISPLAY-VALUE = LS_ALV-HKTID            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-055 . LS_DISPLAY-VALUE = LS_ALV-HBAKN            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-056 . LS_DISPLAY-VALUE = LS_ALV-HBAKL            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-010 . LS_DISPLAY-VALUE = LS_ALV-BANKL            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-011 . LS_DISPLAY-VALUE = LS_ALV-BANKN            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-012 . LS_DISPLAY-VALUE = LS_ALV-BANKA            . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-104 . LS_DISPLAY-VALUE = LS_ALV-BOE_ACC_NAME          . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-105 . LS_DISPLAY-VALUE = LS_ALV-BOE_DEPOSIT_ACCOUNT   . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-013 . LS_DISPLAY-VALUE = LS_ALV-BOE_ACC_BANK_NUMBER   . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-014 . LS_DISPLAY-VALUE = LS_ALV-BOE_ACC_BANK          . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-015 . LS_DISPLAY-VALUE = LS_ALV-WBZOG                 . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-016 . LS_DISPLAY-VALUE = LS_ALV-BOE_DRAWEE_ACCOUNT    . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-017 . LS_DISPLAY-VALUE = LS_ALV-BOE_DRAWEE_BANK_NUMBER. APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-018 . LS_DISPLAY-VALUE = LS_ALV-BOE_DRAWEE_BANK       . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-019 . LS_DISPLAY-VALUE = LS_ALV-WNAME                 . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-020 . LS_DISPLAY-VALUE = LS_ALV-BOE_DRAWER_ACCOUNT    . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-021 . LS_DISPLAY-VALUE = LS_ALV-BOE_DRAWER_BANK_NUMBER. APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-022 . LS_DISPLAY-VALUE = LS_ALV-BOE_DRAWER_BANK       . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-071 . LS_DISPLAY-VALUE = LS_ALV-BOE_NEGOT             . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-072 . LS_DISPLAY-VALUE = LS_ALV-BOE_OVERDUE           . APPEND LS_DISPLAY TO LT_DISPLAY.
    LS_DISPLAY-FIELDNAME = TEXT-135 . LS_DISPLAY-VALUE = LS_ALV-ZPRINT                . APPEND LS_DISPLAY TO LT_DISPLAY.

    LV_NAME = |{ LS_ALV-BOE_TYPE_TEXT }{ TEXT-140 }|.

    CALL METHOD CL_DEMO_OUTPUT=>DISPLAY_DATA
      EXPORTING
        VALUE = LT_DISPLAY
        NAME  = LV_NAME.

  ENDIF.



ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CONFIRM_SCREEN
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> P_
*&---------------------------------------------------------------------*
FORM FRM_CONFIRM_SCREEN  USING  LV_FLAG.


  DATA:LV_RETURN TYPE C ."返回按钮
  DATA:LV_TITLE  TYPE STRING.
  DATA:LV_QUESTION TYPE STRING.

  IF LV_FLAG = 'X'.
    "签收
    LV_TITLE  = TEXT-136.
    LV_QUESTION = TEXT-137.

  ELSE.
    "拒签
    LV_TITLE  = TEXT-138 .
    LV_QUESTION = TEXT-139 .

  ENDIF.


  "判断检验是否通过
  IF  GT_MSG IS NOT INITIAL.
    "检验不通过输出消息
    CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
      TABLES
        I_MESSAGE_TAB = GT_MSG.

    CLEAR:GT_MSG.
    RETURN.
  ELSE.

    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        TITLEBAR       = LV_TITLE  "弹出标题
        TEXT_QUESTION  = LV_QUESTION  "文本内容
      IMPORTING
        ANSWER         = LV_RETURN
      EXCEPTIONS
        TEXT_NOT_FOUND = 1
        OTHERS         = 2.
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    IF LV_RETURN = '1' ."是

      PERFORM FRM_SIGN_DATA USING LV_FLAG.

    ENDIF.

  ENDIF.

ENDFORM.

ZFID_002_PAI

*&---------------------------------------------------------------------*
*& 包含               ZFID_002_PAI
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.
  PERFORM FRM_USER_COMMAND.
ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9030  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9030 INPUT.
    PERFORM FRM_USER_COMMAND.
ENDMODULE.

ZFID_002_PBO

*&---------------------------------------------------------------------*
*& 包含               ZFID_002_PBO
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
*&  待签ALV 屏幕
*&---------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
  SET PF-STATUS 'STANDARD'.
  SET TITLEBAR 'TITL9000' WITH TEXT-026.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module MOD_INIT_ALV OUTPUT
*&---------------------------------------------------------------------*
*&  ALV 创建
*&---------------------------------------------------------------------*
MODULE MOD_INIT_ALV OUTPUT.


  PERFORM FRM_SET_LAYOUT.      "ALV布局

  PERFORM FRM_SET_FDCATA.      "ALV字段

  PERFORM FRM_SET_EXCLUDE.

  PERFORM FRM_CALL_ALV_CLASS.  "调用ALV自定义方法


ENDMODULE.
*&---------------------------------------------------------------------*
*& Module STATUS_9010 OUTPUT
*&---------------------------------------------------------------------*
*&  9010 获取回单屏幕
*&---------------------------------------------------------------------*
MODULE STATUS_9010 OUTPUT.
  SET PF-STATUS 'STANDARD'.
  SET TITLEBAR 'TITL9010' WITH TEXT-034..
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module MOD_INIT_RECIPT OUTPUT
*&---------------------------------------------------------------------*
*&  9010 回单ALV
*&---------------------------------------------------------------------*
MODULE MOD_INIT_RECIPT OUTPUT.

  PERFORM FRM_SET_LAYOUT.      "ALV布局

  PERFORM FRM_SET_FACT_10.     "ALV Filecat

  PERFORM FRM_CALL_RECIPT_ALV. "ALV
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module STATUS_9030 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE STATUS_9030 OUTPUT.
  SET PF-STATUS 'STANDARD'.
  SET TITLEBAR 'TITL9010' WITH TEXT-079..
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module MOD_INIT_CIRCULATION OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE MOD_INIT_CIRCULATION OUTPUT.

  PERFORM FRM_SET_LAYOUT.      "ALV布局

  PERFORM FRM_SET_FACT_30.     "ALV Filecat

  PERFORM FRM_CALL_CIRCULATION_ALV. "ALV


ENDMODULE.

ZFID_002_SEL

*&---------------------------------------------------------------------*
*& 包含               ZFID_002_SEL
*&---------------------------------------------------------------------*

*----------------------------------------------------------------------*
*    SELECTION-SCREEN
*----------------------------------------------------------------------*
 SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-046.

 SELECT-OPTIONS:S_BUKRS FOR T012K-BUKRS OBLIGATORY,
                S_HBKID FOR T012K-HBKID,
                S_HKTID FOR T012K-HKTID,
                S_KUNNR FOR KNA1-KUNNR,
                S_TYPE  FOR ZTFI_071-BOE_TYPE,
                S_ERDAT FOR KNA1-ERDAT.

 SELECTION-SCREEN END OF BLOCK BLK.


*----------------------------------------------------------------------*
*    intital
*----------------------------------------------------------------------*
 INITIALIZATION.

   PERFORM FRM_INIT_DATE.



 AT SELECTION-SCREEN.

*---权限检查
   PERFORM FRM_AUTHORIZATION_CHECK.


*----------------------------------------------------------------------*
*    start-of-selection
*----------------------------------------------------------------------*

 START-OF-SELECTION.


*---获取数据
   PERFORM FRM_GET_DATA.


*----------------------------------------------------------------------*
*    end-of-selection
*----------------------------------------------------------------------*

 END-OF-SELECTION.

   CALL SCREEN 9000.

ZFID_002_TOP

*&---------------------------------------------------------------------*
*& 包含               ZFID_002_TOP
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
*    type-pools,tables
*----------------------------------------------------------------------*
TABLES:T012K,
       KNA1,
       ZTFI_071.

TYPES:BEGIN OF TY_ALV,
        BOX                    TYPE C,
        BOE_NUMBER             TYPE ZBOE_NUMBER,     "汇票编号
        EBR_DATE               TYPE EPIC_EBR_DATE,  "回单日期
        BUKRS                  TYPE BUKRS,          "公司代码
        SRL_NO                 TYPE EPIC_EBR_SRL_NO, "银行回单交易流水号
        BUTXT                  TYPE BUTXT,          "公司名称
        KUNNR                  TYPE KUNNR,          "客户编号
        NAME1                  TYPE NAME1,          "客户名称
        GSBER                  TYPE GSBER,          "业务范围
        GTEXT                  TYPE GTEXT,          "业务范围描述
        BOE_TYPE               TYPE BOE_TYP,        "汇票承兑类型
        BOE_TYPE_TEXT          TYPE STRING,         "汇兑承兑类型描述
        WRBTR                  TYPE WRBTR,          "金额
        WAERS                  TYPE WAERS,          "货币
        WEFAE                  TYPE BUDAT,          "到期日
        WDATE                  TYPE BUDAT,          "出票日期
        BOE_RECEIVE_DATE       TYPE BUDAT,          "签收日期
        HBKID                  TYPE HBKID,          "持票人开户行
        HKTID                  TYPE HKTID,          "持票人账户标识
        HBAKN                  TYPE ZEBANKN,        "持票人银行账号
        HBAKL                  TYPE BANKL,          "持票人银行联行号
        BANKL                  TYPE BANKL,          "客户银行代码
        BANKN                  TYPE BANKN35,        "客户银行账号
        BANKA                  TYPE BANKA,          "客户银行名称
        BOE_ACC_NAME           TYPE BOE_ACC_NAME         , "承兑人名称
        BOE_DEPOSIT_ACCOUNT    TYPE ZEBOE_DEPOSIT_ACCOUNT, "承兑人银行账号
        BOE_ACC_BANK_NUMBER    TYPE BANKK,          "承兑人联行号
        BOE_ACC_BANK           TYPE BANKA,          "承兑人银行名称
        WBZOG                  TYPE WBZOG,          "收票人名称
        BOE_DRAWEE_ACCOUNT     TYPE BANKN35,        "收票人银行账号
        BOE_DRAWEE_BANK_NUMBER TYPE BANKK,          "收票人联行号
        BOE_DRAWEE_BANK        TYPE BANKA,          "收票人银行名称
        WNAME                  TYPE WNAME,          "出票人名称
        BOE_DRAWER_ACCOUNT     TYPE BANKN35,        "出票人银行账号
        BOE_DRAWER_BANK_NUMBER TYPE BANKK,          "出票人联行号
        BOE_DRAWER_BANK        TYPE BANKA,          "出品人银行名称
        ZSFZL                  TYPE CHAR1,          "是/否直直联
        BOE_STATUS             TYPE CHAR2,          "汇票状态
        LTEXT                  TYPE VAL_TEXT,       "汇票状态描述
        BOE_NEGOT              TYPE BOE_NEGOT        , "标识:不可转让
        BOE_OVERDUE            TYPE BOE_OVERDUE      , "标识:逾期汇票
        BOE_VERIFIED           TYPE BOE_VERIFIED     , "标识:汇票已审核
        BOE_BLOCK              TYPE BOE_BLOCK        , "标识:汇票已冻结
        BOE_BLOCK_REASON       TYPE BOE_BLOCK_REASON , "汇票冻结原因
        ZSFYDJ                 TYPE ZESFDJ           , "汇票已登记
        BUSCODE                TYPE ZEBUSCODE        , "农行的业务编码
        TRANSCODE              TYPE ZETRSCODE        , "农行交易代码
        COLOR(4)               TYPE C                , "行颜色
        FSEQNO                 TYPE ZEFSEQNO         ,
        ZPRINT                 TYPE EIV_PRNT_TIMES   ,  "打印次数
      END OF TY_ALV.

*---银行账户通讯结构
TYPES:BEGIN OF TY_RECEIPT,
        BOX TYPE C.
    INCLUDE STRUCTURE ZTFI_070.

TYPES:
  END OF TY_RECEIPT.

TYPES:BEGIN OF TY_INDT,
        KUNNR TYPE KNA1-KUNNR,
        VKBUR TYPE KNVV-VKBUR,
      END OF TY_INDT.

TYPES:BEGIN OF TY_CIRCULATION,
        BOE_NUMBER   TYPE BOE_NUMBER, "汇票编号
        TRANSTYP     TYPE STRING,    "业务种类
        TRANSTYPNAM  TYPE STRING,    "业务种类名称
        SIGNDATE     TYPE STRING,    "签收日期
        SIGNTYP      TYPE STRING,    "签收人类别
        SIGNTYPNAM   TYPE STRING,    "签收人类别名称
        SIGNNAM      TYPE STRING,    "签收人名称
        SIGNORGCODE  TYPE STRING,    "签收人组织机构代码
        SIGNOPBNK    TYPE STRING,    "签收人开户行号
        SIGNOPBNKNAM TYPE STRING,    "签收人承接行行名
        SIGNACCNO    TYPE STRING,    "签收人账号
        RATE         TYPE STRING,    "利率
        NOTE         TYPE STRING,    "备注
      END OF TY_CIRCULATION.

*----------------------------------------------------------------------*
*    internal table  work area
*----------------------------------------------------------------------*
DATA:GT_ALV         TYPE TABLE OF TY_ALV,
     GT_RECEIPT_ALV TYPE TABLE OF TY_RECEIPT,
     GT_CIRCULATION TYPE TABLE OF TY_CIRCULATION.

DATA:GT_FCAT_00 TYPE LVC_T_FCAT,                  " Fieldcat table
     GT_FCAT_10 TYPE LVC_T_FCAT,                  " Fieldcat table
     GT_FCAT_30 TYPE LVC_T_FCAT,                  " Fieldcat table
     GS_LAYOUT  TYPE LVC_S_LAYO,                  " Layout
     GT_EVENT   TYPE SLIS_T_EVENT,
     GS_VARIANT TYPE DISVARIANT,
     GT_EXCLUDE TYPE UI_FUNCTIONS.


DATA:GCL_GRID_00 TYPE REF TO CL_GUI_ALV_GRID, "汇票ALV
     GCL_GRID_10 TYPE REF TO CL_GUI_ALV_GRID, "回单ALV
     GCL_GRID_30 TYPE REF TO CL_GUI_ALV_GRID, "流转信息ALV
     GCL_CLS_00  TYPE REF TO ZCL_CM_GUI_ALV,  "汇票类
     GCL_CLS_10  TYPE REF TO ZCL_CM_GUI_ALV,  "回单类
     GCL_CLS_30  TYPE REF TO ZCL_CM_GUI_ALV.  "流转信息类

DATA:OK_CODE TYPE SY-UCOMM,
     SAVE_OK TYPE SY-UCOMM.
DATA:GS_INDT TYPE TY_INDT.

DATA:GT_MSG TYPE ESP1_MESSAGE_TAB_TYPE.

DATA:LS_MES TYPE ESP1_MESSAGE_WA_TYPE.

DATA:LS_RSPFLAG TYPE C.

DATA:LS_LOG TYPE ZTCM_004,
     LS_RQT TYPE ZTFI_071.

DATA:GT_070 TYPE TABLE OF ZTFI_070.

*----------------------------------------------------------------------*
*    variable  constants
*----------------------------------------------------------------------*
CONSTANTS:GC_X        TYPE CHAR1         VALUE 'X',
          GC_DYNNR_00 TYPE SYST_DYNNR    VALUE '9000',
          GC_DYNNR_10 TYPE SYST_DYNNR    VALUE '9010',
          GC_DYNNR_20 TYPE SYST_DYNNR    VALUE '9020',
          GC_DYNNR_30 TYPE SYST_DYNNR    VALUE '9030',
          GC_COLOR    TYPE C LENGTH 4    VALUE 'C110',
          GC_RED      TYPE C LENGTH 4    VALUE 'C601',
          GC_MAINTAIN TYPE ACTIV_AUTH    VALUE '23',
          GC_POST     TYPE ACTIV_AUTH    VALUE '10'.


*----------------------------------------------------------------------*
*    TC CONTROLE
*----------------------------------------------------------------------*
CREATE OBJECT: GCL_CLS_00,
               GCL_CLS_10,
               GCL_CLS_30.

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

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

相关文章

Linux中的进程替换

一、理解进程替换 首先&#xff0c;exec* 系列函数能让进程执行新程序&#xff0c;上图我们用到的是 int execl(const char* path, const char* arg, ...)函数&#xff0c;所以相当于执行了 ls -la 指令&#xff0c;这就完成了进程的替换。 本来子进程中存放的是父进程的代码和…

5. 有效的括号

5. 有效的括号 题目题目分析 题目 题目分析 一个很标准的关于栈知识点的应用&#xff0c;首先先初始化一个栈&#xff0c;再遍历字符串s,当匹配到为左边字符串是将其压入栈中&#xff0c;遇到右边字符串时要判断此时的栈顶元素是否与其匹配&#xff0c;若匹配则将栈顶元素弹出&…

GPX格式详解,javascript写入读取GPX示例

还是大剑师兰特&#xff1a;曾是美国某知名大学计算机专业研究生&#xff0c;现为航空航海领域高级前端工程师&#xff1b;CSDN知名博主&#xff0c;GIS领域优质创作者&#xff0c;深耕openlayers、leaflet、mapbox、cesium&#xff0c;canvas&#xff0c;webgl&#xff0c;ech…

如何使用Markdown编辑器

欢迎使用Markdown编辑器 你好&#xff01; 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章&#xff0c;了解一下Markdown的基本语法知识。 新的改变 我们对Markdown编辑器进行了一些功能拓展与语法支持&#x…

【PLC】关于子程序功能以及编程过程中的部分心得

博主在使用GX Works对三菱PLC编程的时候用到了子程序功能&#xff0c;这里将使用子程序功能中的一点心得以及编程过程中的部分心得分享给大家。 博主主要对以下几个问题有一些心得&#xff1a; 1、如何调试带有子程序的程序&#xff1f; 2、如何让程序按照计划的顺序去执行&…

【OpenCV C++20 学习笔记】自定义线性滤波-filter2D

自定义线性滤波 原理相关卷积核线性滤波操作 API实例 原理 相关 线性滤波的是指就是相关&#xff0c;即计算图像中的每个部分和卷积核(kernel)的相关结果。 卷积核 卷积核本质上是一个固定大小的系数数组&#xff0c;数组中的某个元素被作为锚点&#xff08;一般是数组的中…

C++之从C过渡(上)

C之从C过渡 前言 暂时告别C语言&#xff0c;我们走进C。对于有C语言基础&#xff0c;初学C的我们来说&#xff0c;在正式学习C的主体内容之前&#xff0c;我们需要先有一个过渡&#xff0c;本文中会总结过渡需要了解的零散知识&#xff0c;主要是语法。 正文 C的第一个程序 …

终于用PC串口显示出esp32 串口输出hello world

硬件&#xff1a; esp32模块 rs232 转ttl 3.3v 电平转换器 3.3v 外接电源 esp32 tx 脚接转换器rx, rx脚接转换器tx esp32 使用uart2 现在就可以用pc作为上位机通过串口控制esp32&#xff0c;用pc串口调试软件作为esp的输出监控器显示esp的各种运算结果。 #include &qu…

使用visual studio2019创建dll导出自定义类

系列文章目录 文章目录 系列文章目录前言一、具体操作步骤1.创建动态链接库工程(DLL)2.头文件声明3.实现文件定义4.生成dll工程5 使用dll总结 前言 程序对动态链接库dll、静态链接库lib想必都很熟悉了&#xff0c;网上也有很多的相关介绍。但网上介绍的一般都是C语言函数介绍&…

javascript 的奇技巧淫二

文章目录 1 、标记模板文字2、使用 Object.entries() 和 Object.fromEntries()3、用于唯一元素的 Set 对象4、对象中的动态属性名称5、使用 bind() 进行函数柯里化6、使用 Array.from() 从类似数组的对象创建数组7、可迭代对象的 for…of 循环8、使用 Promise.all() 实现并发 P…

SpringBoot下载resources目录下的文件

1.引入SpringBoot和hutool依赖 <dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.8.22</version></dependency>2.在项目resources目录下放入模版文件&#xff0c;结构如下&#xff1a…

JavaScript基础(30)_事件的冒泡、事件的委派

事件的冒泡(Bubble) 所谓的冒泡指的是事件的向上传导&#xff0c;当后代元素上的事件被触发时&#xff0c;其祖先元素的“相同事件”也会被触发。 取消事件冒泡 在开发中大部分情况冒泡都是有用的&#xff0c;如果不希望发生事件冒泡可以通过事件对象来取消冒泡。取消冒泡代码…

数字货币走势分析两点最关键,比特币BTC竞猜策略共享

目前虚拟货币市场成为各界关注的焦点&#xff0c;比特币的未来也会随着相关的决策和政策而产生变化&#xff0c;多位专家是看好这个市场的潜力的。如果比特币随后可以得到更多开采和推广的话&#xff0c;全球加密货币领域的高度还会提升。目前各方对于比特币和加密货币咨询和了…

OpenAI降低人们的期望值 今年秋季的DevDay不会公布GPT-5

去年&#xff0c;OpenAI 在旧金山举行了一场声势浩大的新闻发布会&#xff0c;会上该公司发布了一系列新产品和工具&#xff0c;其中包括类似 App Store 的GPT 商店。不过&#xff0c;今年的活动将更加低调。本周一&#xff0c;OpenAI 表示它将改变 DevDay 大会的形式&#xff…

使用visual studio code远程连接虚拟机

1. 安装Remote-SSH插件 打开vscode&#xff0c;在“扩展商店”中搜索“Remote-SSH”&#xff0c;然后点击“安装”即可&#xff0c;如图所示。 2. 配置SSH 如图所示&#xff0c;点击“远程资源管理器”&#xff0c;点击“新建远程”&#xff0c;然后在输入框中输入如下指令。…

革新出行体验:音频定位导航系统引领智能导航新时代

在科技日新月异的今天&#xff0c;出行方式正经历着前所未有的变革。从传统的纸质地图到GPS视觉导航&#xff0c;再到如今日益兴起的音频定位导航系统&#xff0c;每一次进步都极大地提升了人们的出行便捷性与安全性。音频定位导航系统&#xff0c;作为智能导航领域的创新之作&…

css仿el-tabs标签页效果

需求&#xff1a;el-tabs很多时候需要改间距或者下划线上还要加组件什么的比较麻烦&#xff0c;手写一个自己根据需求更改即可 1.效果 2.主要代码详解 主要代码如下&#xff1a;active是下划线&#xff0c;activeitem是选中后改变字体颜色&#xff0c; item- (index 1),用ite…

用.net core简易搭建webapi托管到IIS

1、从官网下载.NET Core 托管捆绑包 https://learn.microsoft.com/zh-cn/aspnet/core/tutorials/publish-to-iis?viewaspnetcore-8.0&tabsvisual-studio 2、新建ASP.NET Core WEB API项目 新建控制器TestController并生成GetInfo方法 3、发布 目标路径选择 2)显示所有…

花小钱、办大事的巴黎奥运会,能学点啥?|易搭云

“获得奥运会举办权的竞争几乎和体育赛事本身一样激烈。”众所周知&#xff0c;奥运会不仅能带来巨大的经济效益&#xff0c;更是国家实力和文化底蕴的彰显。时隔百年&#xff0c;奥运会的主会场又回到了巴黎&#xff0c;以浪漫著称的巴黎&#xff0c;奥运会突出的关键词却变成…

使用Cisco进行模拟RIP路由协议配置

实验四 RIP路由协议配置 文章目录 实验四 RIP路由协议配置1.实验目的2.实验流程3.RIPv1实验步骤4.RIPv2实验步骤 1.实验目的 1&#xff09;理解RIP路由的原理 2&#xff09;掌握RIP路由的配置方法 2.实验流程 开始→布置拓扑→配置IP地址→配置并验证RIPv1→配置并验证RIPv2…