版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、*&-*& report sapbc400cid_code_inspector_1 *&-*& *& this program contains some bad programming techniques *& that should be found by the code inspector . *& *&-* is this ok ?report my_program.* selection text ?parameters pa_carr type s_carr_id.data wa_conn type sdyn_conn.* what is missing here ?autho
2、rity-check object s_carrid id carrid field pa_carr id actvt field 03.select * from spfli into corresponding fields of wa_conn where carrid = pa_carr.* performance ? select single carrname from scarr into wa_conn-carrname where carrid = wa_conn-carrid. write: / wa_conn-carrname, wa_conn-carrid, wa_co
3、nn-connid, wa_conn-cityfrom, wa_conn-cityto, wa_conn-deptime, wa_conn-arrtime.endselect.* is this ok ?break-point.if sy-subrc ne 0.* translation ? write no connections found !.endif.*&-*& report sapbc400cid_code_inspector_2 *&-*& *& corrected version of sapbc400cid_code_inspector_1 *& *&-*report sap
4、bc400cid_code_inspector_2 .parameters pa_carr type s_carr_id.data wa_conn type sdyn_conn.authority-check object s_carrid id carrid field pa_carr id actvt field 03.if sy-subrc ne 0. write authority check failed !(acf). exit.endif.select * from bc400_cisd_fli select from a buffered view into correspon
5、ding fields of wa_conn where carrid = pa_carr. write: / wa_conn-carrname, wa_conn-carrid, wa_conn-connid, wa_conn-cityfrom, wa_conn-cityto, wa_conn-deptime, wa_conn-arrtime.endselect.if sy-subrc ne 0. write no connections found !(ncf).endif.*&-*& report sapbc400ddd_array_fetch *&-*& *& reading one d
6、atabase table via array fetch (select . into table) *& *&-*report sapbc400ddd_array_fetch.data: itab_spfli type sbc400_t_spfli, wa_spfli like line of itab_spfli.select carrid connid airpfrom cityfrom countryfr airpto cityto countryto deptime from spfli into corresponding fields of table itab_spfli.l
7、oop at itab_spfli into wa_spfli. write: / wa_spfli-carrid, wa_spfli-connid, wa_spfli-airpfrom, wa_spfli-cityfrom, wa_spfli-countryfr, wa_spfli-airpto, wa_spfli-cityto, wa_spfli-countryto, wa_spfli-deptime.endloop.*&-*& report sapbc400ddd_select_endselect *&-*& *& reading one database table via selec
8、t . endselect. *& *&-*report sapbc400ddd_select_endselect.parameters pa_car type s_carr_id.data wa_sbc400focc type sbc400focc.select carrid connid fldate seatsmax seatsocc from sflight into wa_sbc400focc where carrid = pa_car. wa_sbc400focc-percentage = wa_sbc400focc-seatsocc * 100 / wa_sbc400focc-s
9、eatsmax. write: / wa_sbc400focc-carrid, wa_sbc400focc-connid, wa_sbc400focc-fldate, wa_sbc400focc-seatsmax, wa_sbc400focc-seatsocc, wa_sbc400focc-percentage, %.endselect.*&-*& report sapbc400ddd_select_inner_join *&-*& *& read data from two database tables via apab inner join : *& *& select . from .
10、 inner join . *& *&-*report sapbc400ddd_select_inner_join .types: begin of wa_type, carrid type scarr-carrid, carrname type scarr-carrname, connid type spfli-connid, airpfrom type spfli-airpfrom, cityfrom type spfli-cityfrom, countryfr type spfli-countryfr, airpto type spfli-airpto, cityto type spfl
11、i-cityto, countryto type spfli-countryto, deptime type spfli-deptime, end of wa_type.data wa_join type wa_type.* selecting from inner join (to avoid nested select loops)select scarrcarrid scarrcarrname spfliconnid spfliairpfrom spflicityfrom spflicountryfr spfliairpto spflicityto spflicountryto spfl
12、ideptime into corresponding fields of wa_join from scarr inner join spfli on scarrcarrid = spflicarrid. write: / wa_join-carrid, wa_join-carrname, wa_join-connid, wa_join-airpfrom, wa_join-cityfrom, wa_join-countryfr, wa_join-airpto, wa_join-cityto, wa_join-countryto, wa_join-deptime.endselect.*&-*&
13、 report sapbc400ddd_select_single *&-*& *& reading single entry from database : select single *& *&-*report sapbc400ddd_select_single .parameters pa_car type s_carr_id.data wa_scarr type scarr.select single * from scarr into corresponding fields of wa_scarr where carrid = pa_car.if sy-subrc = 0. wri
14、te: / wa_scarr-carrid, wa_scarr-carrname, wa_scarr-currcode.else . write: / text-001 color col_negative.endif.*&-*& report sapbc400ddd_select_view *&-*& *& *&-*report sapbc400ddd_select_view .parameters pa_anum type s_agncynum.data wa_sbc400_booking type sbc400_booking.select mandt carrid connid fld
15、ate bookid customid class name street city country agencynum from sbc400_booking into wa_sbc400_booking where agencynum = pa_anum. write: / wa_sbc400_booking-carrid, wa_sbc400_booking-connid, wa_sbc400_booking-fldate, wa_sbc400_booking-bookid, wa_sbc400_booking-customid, wa_sbc400_booking-class, wa_
16、sbc400_booking-name, wa_sbc400_booking-street, wa_sbc400_booking-city, wa_sbc400_booking-country, wa_sbc400_booking-agencynum.endselect.*&-*& report sapbc400dds_authority_check *&-*report sapbc400dds_authority_check.constants actvt_display type activ_auth value 03.data wa_flight type sbc400focc.para
17、meters pa_car type s_carr_id.* check if user is authorized to read data of the specified carrierauthority-check object s_carrid id carrid field pa_car id actvt field actvt_display.case sy-subrc. when 0. user is authorized select carrid connid fldate seatsmax seatsocc from sflight into corresponding
18、fields of wa_flight where carrid = pa_car. wa_flight-percentage = 100 * wa_flight-seatsocc / wa_flight-seatsmax. write: / wa_flight-carrid color col_key, wa_flight-connid color col_key, wa_flight-fldate color col_key, wa_flight-seatsocc, wa_flight-seatsmax, wa_flight-percentage, %. endselect. if sy-
19、subrc ne 0. write: no , pa_car, flights found !. endif. when others. user is not authorized write: / authority-check error(001).endcase.*&-*& report sapbc400dds_authority_check_2 *&-*report sapbc400dds_authority_check_2.constants actvt_display type activ_auth value 03.data: it_flight type sbc400_t_s
20、bc400focc, wa_flight like line of it_flight.parameters pa_car type s_carr_id.* check if user is authorized to read data of the specified carrier ?authority-check object s_carrid id carrid field pa_car id actvt field actvt_display.case sy-subrc. when 0. user is authorized select carrid connid fldate
21、seatsmax seatsocc from sflight into corresponding fields of wa_flight where carrid = pa_car. wa_flight-percentage = 100 * wa_flight-seatsocc / wa_flight-seatsmax. append wa_flight to it_flight. endselect. if sy-subrc = 0. sort it_flight by percentage. loop at it_flight into wa_flight. write: / wa_fl
22、ight-carrid color col_key, wa_flight-connid color col_key, wa_flight-fldate color col_key, wa_flight-seatsocc, wa_flight-seatsmax, wa_flight-percentage, %. endloop. else. write: no , pa_car, flights found !. endif. when others. user is not authorized write: / authority-check error(001).endcase.*&-*&
23、 report sapbc400dds_select_array_fetch *&-*report sapbc400dds_select_array_fetch.data: it_flight type sbc400_t_sbc400focc, wa_flight like line of it_flight.parameters pa_car type s_carr_id.*-* - use array fetch to fill internal table * - loop at internal table to set the percentage value of each row
24、 * - sort and list internal table *-select carrid connid fldate seatsmax seatsocc from sflight into corresponding fields of table it_flight where carrid = pa_car.if sy-subrc = 0. loop at it_flight into wa_flight. wa_flight-percentage = 100 * wa_flight-seatsocc / wa_flight-seatsmax. modify it_flight
25、from wa_flight index sy-tabix transporting percentage. endloop. sort it_flight by percentage. loop at it_flight into wa_flight. write: / wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsocc, wa_flight-seatsmax, wa_flight-percentage, %. endloop.else. write: no , pa_car, flights fo
26、und !.endif.*&-*& report sapbc400dds_select_sflight *&-*& solution for exercise reading data from one database table *&-*report sapbc400dds_select_sflight.parameters pa_car type s_carr_id.data wa_flight type sbc400focc.* select all flights belonging to carrier specified in pa_car :select carrid conn
27、id fldate seatsmax seatsocc from sflight into corresponding fields of wa_flight where carrid = pa_car.* calculate occupation of the current flight wa_flight-percentage = 100 * wa_flight-seatsocc / wa_flight-seatsmax.* create list write: / wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flig
28、ht-seatsmax, wa_flight-seatsocc, wa_flight-percentage, %.endselect.if sy-subrc ne 0. write: no , pa_car, flights found !.endif.*&-*& report sapbc400dds_select_sflight_tab *&-*report sapbc400dds_select_sflight_tab .data: it_flight type sbc400_t_sbc400focc, wa_flight like line of it_flight.parameters
29、pa_car type s_carr_id.* select all flights belonging to carrier specified in pa_car :select carrid connid fldate seatsmax seatsocc from sflight into corresponding fields of wa_flight where carrid = pa_car.* calculate occupation of flight wa_flight-percentage = 100 * wa_flight-seatsocc / wa_flight-se
30、atsmax.* insert flight into internal table insert wa_flight into table it_flight.* (if you are using standard tables, append wa_flight to it_flight.* would be the same as the above insert-statement.)endselect.if sy-subrc = 0.* sort internal table sort it_flight by percentage.* create list loop at it
31、_flight into wa_flight. write: / wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsocc, wa_flight-seatsmax, wa_flight-percentage, %. endloop.else. write: no , pa_car, flights found !.endif.*&-*& report sapbc400ias_ewt *&-*report sapbc400ias_ewt .data gdt_spfli type sbc400_t_spfli.
32、data ok_code like sy-ucomm.data: container_r type ref to cl_gui_custom_container, grid_r type ref to cl_gui_alv_grid.start-of-selection.* fill internal table select * from spfli into table gdt_spfli.* where . call screen 100.*&-*& module user_command_0100 input*&-* text*-*module user_command_0100 in
33、put. case ok_code. when back. set screen 0. when exit. leave program. endcase.endmodule. user_command_0100 input*&-*& module status_0100 output*&-* text*-*module status_0100 output. set pf-status status_100.* set titlebar xxx.endmodule. status_0100 output*&-*& module create_control output*&-* text*-
34、*module create_control output. if container_r is initial. create object container_r exporting container_name = container_1. create object grid_r exporting i_parent = container_r. call method grid_r-set_table_for_first_display exporting i_structure_name = spfli changing it_outtab = gdt_spfli. else. call method grid_r-refresh_table_di
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 廣東科貿(mào)職業(yè)學(xué)院《信號(hào)檢測(cè)與估計(jì)》2023-2024學(xué)年第一學(xué)期期末試卷
- 廣東交通職業(yè)技術(shù)學(xué)院《鋼筋混凝土結(jié)構(gòu)設(shè)計(jì)原理》2023-2024學(xué)年第一學(xué)期期末試卷
- 廣東技術(shù)師范大學(xué)《生物化學(xué)及實(shí)驗(yàn)》2023-2024學(xué)年第一學(xué)期期末試卷
- 廣東海洋大學(xué)《平面鋼筋識(shí)圖》2023-2024學(xué)年第一學(xué)期期末試卷
- 廣東工商職業(yè)技術(shù)大學(xué)《空間設(shè)計(jì)》2023-2024學(xué)年第一學(xué)期期末試卷
- 廣東潮州衛(wèi)生健康職業(yè)學(xué)院《化工制圖》2023-2024學(xué)年第一學(xué)期期末試卷
- 品德假期安全生活課件
- 小學(xué)生竇娥的課件
- 廣安職業(yè)技術(shù)學(xué)院《英語(yǔ)(二)》2023-2024學(xué)年第一學(xué)期期末試卷
- 贛州職業(yè)技術(shù)學(xué)院《組織行為學(xué)A》2023-2024學(xué)年第一學(xué)期期末試卷
- 2024年時(shí)事政治試題【有答案】
- 2024年信息系統(tǒng)項(xiàng)目管理師(綜合知識(shí)、案例分析、論文)合卷軟件資格考試(高級(jí))試題與參考答案
- 2024年認(rèn)證行業(yè)法律法規(guī)及認(rèn)證基礎(chǔ)知識(shí)
- MT 285-1992縫管錨桿
- GB 18613-2020 電動(dòng)機(jī)能效限定值及能效等級(jí)
- 沉井工程檢驗(yàn)批全套【精選文檔】
- 貝類增養(yǎng)殖考試資料
- 旅游專業(yè)旅游概論試題有答案
- 3、起重工、焊工、電工安全技術(shù)交底
- 水稻幼穗分化八個(gè)時(shí)期的劃分表
- 卡特彼勒生產(chǎn)體系手冊(cè)(PDF62頁(yè))
評(píng)論
0/150
提交評(píng)論