Sie sind auf Seite 1von 4

ABAP/4

1.SAMPLE REPORT PROGRAM:


REPORT ZSAMPLE123.
WRITE 'HELLOWORLD'.

2.ELEMENTARY DATAYPES:
REPORT ZDATATYPES123.

*CHARACTER DATATYPES

DATA C1(12) TYPE C VALUE 'HELLOWORLD'. "CHARACTER TYPE DECLARATION


DATA N1(12) TYPE N VALUE '1234'. "NUMERIC CHARACTER TYPE DECLARATION
DATA D1 TYPE D VALUE '20110316'. "DATE TYPE DECLARATION
DATA T1 TYPE T VALUE '194243'. "TIME TYPE DECLARATION

WRITE: 'C1=',C1,'N1=',N1,'D1=',D1,'T1=',T1. "WRITE:- FOR PRINTING MULTIPLE VARIABLE.


SKIP. "SKIP- TO SKIP AND CONTINUE ON NEXT LINE.

*NUMERIC DATATYPES

DATA I1 TYPE I VALUE 24. "INTEGER TYPE DECLARATION


DATA P1 TYPE P DECIMALS 3 VALUE '3.876'. "PACKED DECIMAL TYPE DECLARATION
DATA F1 TYPE F VALUE 45. "FLOATING POINT TYPE DECLARATION

WRITE: 'I1=',I1,'P1=',P1,'F1=',F1.

*CONSTANT DATATYPES

CONSTANTS Z(8) TYPE N VALUE '45678'."CONSTANT TYPE DECLARATION

WRITE Z.

3.ELEMENTARY DATAYPES:
REPORT ZFIELDSTRINGS123.

DATA: BEGIN OF FS1,


A(8) TYPE C VALUE 'SANTHOSH',
B TYPE I VALUE 65,
END OF FS1.

WRITE: 'FS1-A=',FS1-A,'FS1-B=',FS1-B.
SKIP.
FS1-A = 'HELLOSAN'.
FS1-B = 78.

WRITE 'OVERWRITTED NEW VALUES'.


SKIP.

WRITE: 'FS1-A=',FS1-A,'FS1-B=',FS1-B.
4.USERDEFINED DATATYPES:
REPORT ZUSERDEFINEDDATATYPES.

TYPES: BEGIN OF FS1,


A(8) TYPE C,
B TYPE I,
END OF FS1.
DATA: X TYPE FS1-A VALUE 'SANTHOSH',
Y TYPE FS1-B VALUE 65.
WRITE: 'X=',X,'Y=',Y.

5.OUTPUTTING DATA TO THE SCREEN:


REPORT ZOUTPUTTINGDATATOTHESCREEN.

DATA: A(5) TYPE C VALUE 'HELLO',


B(5) TYPE C VALUE 'WORLD'.

WRITE: A,B.
SKIP.
WRITE: 12 A,B."12-POSTION OF THE OUTPUT IN SCREEN.
SKIP.
WRITE: 12(4) A,B."(4)-NO OF CHARACTERS TO BE PRINT.
SKIP.
WRITE: /12(4) A,/8 B."START FROM 12TH POSITION ON THE SCREEN.

6.FORMATTING STATEMENT USED ALONG WITH WRITE:


REPORT ZSCREENWRITE.

DATA C1 TYPE I VALUE -45.


DATA C2(6) TYPE C VALUE 'HELLO'.
DATA C3(6) TYPE C VALUE 'WORLD'.
DATA C4(6) TYPE N VALUE '004567'.
DATA C5 TYPE P DECIMALS 3 VALUE '5.826'.
DATA C6 TYPE F VALUE 35.
DATA C7 TYPE D VALUE '20110316'.

WRITE C1 LEFT-JUSTIFIED."JUSTIFIES THE OUTPUT TO LEFT SIDE OF THE SCREEN


