ITPub博客

首页 > Linux操作系统 > Linux操作系统 > QA32中的出口 “STATTEXT”

QA32中的出口 “STATTEXT”

原创 Linux操作系统 作者:chouer523 时间:2019-05-12 22:57:07 0 删除 编辑
这个出口我只用来读取服务器上的文件,然后在QA32种显示状态,读取完成后删除文件,把读取到的值,写到自定义的表中。下次进QA32直接读取对应的表就可以显示状态了。对应的文件名为批次.txt

*&---------------------------------------------------------------------*
*& 包括 ZXBS1U01 *
*&---------------------------------------------------------------------*
DATA: PRUEFLOS LIKE ZQM18-PRUEFLOS.
DATA: P_PRUEFLOS LIKE ZQM18-PRUEFLOS.

DATA: P_ACTIVE LIKE ZQM18-ACTIVE.
DATA: P_PATH LIKE RLGRAP-FILENAME,
P_FPATH(60) TYPE C,
P_FILE(10) TYPE C,
P_NAME(11) TYPE C.
* P_NAME LIKE QALS-PRUEFLOS.

DATA: BEGIN OF T_DATA OCCURS 0,
TEXT(8) TYPE C,
END OF T_DATA.

DATA: BEGIN OF IT_ZQM18 OCCURS 0.
INCLUDE STRUCTURE ZQM18.
DATA: END OF IT_ZQM18.

**--截取批号
PRUEFLOS = OBJECT_NUMBER+3(11).

**--读取服务器的txt文档路径-*
P_NAME = PRUEFLOS+1(11).
*P_FPATH = 'C:临时TEST'.
*P_FPATH = 'LABSRVSAPLINKLIMS'.
P_FPATH = 'labsrvSAPlinkTESTLIMS'.
P_FILE = '.TXT'.
CONCATENATE P_FPATH P_NAME P_FILE INTO P_PATH.

**---测试数据
*P_ACTIVE = 'HG'.
*P_ACTIVE = 'BHG'.

**--该资料是否已经读取过txt文档,如果已经读取过文档,则从表里面读取
**状态,如果没有读取过,则读取服务器上的txt文档
SELECT SINGLE ACTIVE PRUEFLOS
INTO (P_ACTIVE, P_PRUEFLOS)
FROM ZQM18
WHERE PRUEFLOS = PRUEFLOS.

IF P_ACTIVE = ''.
REFRESH T_DATA.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = 'TIBM'
FILENAME = P_PATH
FILETYPE = 'DAT'
TABLES
DATA_TAB = T_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11.

**--读取LIMS返回的 合格或不合格
IF NOT T_DATA[] IS INITIAL.
LOOP AT T_DATA.
IF T_DATA-TEXT = '合格'.
P_ACTIVE = 'HG'.
ELSEIF T_DATA-TEXT = '不合格'.
P_ACTIVE = 'BHG'.
ELSE.
P_ACTIVE = ''.
ENDIF.
CLEAR T_DATA.
ENDLOOP.
ENDIF.


REFRESH IT_ZQM18.
IF P_ACTIVE <> ''.
MOVE: PRUEFLOS TO IT_ZQM18-PRUEFLOS,
P_ACTIVE TO IT_ZQM18-ACTIVE.
APPEND IT_ZQM18.
ENDIF.
CLEAR IT_ZQM18.

**--插入数据库
IF NOT IT_ZQM18[] IS INITIAL.

IF P_PRUEFLOS <> ''.
MODIFY ZQM18 FROM TABLE IT_ZQM18.
ELSE.
INSERT ZQM18 FROM TABLE IT_ZQM18.
ENDIF.

ENDIF.

**--删除该文件
CALL FUNCTION 'GUI_DELETE_FILE'
EXPORTING
FILE_NAME = P_PATH
EXCEPTIONS
FAILED = 1
OTHERS = 2.

**---合并状态
CONCATENATE P_ACTIVE SYSTEM_STATUS_LINE INTO SYSTEM_STATUS_LINE_EXP
SEPARATED BY SPACE.

ELSE.

**--删除该文件
CALL FUNCTION 'GUI_DELETE_FILE'
EXPORTING
FILE_NAME = P_PATH
EXCEPTIONS
FAILED = 1
OTHERS = 2.

**---合并状态
CONCATENATE P_ACTIVE SYSTEM_STATUS_LINE INTO SYSTEM_STATUS_LINE_EXP
SEPARATED BY SPACE.

ENDIF.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/332542/viewspace-53765/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2019-03-28

  • 博文量
    24
  • 访问量
    18583