Vous êtes sur la page 1sur 10

Student Name VU Student ID R/3 User Name Program Name Program Title : : :

Manimarpan Sasireka

0909D3VIS001 A-1010 : YA1010A2

Customer Bookings Report

PSEUDOCODE case country. when country when country when country when country when country when country when country endcase. = = = = = = = 'DE'. 'GB'. 'US'. 'CA'. 'FR'. 'AU'. 'NZ'. countryname countryname countryname countryname countryname countryname countryname = = = = = = = 'Germany'. 'Great Britain'. 'USA'. 'Canada'. 'France'. 'Australia'. 'New Zealand'.

Print page number Print system information - date, time, user Print table headings Start of Selection Select record from table: scustom where Country = country Sort by Customer Type, Customer Id Set customer book total to 0 Select records from table sbook where customer number = scustom customer number Add 1 to the customer book Endselect Total Customer = Total Customer + 1. Discount Total = Discount Total + scustom-discount. If Customer Book = 0 Set Total Book to Nil Else Set Customer Book to Total Book Endif Print customer details, customer book Endselect if scustom-custtype <> cut_type. cut_type = scustom-custtype. Print heading endif. if customer type = P cnt_type = 'PRT'. private total customer = private total customer + 1 else. cnt_type = 'BUS'. business total customer = business total customer + 1. endif. Select records from table sbook where customer id = scustom customer number Endselect Print customer details Endselect.

If no records found Print error stop Endif Print total number of Business customers Print total number of Private customers end-of-selection. Top of page during line-selection Print page number Print Customer Id, Customer name Print table headings at line-selection. Bookings_total = 0. Select record from table: sbook where Customer Id = scustom Customer Id sort by flight date Select single record from table: stravelag where Agency Number = sbook Agency Nu mber if sy-subrc = 0. itab-name = else. itab-name = endif. travel agency name. 'Unknown Agent'.

itab-fldate = sbook flight date. itab-bookid = sbook booking number itab-carrid = sbook carrier number itab-connid = sbook connection number itab-agencynum = sbook agency number sort itabflight by name. case sbook flight class. when 'F'. itab-fclass = 'FRST'. when 'C'. itab-fclass = 'BSNS'. when 'Y'. itab-fclass = 'ECON'. when others. itab-fclass = ' '. endcase. bookings_total = bookings_total + 1. append itab. endselect. loop at itab. Print customer book details endloop. If number of records in internal table = 0 Print message Print total number of Booking for the customer

PROGRAM CODE *&---------------------------------------------------------------------* *& Report YA1010A2 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT YA1010A2. tables: sbook, scustom, stravelag. constants: eol type i value 90. parameters: country like scustom-country default 'GB'. data: customer_book type i, total_customer type i, total_book type i, countryname(20) type c, Cut_type(1) TYPE c value 'B', CNT_type(4) TYPE c, pte_total type p value 0, bus_total type p value 0, bookings_total(2) type p value 0. data: begin of itab occurs 0, fldate like sbook-fldate, bookid like sbook-bookid, carrid like sbook-carrid, connid like sbook-connid, agencynum like sbook-agencynum, name like stravelag-name, fclass(4) type c, end of itab. CASE country. WHEN WHEN WHEN WHEN WHEN WHEN WHEN WHEN ENDCASE. top-of-page. format color col_heading. Write: /10 'Customer Bookings Report for ', countryname , 80 'Page ', sy-pagno. 'DE'. countryname = 'GB'. countryname = 'US'. countryname = 'CA'. countryname = 'FR'. countryname = 'AU'. countryname = 'NZ'. countryname = OTHERS. countryname 'Germany'. 'Great Britain'. 'USA'. 'Canada'. 'France'. 'Australia'. 'New Zealand'. ='Error in country code or invalid country code.'.

