REPORT ZRMM058 NO STANDARD PAGE HEADING MESSAGE-ID 00.
TABLES : EKKO,EKPO.
TYPE-POOLS: SLIS.
*--------------------------------
* Global Internal Tables
*--------------------------------
DATA: IT_FIELDCAT_ALV TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
IT_FIELDCAT_ALV1 TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
IT_FIELDCAT_ALV2 TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
IT_LIST_COMMENTS TYPE SLIS_T_LISTHEADER,
W_REPID LIKE SY-REPID,
WA_FIELDCAT LIKE LINE OF IT_FIELDCAT,
W_POS TYPE I,
W_EVENTS LIKE LINE OF IT_EVENTS,
W_LIST_COMMENTS LIKE LINE OF IT_LIST_COMMENTS,
W_FLAG TYPE C VALUE '1'.
DEFINE M1.
W_POS = W_POS + 1.
WA_FIELDCAT-COL_POS = W_POS.
WA_FIELDCAT-FIELDNAME = &1.
WA_FIELDCAT-TABNAME = 'IT_EBAN'.
WA_FIELDCAT-KEY = &2.
* WA_FIELDCAT-OUTPUTLEN = 40.
* wa_fieldcat-seltext_l = &3.
WA_FIELDCAT-REPTEXT_DDIC = &3.
WA_FIELDCAT-DATATYPE = '&4'.
* wa_fieldcat-do_sum = '&7'.
* wa_fieldcat-lzero = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT_ALV.
END-OF-DEFINITION.
*C-- Types Declarations
TYPES : BEGIN OF TP_FLATFILE_VTLS,
EBELN(10),
EBELP TYPE EKPO-EBELP,
* MENGE(13),
END OF TP_FLATFILE_VTLS.
*=====================================================================
* INTERNAL TABLES DECLARATION
*=====================================================================
DATA: T_FLATFILE_VTLS TYPE TP_FLATFILE_VTLS OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF T_SAPDATA OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
* MENGE LIKE EKPO-MENGE,
END OF T_SAPDATA.
DATA : BEGIN OF T_FLATFILE_VTLS1 OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
END OF T_FLATFILE_VTLS1.
DATA : BEGIN OF T_UPDATE OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
END OF T_UPDATE.
DATA : BEGIN OF T_POHEADER OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
END OF T_POHEADER.
DATA : BEGIN OF T_POITEM OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
END OF T_POITEM.
DATA : BEGIN OF T_MESSAGE OCCURS 0,
PO LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MSGTY,
MSGID(2),
MSGNO(3),
MSGTX(100),
END OF T_MESSAGE.
DATA : BEGIN OF T_BAPI_POHEADER OCCURS 0.
INCLUDE STRUCTURE BAPIMEPOHEADER.
DATA : END OF T_BAPI_POHEADER.
DATA : BEGIN OF T_BAPI_POHEADERX OCCURS 0.
INCLUDE STRUCTURE BAPIMEPOHEADERX.
DATA : END OF T_BAPI_POHEADERX.
DATA : BEGIN OF T_BAPI_POITEM OCCURS 0.
INCLUDE STRUCTURE BAPIMEPOITEM.
DATA : END OF T_BAPI_POITEM.
DATA : BEGIN OF T_BAPI_POITEMX OCCURS 0.
INCLUDE STRUCTURE BAPIMEPOITEMX.
DATA : END OF T_BAPI_POITEMX.
DATA : BEGIN OF T_BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA : END OF T_BAPIRETURN.
DATA: PE_T_ITEMS_TO_DELETE LIKE BAPIEBAND OCCURS 0 WITH HEADER LINE.
DATA RETURN TYPE STANDARD TABLE OF BAPIRETURN WITH HEADER LINE.
*=====================================================================
* V A R I A B L E S
*=====================================================================
DATA: W_SUCCESS(6) TYPE N,
W_BKLAS LIKE T023-BKLAS,
W_CURRYEAR(4),
W_BEGDA LIKE SY-DATUM,
W_ENDDA LIKE SY-DATUM,
W_BEGYR(4),
W_ENDYR(4),
W_CURRMON(2),
W_ASSETCLASS LIKE ANKT-ANLKL,
W_PRICE TYPE P,
W_RECORDSAP TYPE I,
W_POVTLS(10),
W_COUNT TYPE I.
DATA: W_FILEPATH TYPE RLGRAP-FILENAME,
W_RC TYPE SY-SUBRC,
W_SSCRFIELDS_UCOMM1 TYPE SSCRFIELDS-UCOMM,
W_FILE1 TYPE STRING,
W_FILE2 TYPE FILENAME-FILEINTERN.
*=====================================================================
* C O N S T A N T S
*=====================================================================
CONSTANTS: C_X TYPE C VALUE 'X',
C_HYP TYPE C VALUE '-',
C_ERR TYPE BDC_MART VALUE 'E'.
CONSTANTS: C_SLASH(1) TYPE C VALUE '/',
C_HASH(1) TYPE C VALUE '#',
C_PIPE TYPE C VALUE '|',
C_1 TYPE I VALUE 1,
C_ZERO TYPE N VALUE '0',
C_RG1(3) TYPE C VALUE 'rg1',
C_GR3(3) TYPE C VALUE 'GR3',
C_GR2(3) TYPE C VALUE 'GR2',
C_E(1) TYPE C VALUE 'E',
C_FILEPATH(8) TYPE C VALUE '/interf/',
C_FILETYPE(10) TYPE C VALUE 'ASC',
CNS_QUERY(02) TYPE C VALUE 'FE',
CNS_MASK(30) TYPE C VALUE ',*.txt,*.txt.',
CNS_MODE(01) TYPE C VALUE 'O'.
CONSTANTS : C_BAPIMEPOHEADERX TYPE X030L-TABNAME
VALUE 'bapimepoheaderx',
C_BAPIMEPOITEM TYPE X030L-TABNAME
VALUE 'bapimepoitem',
C_BAPIMEPOACCOUNT TYPE X030L-TABNAME
VALUE 'bapimepoaccount',
C_T_BAPI_POHEADER(15) TYPE C
VALUE 't_bapi_poheader',
C_T_BAPI_POITEM(13) TYPE C
VALUE 't_bapi_poitem',
C_T_BAPI_POITEMX(14) TYPE C
VALUE 't_bapi_poitemx',
C_T_BAPI_POHEADERX(16) TYPE C
VALUE 't_bapi_poheaderx'.
CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
CONSTANTS:CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
*======================================================================
* SELECTION SCREEN
*======================================================================
SELECTION-SCREEN BEGIN OF BLOCK INPUTPATH WITH FRAME TITLE TEXT-001.
*SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-003.
PARAMETERS : P_FILE1 LIKE RLGRAP-FILENAME OBLIGATORY MODIF ID GR2.
*SELECTION-SCREEN : END OF BLOCK BLK1.
SELECTION-SCREEN END OF BLOCK INPUTPATH.
*C-- Initialization Event
INITIALIZATION.
CLEAR W_FILEPATH.
CONCATENATE C_FILEPATH SY-SYSID C_SLASH SY-MANDT C_SLASH INTO
W_FILEPATH.
CONDENSE W_FILEPATH NO-GAPS.
P_FILE1 = TEXT-008.
*======================================================================
* SELECTION SCREEN EVENTS
*======================================================================
*C-- Selection Screen Output
AT SELECTION-SCREEN OUTPUT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE1.
PERFORM FRM_VALUE_REQUEST USING P_FILE1
CHANGING P_FILE1.
AT SELECTION-SCREEN.
* check initial
PERFORM FRM_CHECK_INITIAL USING P_FILE1.
* check file exist or not
PERFORM FRM_CHECK_FILE USING P_FILE1 .
START-OF-SELECTION.
DATA: ZUPRIC(20) TYPE C.
* PERFORM VALIDATE_PRE_FILE USING P_FILE1.
PERFORM UPLOAD_FILE TABLES T_FLATFILE_VTLS
USING P_FILE1
CHANGING W_RC.
IF W_RC <> 0.
MESSAGE S006 DISPLAY LIKE C_E.
ENDIF.
LOOP AT T_FLATFILE_VTLS.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = T_FLATFILE_VTLS-EBELN
IMPORTING
OUTPUT = T_FLATFILE_VTLS1-EBELN.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = T_FLATFILE_VTLS-EBELP
IMPORTING
OUTPUT = T_FLATFILE_VTLS1-EBELP.
*begin 去除千分位
* ZUPRIC = T_FLATFILE_VTLS-MENGE.
* DO.
* REPLACE ',' WITH '' INTO ZUPRIC.
* IF SY-SUBRC NE 0.
* EXIT.
* ENDIF.
* ENDDO.
* CONDENSE ZUPRIC NO-GAPS.
* T_FLATFILE_VTLS-MENGE = ZUPRIC.
*end去除千分位符号','.
* MOVE T_FLATFILE_VTLS-MENGE TO T_FLATFILE_VTLS1-MENGE.
APPEND T_FLATFILE_VTLS1.
CLEAR T_FLATFILE_VTLS1.
ENDLOOP.
SORT T_FLATFILE_VTLS1 BY EBELN EBELP.
DELETE T_FLATFILE_VTLS1 WHERE EBELN = '' AND EBELP = ''.
PERFORM GET_PODATA.
LOOP AT T_POHEADER.
PERFORM MOVE_TO_BAPI.
PERFORM CALL_BAPI.
ENDLOOP.
PERFORM STORE_MESSAGES TABLES T_MESSAGE.
*&---------------------------------------------------------------------
*
*& Form upload_file
*&---------------------------------------------------------------------
*
* Routine to upload data from file to tables.
*----------------------------------------------------------------------
*
* -->P_fp_flatfile
* -->P_fp_file
* <--P_fp_rc
*----------------------------------------------------------------------
*
FORM UPLOAD_FILE TABLES FP_FLATFILE
USING FP_FILE LIKE RLGRAP-FILENAME
CHANGING FP_RC TYPE SY-SUBRC.
DATA L_FILE TYPE STRING.
DATA: LV_FILELENGTH TYPE I.
L_FILE = FP_FILE.
IF FP_FLATFILE[] IS INITIAL.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = L_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = 'X'
REPLACEMENT = '#'
CHECK_BOM = ' '
* FILENAME =
* FILETYPE = C_FILETYPE
* HAS_FIELD_SEPARATOR = C_X
IMPORTING
FILELENGTH = LV_FILELENGTH
TABLES
DATA_TAB = FP_FLATFILE[]
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
MOVE SY-SUBRC TO FP_RC.
ENDIF.
ENDFORM. " upload_file
*&--------------------------------------------------------------------*
*& Form get_podata
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM GET_PODATA.
LOOP AT T_FLATFILE_VTLS1.
AT NEW EBELP.
T_POHEADER-EBELN = T_FLATFILE_VTLS1-EBELN.
T_POHEADER-EBELP = T_FLATFILE_VTLS1-EBELP.
APPEND T_POHEADER.
CLEAR T_POHEADER.
ENDAT.
T_POITEM-EBELN = T_FLATFILE_VTLS1-EBELN.
T_POITEM-EBELP = T_FLATFILE_VTLS1-EBELP.
* T_POITEM-MENGE = T_FLATFILE_VTLS1-MENGE.
APPEND T_POITEM.
CLEAR T_POITEM.
ENDLOOP.
ENDFORM. "get_podata
*&--------------------------------------------------------------------*
*& Form move_to_bapi
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM MOVE_TO_BAPI.
T_BAPI_POHEADER-PO_NUMBER = T_POHEADER-EBELN.
REFRESH : T_BAPI_POITEM,T_BAPI_POITEMX.
CLEAR PE_T_ITEMS_TO_DELETE[].
LOOP AT T_POITEM WHERE EBELN = T_POHEADER-EBELN
AND EBELP = T_POHEADER-EBELP.
PE_T_ITEMS_TO_DELETE-PREQ_ITEM = T_POITEM-EBELP.
PE_T_ITEMS_TO_DELETE-DELETE_IND = 'X'.
PE_T_ITEMS_TO_DELETE-CLOSED = 'X'.
APPEND PE_T_ITEMS_TO_DELETE.
CLEAR PE_T_ITEMS_TO_DELETE.
ENDLOOP.
ENDFORM. "move_to_bapi
*&---------------------------------------------------------------------
*
*& Form call_bapi
*&---------------------------------------------------------------------
*
* This form Routine is used to commit the data records
*----------------------------------------------------------------------*
FORM CALL_BAPI .
DATA : L_MSGTY TYPE C,
L_MSGID(2) TYPE C,
L_MSGNO(3) TYPE C,
L_MSGTX(100) TYPE C,
L_ERRFLAG TYPE C.
CLEAR: RETURN.
REFRESH: RETURN.
CALL FUNCTION 'BAPI_REQUISITION_DELETE'
EXPORTING
NUMBER = T_POHEADER-EBELN
TABLES
REQUISITION_ITEMS_TO_DELETE = PE_T_ITEMS_TO_DELETE
RETURN = RETURN.
READ TABLE RETURN WITH KEY TYPE = C_ERR." TRANSPORTING NO FIELDS.
IF SY-SUBRC NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = C_X.
LOOP AT RETURN WHERE TYPE = 'S'.
T_MESSAGE-PO = T_POHEADER-EBELN.
T_MESSAGE-EBELP = T_POHEADER-EBELP.
T_MESSAGE-MSGTY = RETURN-TYPE.
T_MESSAGE-MSGID = RETURN-CODE.
T_MESSAGE-MSGNO = RETURN-LOG_MSG_NO.
T_MESSAGE-MSGTX = RETURN-MESSAGE.
APPEND T_MESSAGE.
CLEAR T_MESSAGE.
ENDLOOP.
IF SY-SUBRC <> 0.
T_MESSAGE-PO = T_POHEADER-EBELN.
T_MESSAGE-EBELP = T_POHEADER-EBELP.
T_MESSAGE-MSGTY = 'S'.
T_MESSAGE-MSGTX = '批量删除请购单,成功!'.
APPEND T_MESSAGE.
CLEAR T_MESSAGE.
ENDIF.
ELSE.
LOOP AT RETURN.
T_MESSAGE-PO = T_POHEADER-EBELN.
T_MESSAGE-EBELP = T_POHEADER-EBELP.
T_MESSAGE-MSGTY = RETURN-TYPE.
T_MESSAGE-MSGID = RETURN-CODE.
T_MESSAGE-MSGNO = RETURN-LOG_MSG_NO.
T_MESSAGE-MSGTX = RETURN-MESSAGE.
APPEND T_MESSAGE.
CLEAR T_MESSAGE.
ENDLOOP.
ENDIF.
*C-- Write messages
* WRITE: / 'PO Number', T_POHEADER-EBELN.
* CLEAR : T_UPDATE,W_POVTLS.
* READ TABLE T_UPDATE WITH KEY POSAP = T_POHEADER-PO.
* W_POVTLS = T_UPDATE-POVTLS.
CLEAR L_ERRFLAG.
ENDFORM. "call_bapi
*&---------------------------------------------------------------------
*
*& Form fill_check_structure
*&---------------------------------------------------------------------
*
* This form Routine will check whether the specified structure
* exist/active
*----------------------------------------------------------------------
*
FORM FILL_CHECK_STRUCTURE USING FP_TABNAME TYPE ANY
FP_ORGTABNAME TYPE ANY
FP_CHKTABNAME TYPE ANY
FP_CHECK TYPE C.
FIELD-SYMBOLS : , .
DATA: L_CHAR1(61) TYPE C,
L_CHAR2(61) TYPE C.
DATA: BEGIN OF TL_NAMETAB OCCURS 60.
INCLUDE STRUCTURE X031L.
DATA: END OF TL_NAMETAB.
REFRESH TL_NAMETAB.
CALL FUNCTION 'RFC_GET_NAMETAB'
EXPORTING
TABNAME = FP_TABNAME
TABLES
NAMETAB = TL_NAMETAB
EXCEPTIONS
TABLE_NOT_ACTIVE = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
CLEAR TL_NAMETAB.
ENDIF.
LOOP AT TL_NAMETAB.
CLEAR: L_CHAR1, L_CHAR2.
CONCATENATE FP_CHKTABNAME C_HYP TL_NAMETAB-FIELDNAME INTO L_CHAR1.
ASSIGN (L_CHAR1) TO .
CONCATENATE FP_ORGTABNAME C_HYP TL_NAMETAB-FIELDNAME INTO L_CHAR2.
ASSIGN (L_CHAR2) TO .
IF IS NOT INITIAL.
= FP_CHECK.
ENDIF.
ENDLOOP.
ENDFORM. " fill_check_structure
*&--------------------------------------------------------------------*
*& Form STORE_MESSAGES
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->FP_MESSAGEStext
*---------------------------------------------------------------------*
FORM STORE_MESSAGES TABLES FP_MESSAGES STRUCTURE T_MESSAGE.
PERFORM FRM_EVENT_BUILD.
PERFORM FRM_LAYOUT_BUILD."用于定义ALV表单的相关格式、属性
PERFORM FRM_FIELDS. "用来定义表单中的各个列的相关信息,比如列名等
W_FLAG = '1'.
PERFORM FRM_DISPLAY_DATA TABLES FP_MESSAGES USING W_FLAG. "用来显示ALV表单
ENDFORM. "STORE_MESSAGES
*&---------------------------------------------------------------------*
*& Form FRM_EVENT_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FRM_EVENT_BUILD .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS.
READ TABLE IT_EVENTS
WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO W_EVENTS.
IF SY-SUBRC = 0.
MOVE 'ALV_TOP_OF_PAGE' TO W_EVENTS-FORM.
MODIFY IT_EVENTS FROM W_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM. " FRM_EVENT_BUILD
*&---------------------------------------------------------------------*
*& Form FRM_LAYOUT_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FRM_LAYOUT_BUILD .
IT_LAYOUT-ZEBRA = 'X'.
IT_LAYOUT-DETAIL_POPUP = 'X'. "是否弹出详细信息窗口
W_REPID = SY-REPID. "程序为当前程序
* IT_LAYOUT-F2CODE = '&ETA'.
"设置触发弹出详细信息窗口的功能码,这里是双击
IT_LAYOUT-NO_VLINE = ' '. "这个用来设置列间隔线
IT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "优化列宽选项是否设置
IT_LAYOUT-DETAIL_INITIAL_LINES = 'X'.
IT_LAYOUT-DETAIL_TITLEBAR = SY-TITLE. "设置弹出窗口的标题栏
ENDFORM. " FRM_LAYOUT_BUILD
*&---------------------------------------------------------------------*
*& Form FRM_FIELDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FRM_FIELDS .
DATA: L_POS TYPE I.
REFRESH IT_FIELDCAT_ALV.
CLEAR IT_FIELDCAT.
M1 'PO' '' '请购单号码' CHAR.
M1 'EBELP' '' '请购单项次' CHAR.
M1 'MSGTY' '' '消息类型' CHAR.
M1 'MSGTX' '' '消息内容' CHAR.
ENDFORM. " FRM_FIELDS
*&---------------------------------------------------------------------*
*& Form FRM_DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FRM_DISPLAY_DATA TABLES JTAB USING FLAG TYPE C.
REFRESH : IT_FIELDCAT_ALV2[].
IF FLAG = '1'.
IT_FIELDCAT_ALV2[] = IT_FIELDCAT_ALV[].
ELSEIF FLAG = '2'.
IT_FIELDCAT_ALV2[] = IT_FIELDCAT_ALV1[].
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_REPID "当前程序
* I_CALLBACK_USER_COMMAND = 'FRM_USER_COMMAND'
* I_CALLBACK_PF_STATUS_SET = 'FRM_STANDARD_01'
I_SAVE = 'A' "可保存layout格式
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_ALV2[]
IT_EVENTS = IT_EVENTS "子函数layout_build填充的格式定义
TABLES
T_OUTTAB = JTAB."子函数fields填充的各列
ENDFORM. " FRM_DISPLAY_DATA
*&---------------------------------------------------------------------*
*& Form alv_top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM ALV_TOP_OF_PAGE.
DATA: W_CHAR(50) TYPE C.
CLEAR: IT_LIST_COMMENTS[].
W_LIST_COMMENTS-TYP = 'H'. "H=Header, S=Selection, A=Action供选择
W_LIST_COMMENTS-KEY = ''.
W_LIST_COMMENTS-INFO = SY-TITLE.
APPEND W_LIST_COMMENTS TO IT_LIST_COMMENTS.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LIST_COMMENTS.
ENDFORM. "alv_top_of_page
*&---------------------------------------------------------------------*
*& Form FRM_STANDARD_01
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->EXTAB text
*----------------------------------------------------------------------*
FORM FRM_STANDARD_01 USING EXTAB TYPE SLIS_T_EXTAB.
* if w_flag = '1'.
* SET PF-STATUS 'MENU' EXCLUDING EXTAB.
* else.
* SET PF-STATUS 'MENU1' EXCLUDING EXTAB.
* endif.
ENDFORM. "FRM_STANDARD_01
*&---------------------------------------------------------------------*
*& Form FRM_VALUE_REQUEST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FILE1 text
* <--P_P_FILE1 text
*----------------------------------------------------------------------*
FORM FRM_VALUE_REQUEST USING PR_FILE LIKE RLGRAP-FILENAME
CHANGING PE_FILE LIKE RLGRAP-FILENAME.
DATA:
L_NAME(128) TYPE C.
* get file name
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = PR_FILE
MASK = CNS_MASK
MODE = CNS_MODE
IMPORTING
FILENAME = L_NAME
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
IF SY-SUBRC = 0.
PE_FILE = L_NAME.
ENDIF.
ENDFORM. " FRM_VALUE_REQUEST
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_INITIAL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FILE1 text
*----------------------------------------------------------------------*
FORM FRM_CHECK_INITIAL USING P_LFILE LIKE RLGRAP-FILENAME.
IF P_LFILE IS INITIAL.
* Please input selection file
MESSAGE E000 WITH TEXT-005. "Please input selection file
ENDIF.
ENDFORM. " FRM_CHECK_INITIAL
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PR_FILE text
*----------------------------------------------------------------------*
FORM FRM_CHECK_FILE USING PR_FILE LIKE RLGRAP-FILENAME.
DATA LW_NUM TYPE I.
* CHECK file exist OR NOT
CALL FUNCTION 'WS_QUERY'
EXPORTING
FILENAME = PR_FILE
QUERY = CNS_QUERY
IMPORTING
RETURN = LW_NUM.
* EXCEPTIONS
* inv_query = 1
* no_batch = 2
* frontend_error = 3
* OTHERS = 4.
IF LW_NUM = 0.
* upload file doesn't exist
MESSAGE E000 WITH TEXT-004. "Upload file doesn't exist
ENDIF.
ENDFORM. " FRM_CHECK_FILE
测试数据格式:10000123 10
阅读(7418) | 评论(0) | 转发(0) |