ABAP顾问
分类:
2009-05-07 19:30:59
REPORT Z_BARRY_TEST.
DATA: BEGIN OF WA ,
F1(8) ,
F2(4) TYPE P DECIMALS 2 ,
F3(4) TYPE N,
F4 TYPE D,
F5 TYPE I,
* F6 TYPE STRING ,
END OF WA.
DATA: CHAR(600) TYPE C .
DATA: I TYPE I.
WA-F1 = 'AB中文'.
WA-F2 = '-2232'.
WA-F3 = '1234'.
WA-F4 = SY-DATUM.
WA-F5 = 123456.
*WA-F6 = 'sdfsdfsfsdfsdf'.
PERFORM WATOCHAR USING WA CHANGING CHAR.
WRITE CHAR.
*&---------------------------------------------------------------------*
*& Form watochar
*&---------------------------------------------------------------------*
FORM WATOCHAR USING WA CHANGING CHAR.
DATA: FTYPE ,
FCOMP ,
* FSTR(1000) TYPE C,
OUTLEN TYPE I ,
ALLLEN TYPE I .
FIELD-SYMBOLS:
DESCRIBE FIELD WA TYPE FTYPE COMPONENTS FCOMP .
IF FTYPE = 'u'.
DO FCOMP TIMES.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE WA TO
DESCRIBE FIELD
* FSTR+0(OUTLEN) =
CHAR+ALLLEN(OUTLEN) =
ALLLEN = ALLLEN + OUTLEN .
ENDDO.
ELSE.
MESSAGE S000(OO) WITH 'Not a flat structure'.
ENDIF.
ENDFORM. "WATOCHAR