Skip to Content
0
Former Member
Jun 02, 2008 at 09:44 AM

Question about Subroutine and Internal tables

22 Views

See I have this code.

TABLES: SFLIGHT.

TYPES: BEGIN OF LINE,

Carrid like SFLIGHT-CARRID,

Connid like SFLIGHT-CONNID,

Fldate like SFLIGHT-FLDATE,

Seatsmax like SFLIGHT-SEATSMAX,

Seatsocc like SFLIGHT-SEATSOCC,

Percen type p decimals 2,

END OF LINE.

DATA: ISFLIGHT TYPE STANDARD TABLE OF LINE INITIAL SIZE 10 WITH HEADER LINE.

DATA: Percent type p decimals 2.

PARAMETERS: CID LIKE SFLIGHT-CARRID.

DATA: Num type I value 0.

INITIALIZATION.

CID = '004'.

SELECT CARRID CONNID FLDATE SEATSMAX SEATSOCC FROM SFLIGHT INTO TABLE ISFLIGHT WHERE CARRID = CID.

-


So far I've gotten this far. but now I need to compute for the percentage, which I'm required to do in a subroutine.

So I tried

FORM U TABLES ISFLIGHT STRUCTURE SFLIGHT.

ISFLIGHT-Percen = ( ISFLIGHT-Seatsocc / ISFLIGHT-Seatsmax ) * 100.

ENDFORM.

But I keep getting an error o that. It keeps telling me that ISFLIGHT does not have a Percen field. Also I'm suppose to use a pass by value to this subroutine but I don't know what that means.

Basically I need to compute for the percentage and insert it tot he internal table. which I would sort by percentage. After which I'm suppose to print the ouput by passing the internal table to the subroutine.

I know I'm doing something wrong but I just don't know how to fix this since I only started working on subroutines today. Any help would be appreciated.