Sunday, February 19, 2012

DAy 5

Sy-Index is for the no of loops in a do or where command.
Sy-Tabbix is for No.of rows in an internal table.

U CAN ALSO USE HEADER LINE INSTEAD OF WORK AREA
DATA: BEGIN OF STU,
CARRID TYPE SCARR-CARRID,
CARRNAME TYPE SCARR-CARRNAME,
END OF STU.
data: itab like stu OCCURS 0 with HEADER LINE.
SELECT CARRID CARRNAME FROM SCARR INTO TABLE ITAB.
LOOP AT ITAB.
WRITE:/ ITAB-CARRID, ITAB-CARRNAME.
ENDLOOP.

There are few changes when compared
to a normal Internal table report, as it does not use workarea.

U can also write occurs 0 at begin
of stu, but if that is the case u can not use headerline. Then u need to go for
wa. But u can still continue with data instead of changing it to types.

Create a function module Z_ADD
Import
A type i
B type i
C type i
Export
D type i


Source code
D = ( ( ( A + 5 ) * 4 ) / 2 ).
WRITE: d.
CLEAR D.
D = ( ( ( B + 5 ) * 4 ) / 2 ).
WRITE: d.
CLEAR D.
D = ( ( ( C + 5 ) * 4 ) / 2 ).
WRITE: d.

Now g to se38 ABAP Editor
Parameters : X TYPE I,
Y TYPE I,
Z TYPE I.
DATA: R TYPE I.
CALL FUNCTION 'Z_ADD'
EXPORTING
A = X
B = Y
C = Z
IMPORTING
D = R
.

No comments:

Post a Comment