Wednesday, 27 May 2015

Read text on binary mode

TYPES: BEGIN OF ty_stxl,
          tdname TYPE stxl-tdname,
          clustr TYPE stxl-clustr,
          clustd TYPE stxl-clustd,
  srtf2  TYPE stxl-srtf2,
END OF ty_stxl.
DATA:  t_stxl TYPE STANDARD TABLE OF ty_stxl.
FIELD-SYMBOLS: <stxl> TYPE ty_stxl.
* compressed text data without text name
TYPES: BEGIN OF ty_stxl_raw,
          clustr TYPE stxl-clustr,
          clustd TYPE stxl-clustd,
END OF ty_stxl_raw.
DATA:  t_stxl_raw TYPE STANDARD TABLE OF ty_stxl_raw.
DATA:  w_stxl_raw TYPE ty_stxl_raw.
* decompressed text
DATA:  t_tline TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <tline> TYPE tline.
DATA: t_stxh TYPE STANDARD TABLE OF stxh,
       w_stxh TYPE stxh.
DATA rtname TYPE RANGE OF  stxl-tdname WITH HEADER LINE.


rtname-sign = 'I'. rtname-option = 'EQ'.
rtname-low = '210N501678550000000500000005'.
APPEND rtname.
rtname-low = '210N501785510000000200000002'.
APPEND rtname.
SELECT tdname clustr clustd  srtf2
INTO TABLE t_stxl
FROM stxl
" PACKAGE SIZE 3000
WHERE tdname in rtname AND tdspras = 'E'.
SORT t_stxl  BY srtf2.
CLEAR: t_stxl_raw[], t_tline[].
LOOP AT rtname.
write /  rtname-low.
LOOP AT t_stxl ASSIGNING <stxl> WHERE tdname  =  rtname-low.
*   decompress text
    w_stxl_raw-clustr = <stxl>-clustr.
    w_stxl_raw-clustd = <stxl>-clustd.
APPEND w_stxl_raw TO t_stxl_raw.
ENDLOOP.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
*  access text lines for further processing
LOOP AT t_tline ASSIGNING <tline>.
WRITE: / <tline>-tdline.
ENDLOOP.
uline.
ENDLOOP.
FREE t_stxl.

No comments:

Post a Comment