ZTEST003

Posted wangxiaowen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ZTEST003相关的知识,希望对你有一定的参考价值。

REPORT  ZTEST003.

DATA: BEGIN OF GS_DATA ,
    COLA TYPE STRING,
    COLB TYPE STRING,
  END OF GS_DATA,
  GT_DATA LIKE TABLE OF GS_DATA.




DATA LV_FILE LIKE RLGRAP-FILENAME VALUE /usr/sap/D01/DVEBMGS00/data/CSV_TEST.csv.


DATA: LO_CSV TYPE REF TO CL_RSDA_CSV_CONVERTER,
      LV_CPCODEPAGE TYPE CPCODEPAGE,
      LV_CSV(1024).


CALL METHOD CL_RSDA_CSV_CONVERTER=>CREATE
*  EXPORTING
*    i_delimiter = C_DEFAULT_DELIMITER
*    i_separator = C_DEFAULT_SEPARATOR
      RECEIVING
        R_R_CONV    = LO_CSV.

OPEN DATASET LV_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
  DO.
    READ DATASET LV_FILE INTO LV_CSV.
    IF SY-SUBRC = 0.
      CLEAR GS_DATA.
      "去除CSV每一行结尾的换行符#
      CALL FUNCTION NLS_GET_FRONTEND_CP
        EXPORTING
          LANGU                 = SY-LANGU
          FETYPE                = MS
        IMPORTING
          FRONTEND_CODEPAGE     = LV_CPCODEPAGE
        EXCEPTIONS
          ILLEGAL_SYST_CODEPAGE = 1
          NO_FRONTEND_CP_FOUND  = 2
          INTERNAL_OR_DB_ERROR  = 3
          OTHERS                = 4.
      CALL FUNCTION SCP_REPLACE_STRANGE_CHARS
        EXPORTING
          INTEXT            = LV_CSV
          INTER_CP          = LV_CPCODEPAGE
          REPLACEMENT       = 32
        IMPORTING
          OUTTEXT           = LV_CSV
        EXCEPTIONS
          INVALID_CODEPAGE  = 1
          CODEPAGE_MISMATCH = 2
          INTERNAL_ERROR    = 3
          CANNOT_CONVERT    = 4
          FIELDS_NOT_TYPE_C = 5
          OTHERS            = 6.
      CALL METHOD LO_CSV->CSV_TO_STRUCTURE
        EXPORTING
          I_DATA   = LV_CSV
        IMPORTING
          E_S_DATA = GS_DATA.
      APPEND GS_DATA TO GT_DATA.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  CLOSE DATASET LV_FILE.
ELSE.
  MESSAGE Cannot open file! TYPE E .

ENDIF.

 

以上是关于ZTEST003的主要内容,如果未能解决你的问题,请参考以下文章

[新增EA003考勤系统演示片段]全程字幕-22套UML+Enterprise Architect建模示范视频

Zephyr单元测试框架:ztest/twister的使用和介绍

Zephyr单元测试框架:ztest/twister的使用和介绍

Zephyr单元测试框架:ztest/twister的使用和介绍

[UnityShader]点染队列ZWrite和ZTest

ZTEST004FORM