首页 > 代码库 > 注销凭证与自定义屏幕
注销凭证与自定义屏幕
注意注销凭证FB03 (事务代码SHDB)
自定义屏幕的功能代码与标准程序要对应一致
<style>SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF } .L0S31 { font-style: italic; color: #808080 } .L0S32 { color: #3399FF } .L0S33 { color: #4DA619 } .L0S52 { color: #0000FF } .L0S55 { color: #800080 } .L0S70 { color: #808080 }</style>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 =