Skip to Content
0
Former Member
Feb 08, 2011 at 07:50 AM

Query Result Doesn't Display

18 Views

Hi All,

When i run the code below the query with SELECT statement display result as expected but other queries with LOOP and Object oriented running againt same table as that used in SELECT statement doesn't show anything, not even the output page. The status bar only showed the the program has complied without syntax error but no output page.

Please I need somebody to tell me why is the output not showing.

REPORT read_table_flights.

DATA: itab_flight TYPE STANDARD TABLE OF sflight,

wa_flight TYPE sflight,

alv TYPE REF TO cl_salv_table.

FIELD-SYMBOLS: <wa_comp> TYPE any.

SELECT *

FROM sflight INTO TABLE itab_flight

WHERE carrid = 'LH' AND seatsmax < 250 .

  • Alternative one: Loop at table and write the different components of work area

LOOP AT itab_flight INTO wa_flight.

WRITE: wa_flight-carrid,

wa_flight-connid,

wa_flight-fldate,

wa_flight-price,

wa_flight-currency,

wa_flight-planetype,

wa_flight-seatsmax,

wa_flight-seatsocc,

wa_flight-paymentsum.

skip.

endloop.

**Alternative two: Loop at table with dynamic assign of component

*LOOP AT itab_flight INTO wa_flight.

  • DO.

  • ASSIGN COMPONENT sy-index OF STRUCTURE wa_flight TO <wa_comp>.

  • IF sy-subrc <> 0.

  • SKIP.

  • EXIT.

  • ENDIF.

  • WRITE <wa_comp>.

  • ENDDO.

*ENDLOOP.

  • object oriented way

*cl_salv_table=>factory( IMPORTING r_salv_table = alv

  • CHANGING t_table = itab_flight ).

*alv->display( ).