Skip to Content
0
Sep 05, 2006 at 03:21 AM

No Result with REUSE_ALV_LIST_DISPLAY

28 Views

Hi all,

I was not able to display my table, f_flight_list after i retrieve the records using BAPI 'BAPI_FLIGHT_GETLIST'.

I tried to display only 4 fields by assigning airline,flightdate,cityto and cityfrom into f_detail2 but it still does not work.

What is wrong with the code? I have also specified IT_FIELDCAT and t_outtab.

This is the code:

parameters:

airlines like BAPISFLDAT-AIRLINEID.

type-pools: slis.

Data:

f_airline like BAPISFLKEY-AIRLINEID,

f_flight_list like table of BAPISFLDAT,

line

f_detail like line of f_flight_list,

  • use f_detail2 to see the table in alv

begin of f_detail2 occurs 0,

airline like BAPISFLKEY-AIRLINEID,

flightdate like BAPISFLDAT-flightdate,

cityto like BAPISFLDAT-cityto,

cityfrom like BAPISFLDAT-cityfrom,

end of f_detail2.

*table of f_detail2

data:

display_flight like table of f_detail2,

*Define the field catalog

afield type slis_fieldcat_alv,

fieldcat type slis_t_fieldcat_alv.

line

*f_detail like line of f_flight_list.

clear afield.

f_airline = airlines.

call function 'BAPI_FLIGHT_GETLIST'

exporting

airline = f_airline

tables

flight_list = f_flight_list.

if sy-subrc ne 0.

write 'error changing order'.

else.

  • output detail using line *

  • Use List Display to display search result

loop at f_flight_list into f_detail.

f_detail2-airline = f_detail-airline.

f_detail2-flightdate = f_detail-flightdate.

f_detail2-cityto = f_detail-cityto.

f_detail2-cityfrom = f_detail-cityfrom.

append f_detail2 to display_flight.

  • write f_detail2-airline.

endloop.

afield-fieldname = 'airline'.

afield-reptext_ddic = 'airline'.

afield-tabname = 'display_flight'.

append afield to fieldcat.

clear afield.

afield-fieldname = 'flightdate'.

afield-reptext_ddic = 'flightdate'.

afield-tabname = 'display_flight'.

append afield to fieldcat.

clear afield.

afield-fieldname = 'cityto'.

afield-reptext_ddic = 'city to'.

afield-tabname = 'display_flight'.

append afield to fieldcat.

clear afield.

afield-fieldname = 'cityfrom'.

*afield-reptext_ddic = 'city from'.

afield-tabname = 'display_flight'.

*append afield to fieldcat.

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

IT_FIELDCAT = fieldcat

i_callback_program = sy-repid

tables

t_outtab = display_flight

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.

endif.