Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI FUNCTION MODULE

Former Member
0 Likes
606

Hai to all,

please explain about BAPI_FLIGHT_GETLIST

what it is and how to use it

please provide any example program on this function module

thanks and regards,

surya.

3 REPLIES 3
Read only

Former Member
0 Likes
524

This is for demo purpose by SAP, this BAPI gets the flight list refer sap code below and reward if helpful

  • retrieve flight list by BAPI call

call function 'BAPI_FLIGHT_GETLIST'

exporting

airline = airline

destination_from = destination_from

destination_to = destination_to

tables

date_range = date_range

flight_list = flight_list

return = ret_list.

Read only

0 Likes
524

Hi das,

if posiible please provide complete code.

regards,

surya.

Read only

Former Member
0 Likes
524

Hi,

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.

Thanks,

Anitha