SKIP.
WRITE C1 RIGHT-JUSTIFIED."JUSTIFIES THE OUTPUT TO RIGHT SIDE OF THE SCREEN
SKIP.
WRITE C1 CENTERED."JUSTIFIES THE OUTPUT TO THE CENTER
SKIP.
WRITE: C2,/ C1 UNDER C2."PRINTS EXACTLY ONE VALUE ON TOP OF THE OTHER
SKIP.
WRITE:C1 NO-GAP,C2 NO-GAP,C3."AVOIDS GAP BETWEEN TWO VALUES
SKIP.
WRITE C4 NO-ZERO."DELETES PRECEDING ZEROS
SKIP.
WRITE C1 NO-SIGN."REMOVES THE SIGN OF NUMBERS
SKIP.
WRITE C5 DECIMALS 2."ROUNDS THE DECIMAL VALUE AND SHOWS THE RESULT.
SKIP.
WRITE C5 ROUND 2."ROUND TO NEAR VALUE 10^-2
SKIP.
WRITE C6 EXPONENT 3."CHANGES THE EXPONENTIAL VALUE OF FLOATING POINT TYPES
SKIP.
WRITE C7 USING EDIT MASK '__/__/____'."FORMATS DATE TO DD/MM/YYYY FRORMAT
SKIP.
WRITE C5 UNIT 'KG'."SETS THE VALUE IN TERMS OF UNIT
5.COLORS:
REPORT ZCOLORS.

DATA X(5) TYPE C VALUE 'HELLO'.


DATA Y(5) TYPE C VALUE 'WORLD'.

WRITE X COLOR COL_HEADING.


WRITE X COLOR COL_NORMAL.
WRITE X COLOR COL_TOTAL.
WRITE X COLOR COL_KEY.
WRITE X COLOR COL_POSITIVE.
WRITE X COLOR COL_NEGATIVE.
WRITE X COLOR COL_GROUP.

SKIP.

WRITE Y COLOR 1.
WRITE Y COLOR 2.
WRITE Y COLOR 3.
WRITE Y COLOR 4.
WRITE Y COLOR 5.
WRITE Y COLOR 6.
WRITE Y COLOR 7.

6.INTENSIFIED,INVERSE,INPUT,HOTSPOT:
REPORT ZCOLORS.

DATA X(5) TYPE C VALUE 'HELLO'.


DATA Y(5) TYPE C VALUE 'WORLD'.

WRITE X COLOR COL_HEADING INTENSIFIED ON. "INTENSIFIES THE COLOR


WRITE X COLOR COL_NORMAL INVERSE ON. "INVERSE THE COLR OPTION
WRITE X COLOR COL_TOTAL INPUT ON. "ENABLE TEMPERORY USER INPUT
WRITE X COLOR COL_KEY HOTSPOT ON. "ENABLE EXTERNAL LINK
WRITE X COLOR COL_POSITIVE INTENSIFIED ON INVERSE ON.
WRITE X COLOR COL_NEGATIVE INTENSIFIED ON INPUT ON.
WRITE X COLOR COL_GROUP INTENSIFIED ON HOTSPOT ON.

SKIP.

WRITE Y COLOR 1 INVERSE ON INPUT ON.


WRITE Y COLOR 2 INVERSE ON HOTSPOT ON.
WRITE Y COLOR 3 INPUT ON HOTSPOT ON.
WRITE Y COLOR 4.
WRITE Y COLOR 5.
WRITE Y COLOR 6.
WRITE Y COLOR 7.

REPORT ZHLINEANDVLINE.

WRITE SY-ULINE. "DRAWS HORIZONTAL LINE ON SCREEN


SKIP.
WRITE SY-VLINE. "DRAWS VERTICAL LINE ON THE SCREEN
SKIP.
WRITE 6 SY-ULINE.
SKIP. "STARTS THE LINE FROM 6TH POSITION ON SCREEN
WRITE 6 SY-VLINE.
SKIP.
WRITE 6(10) SY-ULINE. "STARTS THE LINE FROM 6TH POSITION
SKIP.
WRITE 6 SY-VLINE.