REPORT zdemo02.
CLASS cls DEFINITION.
PUBLIC SECTION.
CLASS-METHODS meth.
ENDCLASS.
CLASS cls IMPLEMENTATION.
METHOD meth.
DATA:BEGIN OF ls_bseg,
bukrs TYPE bseg-bukrs,
belnr TYPE bseg-belnr,
gjahr TYPE bseg-gjahr,
dmbtr TYPE bseg-dmbtr,
key1 TYPE CHAR50,
END OF ls_bseg,
lt_bseg LIKE TABLE OF ls_bseg.
SELECT a~bukrs, a~belnr, a~gjahr,
CASE a~shkzg
WHEN 'H' THEN ( a~dmbtr - a~dmbtr - a~dmbtr )
WHEN 'S' THEN a~dmbtr
END AS dmbtr
INTO TABLE @lt_bseg
FROM bseg AS a
UP TO 100 ROWS.
SELECT a~bukrs, a~belnr, a~gjahr,
CASE a~shkzg
WHEN 'H' THEN CAST( a~dmbtr * -1 AS DEC( 23,2 ) )
WHEN 'S' THEN a~dmbtr
END AS dmbtr
INTO TABLE @DATA(lt_bseg2)
FROM bseg AS a
UP TO 100 ROWS.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
cls=>meth( ).
阅读(1239) | 评论(0) | 转发(0) |