*&---------------------------------------------------------------------*
*& Report FLIGHT_MODEL_DATA_GENERATOR *
*& *
*&---------------------------------------------------------------------*
*& This report generates standard entries in all *
*& database tables that are specified below *
*&---------------------------------------------------------------------*
REPORT flight-model_data_generator LINE-SIZE 250.
*-----------------------------------------------------------------------
* data definitions
*-----------------------------------------------------------------------
*-----------------------------------------------------------------------
* used database tables
*-----------------------------------------------------------------------
TABLES: scarr, spfli, sflight, saplane, sgeocity, sairport,
scustom, sbook, scurx, scurr, sbuspart, scounter,
bfuser_typ.
*-----------------------------------------------------------------------
* global constants
*-----------------------------------------------------------------------
* conversion factor miles - > km
CONSTANTS: mifactor(3) TYPE p DECIMALS 2 VALUE '1.6'.
* threshold for random numbers. If number lower ...
CONSTANTS: limit_cancelled TYPE i VALUE 20, " ... booking cancelled
limit_counter TYPE i VALUE 40, " ... booking via counter
limit_smoker TYPE i VALUE 30, " ... smoker
limit_invoice TYPE i VALUE 90. " ... invoice sent
*-----------------------------------------------------------------------
* definition of global data fields
*-----------------------------------------------------------------------
DATA: fldate TYPE d.
DATA price LIKE sflight-price.
DATA counter TYPE i.
DATA distance LIKE spfli-distance.
DATA date TYPE d.
DATA date_flag.
*
* counter
*
DATA counter1 TYPE i.
DATA counter2 TYPE i.
DATA counter3 TYPE i.
DATA counter4 TYPE i.
DATA counter5 TYPE i.
DATA counter6 TYPE i.
DATA anz_count TYPE i.
DATA idx_count TYPE i.
*
* auxiliary fields
*
DATA max_count TYPE i.
DATA loop_count TYPE i.
DATA order_date TYPE d.
DATA pay TYPE p DECIMALS 2.
DATA book_count TYPE i.
DATA curr_date TYPE d.
DATA paymentsum TYPE p DECIMALS 2.
DATA read_idx LIKE sy-tabix.
DATA random_index LIKE sy-index.
DATA: counter_per_airport TYPE i,
max_per_airport TYPE i.
DATA: agency_index LIKE sy-index,
max_agency_index LIKE sy-index.
*
DATA: conversion_counter_1 TYPE i,
conversion_counter_2 TYPE i,
conversion_counter_3 TYPE i.
DATA: l_answer TYPE c. "answer field for POPUP_TO_CONFIRM
*-----------------------------------------------------------------------
* definition of the internal tables which are
* used to fill the database tables
*
* names for internal tables:
* name of the internal table = i<dbtab_name>
* <dbtab_name> = name of database table
*-----------------------------------------------------------------------
DATA: iscurx LIKE STANDARD TABLE OF scurx
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: iscurr LIKE STANDARD TABLE OF scurr
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: iscarr LIKE STANDARD TABLE OF scarr
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: isgeocity LIKE STANDARD TABLE OF sgeocity
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: isairport LIKE STANDARD TABLE OF sairport
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: isaplane LIKE STANDARD TABLE OF saplane
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: iscarplan LIKE STANDARD TABLE OF scarplan
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: iscitairp LIKE STANDARD TABLE OF scitairp
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: isbuspart LIKE STANDARD TABLE OF sbuspart
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: iscustom LIKE STANDARD TABLE OF scustom
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: istravelag LIKE STANDARD TABLE OF stravelag
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: iscounter LIKE STANDARD TABLE OF scounter
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: ismeal LIKE STANDARD TABLE OF smeal
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: ismenu LIKE STANDARD TABLE OF smenu
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: ispfli LIKE STANDARD TABLE OF spfli
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: isflight LIKE STANDARD TABLE OF sflight
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: isflimeal LIKE STANDARD TABLE OF sflimeal
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: isbook LIKE STANDARD TABLE OF sbook
WITH DEFAULT KEY
WITH HEADER LINE.
*-----------------------------------------------------------------------
* auxiliary tables for currency conversion rates
*-----------------------------------------------------------------------
DATA: hscurr LIKE STANDARD TABLE OF scurr "Initial data for iscurr
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: hcurr1 LIKE STANDARD TABLE OF scurx "help array with currcodes
WITH DEFAULT KEY
WITH HEADER LINE.
DATA: hcurr2 LIKE STANDARD TABLE OF scurx "help array with currcodes
WITH DEFAULT KEY
WITH HEADER LINE.
DATA help_ukurs LIKE scurr-ukurs."help field for currency conv. factors
*-----------------------------------------------------------------------
* data definition of auxiliary fields to fill isgeocity
*-----------------------------------------------------------------------
TYPES: degree(3) TYPE c,
minute(2) TYPE c,
orient(1) TYPE c.
DATA: BEGIN OF i_h_geo OCCURS 0,
city LIKE sgeocity-city, " city
country LIKE sgeocity-country, " country
lat_deg TYPE degree, " langitude degrees
lat_min TYPE minute, " langitude minutes
lat_ori TYPE orient, " langitude orientation: N, W
lon_deg TYPE degree, " latitude degrees
lon_min TYPE minute, " latitude minutes
lon_ori TYPE orient, " latitude orientation: S, E
END OF i_h_geo.
* help table to fill sbispart: contains numbers of travel agencies
DATA: BEGIN OF help_num OCCURS 30,
num LIKE sbuspart-buspartnum,
END OF help_num.
*-----------------------------------------------------------------------
* data definition of auxiliary fields to fill the table sbook
*-----------------------------------------------------------------------
DATA: number TYPE i OCCURS 0 WITH HEADER LINE.
DATA: anz TYPE i OCCURS 0 WITH HEADER LINE.
DATA: idx TYPE i OCCURS 0 WITH HEADER LINE.
DEFINE a. "scustom-ids
number = &1. append number.
number = &2. append number.
number = &3. append number.
number = &4. append number.
number = &5. append number.
number = &6. append number.
number = &7. append number.
number = &8. append number.
number = &9. appen