注销凭证与自定义屏幕
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了注销凭证与自定义屏幕相关的知识,希望对你有一定的参考价值。
注意注销凭证FB03 (事务代码SHDB)
自定义屏幕的功能代码与标准程序要对应一致
REPORT ZWGX006.
TABLES BKPF.
DATA OK_CODE TYPE OKCODE.
TYPES: BEGIN OF TY_TAB,
CHECKBOX TYPE CHAR01.
INCLUDE TYPE BKPF.
TYPES END OF TY_TAB.
DATA LT_TAB TYPE STANDARD TABLE OF TY_TAB.
DATA LS_TAB LIKE LINE OF LT_TAB. ""**屏幕中的复选框
DATA: LT_FCAT TYPE LVC_T_FCAT,
LS_FCAT TYPE LVC_S_FCAT,
I_LAYO TYPE LVC_S_LAYO.
DATA:G_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA LT_MSG TYPE STANDARD TABLE OF BDCMSGCOLL.
DATA BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM SET_LAYO.
PERFORM SET_FCAT.
CALL SCREEN 2017.
*&---------------------------------------------------------------------*
*& Module STATUS_2017 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_2017 OUTPUT.
* SET PF-STATUS ‘xxxxxxxx‘.
* SET TITLEBAR ‘xxx‘.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_2017 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_2017 INPUT.
CASE OK_CODE.
WHEN‘ANN01‘.
LEAVE PROGRAM.
WHEN ‘ANN02‘.
PERFORM SET_WRITE-OFF.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_DATA.
SELECT * FROM BKPF INTO CORRESPONDING FIELDS OF
TABLE LT_TAB UP TO 50 ROWS.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SET_LAYO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SET_LAYO .
I_LAYO-ZEBRA = ‘X‘.
I_LAYO-CWIDTH_OPT = ‘X‘.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SET_FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SET_FCAT .""复选框
CALL FUNCTION ‘LVC_FIELDCATALOG_MERGE‘
EXPORTING
* I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = ‘BKPF‘
* I_CLIENT_NEVER_DISPLAY = ‘X‘
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
CT_FIELDCAT = LT_FCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
LS_FCAT-FIELDNAME = ‘CHECKBOX‘.
LS_FCAT-CHECKBOX = ABAP_TRUE.
LS_FCAT-EDIT = ABAP_TRUE.
LS_FCAT-SCRTEXT_S = ‘冲销凭证‘.
APPEND LS_FCAT TO LT_FCAT.
ENDFORM.
*&---------------------------------------------------------------------*
*& Module DISPLAY OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE DISPLAY OUTPUT.
DATA G_FIRST(1) TYPE C.
IF NOT G_CONTAINER IS BOUND.
CREATE OBJECT G_CONTAINER
EXPORTING
* PARENT =
CONTAINER_NAME = ‘CONTAINER1‘
* STYLE =
* LIFETIME = lifetime_default