uline. format color col_normal. Write: / 'Run Date: ',sy-datum, 40 'At :',SY-UZEIT, 80 'By :',SY-UNAME. uline. write: / 'Customer', 15 'Name', 45 'Post', 55 'Post', 70 'City', 100 'Discount' , 122 'Num', at eol space. write: /4 'ID', 45 'Box', 55 'Code', 122 'Bkgs', at eol space. uline. skip 1. start-of-selection. format color col_heading. write : /' BUSINESS CUSTOMERS'. format reset. skip 1. select * from scustom where country = country order by custtype id. customer_book = 0. select * from sbook where customid = scustom-id. customer_book = customer_book + 1. endselect. total_customer = total_customer + 1. if customer_book = 0. move 'Nil' to bookings_total. else. move customer_book to total_book. endif. if scustom-custtype <> cut_type. cut_type = scustom-custtype. skip 1. format color col_heading. write : /' PRIVATE CUSTOMERS'. format reset. skip 1. endif. if scustom-custtype = 'P'. cnt_type = 'PV'. pte_total = pte_total + 1. else. cnt_type = 'BS'. bus_total = bus_total + 1. endif. select * from sbook where customid = scustom-id. endselect. write: /2 scustom-id, 15 scustom-name, 45 scustom-postbox, 55 scustom-postcode, 70 scustom-city, 99 scustom-discount,'%', 115 total_book, at 105(5) sy-dbcnt. hide: scustom-country, scustom-id, scustom-name.

cut_type = scustom-custtype. endselect. If sy-subrc > 0. write / 'No customer records found'. stop. endif. skip 1. uline. format write: write: format uline. color col_group. /10 'Total Business Customers : ', bus_total, 120 ' '. /10 'Total Private Customers : ', pte_total, 120 ' '. reset.

end-of-selection. top-of-page during line-selection. format color col_heading. write: /10 'Customer Flight Bookings', 68 'Page ', sy-pagno, 120 ' '. format reset. uline. format color col_negative. write: /10 'Flight Bookings for Customer ', 45 scustom-id: , 55 scustom-name, 12 0 ' '. format reset. skip. format write: Flight format uline. color col_positive inverse. /5 'Travel Agent', 35 'Flight Date', 50 'Bookings Id', 68 'Carrier', 85 ' No.', 106 'Class'. reset.

at line-selection. Bookings_total = 0. refresh itab. select * from sbook where customid = scustom-id order by fldate. select single * from stravelag where agencynum = sbook-agencynum. if sy-subrc = 0. itab-name = stravelag-name. else. itab-name = 'Unknown Agent'. endif. itab-fldate = sbook-fldate. itab-carrid = sbook-carrid. itab-connid = sbook-connid. itab-bookid = sbook-bookid. itab-agencynum = sbook-agencynum. sort itab by name. case sbook-class.

when when when when endcase.

'F'. itab-fclass = 'FRST'. 'C'. itab-fclass = 'BSNS'. 'Y'. itab-fclass = 'ECON'. others. itab-fclass = ' '.

bookings_total = bookings_total + 1. append itab. endselect. loop at itab. write: /05 itab-name, 32 sy-VLINE, 35 itab-fldate, 48 sy-VLINE, 53 itab-bookid, 63 sy-VLINE, 69 itab-carrid, 78 sy-VLINE, 85 itab-connid, 98 sy-VLINE, 107 itab -fclass. endloop. if sy-tabix = 0. write: /10 'No bookings for customer : ', scustom-id. else. uline. format color col_key. write: /25 'Total bookings for customer : ', 55 sy-dbcnt, 125 ' '. format reset. endif.

DOCUMENTATION Purpose The purpose of program to generate customer details for the user selected countr ies. It displays the business and private customer details and displays the tota l number of customers. List is order by the customer id. When the fist table dou ble clicked it display the flight booking details for the customer chosen and it 's provide the total number of records. Prerequisites This program used three tables. Those are scustom, sbook and stravelag. Output Tables are showing customer details and the booking details. Output display the report when user entry the wrong records. Output display the report when user en try the wrong records. The second table display the booking details. Activities Display the records. Calculate the number of bookings for customers.

OUTPUT Image: 1

Image: 2

Image: 3

Vous aimerez peut-être aussi