2007 Oct 28 6:43 AM
Hello experts!!
could you plz tell me how to group the carrid when i m displaying records of SFLIGHT table.
Means, there are many records of AA carrid then many of AZ.
I want to print like following...
carrid connid fldate price
-
AA 0017 16.06.2004 422.00
0017 22.05.2005 544.00
0064 23.97.2006 700.00
AZ 0065 23.06.2004 800.00
0056 12.10.2004 900.00
0056 13.10.2004 600.00
its not getting perfectly alighned...plz read connid under connid field..
plz help me...
thank you..
2007 Oct 28 7:01 AM
Hi,
I think you can do it this way:
Get all the data which you need to display in an internal table.
Then loop at the table.
Use the At New CARRID event display the field carrid also in the record,else just display the records wihout the CARRID.
You can also use the ON CHANGE OF CARRID event.
Just try it.
Hope it works.
Thanks,
Sandeep.
2007 Oct 28 6:55 AM
Do something like this...
data : wa type itab.
select data from database table to internal table itab
<b>sort itab by carrid.</b>
Loop at itab into wa.
AT NEW carrid.
write : / wa-carrid.
ENDAT.
write : / wa-connid ,wa-fldate , wa-price.
endloop.
<b>Reward points if useful.</b>
Thanks & Regards
ilesh 24x7
2007 Oct 28 7:01 AM
Hi,
I think you can do it this way:
Get all the data which you need to display in an internal table.
Then loop at the table.
Use the At New CARRID event display the field carrid also in the record,else just display the records wihout the CARRID.
You can also use the ON CHANGE OF CARRID event.
Just try it.
Hope it works.
Thanks,
Sandeep.
2007 Oct 28 8:42 AM
Hi
Welcome to SDN forum
You can achieve this with the help of CONTROL BREAK statements of Internal Tables
see the following
All this AT NEW, AT FIRST, AT END OF and AT LAST are called control break statements of Internal tables and are used to calculate the TOTALS based on sertain key fields in that internal table
FIrst to use these statements the ITAB has to be sorted by the key fields on whcih you need the SUM of the fields.
Some time you will get * when moving data from this int table to other table using these commands
so you have to use
READ TABLE ITAB INDEX SY-TABIX in AT..ENDAT..if you are using other fields between them
DATA: sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate,
sflight_wa LIKE LINE OF sflight_tab.
SELECT *
FROM sflight
INTO TABLE sflight_tab.
sort sflight by carrid connid.
LOOP AT sflight_tab INTO sflight_wa.
AT NEW connid.
WRITE: / sflight_wa-carrid,
sflight_wa-connid.
ULINE.
ENDAT.
WRITE: / sflight_wa-fldate,
sflight_wa-seatsocc.
AT END OF connid.
SUM.
ULINE.
WRITE: / 'Sum',
sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
SKIP.
ENDAT.
AT END OF carrid.
SUM.
ULINE.
WRITE: / 'Carrier Sum',
sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
NEW-PAGE.
ENDAT.
AT LAST.
SUM.
WRITE: / 'Overall Sum',
sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
ENDAT.
ENDLOOP.
Regards
Anji
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |