Professional Documents
Culture Documents
ABAP Final Project
ABAP Final Project
Final project
Samuel Matthews
200803747
April 21, 2013
Internal Tables
*&---------------------------------------------------------------------*
*& Report Z27FINAL_PROJECT_PROG1
*&
*&---------------------------------------------------------------------*
*&Author: Samuel Matthews
*&Date: April 21st 2013
*&Description: This program will show the parts table and its information.
*&---------------------------------------------------------------------*
REPORT
constants
Re-Point
constants
constants
constants
constants
constants
constants
constants
start-of-selection.
perform get_data.
perform write_data.
top-of-page.
perform write_header.
end-of-page.
perform write_footer.
end-of-selection.
perform write_summary.
at line-selection.
perform line_details.
form get_data.
select Z27PART~part_id Z27PART~part_desc Z27PART~reord_pnt Z27PART~reord_qu
ant Z27PART~loc_id
Z27WSLOC~LOC_WARE Z27WSLOC~LOC_AISLE Z27WSLOC~LOC_SHELF Z27WSLOC~LOC
_BIN
into table itab_part_data
from Z27WSLOC join Z27PART
on Z27WSLOC~LOC_ID = Z27PART~LOC_ID.
endform.
form write_header.
write 2 con_head.
uline (107).
endform.
form write_data.
loop at itab_part_data into wa_part_data.
add 1 to data_part_counter.
format color 3.
write: / '|', wa_part_data-PART_ID,
10 '|', wa_part_data-PART_DESC,
40 '|', wa_part_data-REORD_PNT,
70 '|', wa_part_data-REORD_QUANT,
100 '|', wa_part_data-LOC_ID,
107 '|'.
format color off.
hide: wa_part_data-LOC_WARE, wa_part_data-LOC_AISLE, wa_part_dataLOC_SHELF, wa_part_data-LOC_BIN.
endloop.
endform.
form write_footer.
uline.
endform.
form write_summary.
uline .
skip 1.
write: con_total_part, data_part_counter.
endform.
form line_details.
if sy-lsind = 1.
uline 90(35).
write: /, 90 con_subscreen_title.
skip 1.
uline 90(35).
write: /, 90 con_ware, wa_part_data-LOC_ware,
/, 90 con_aisle, wa_part_data-LOC_AISLE,
/, 90 con_shelf, wa_part_data-LOC_SHELF,
/, 90 con_bin, wa_part_data-LOC_BIN.
skip 1.
uline 90(35).
endif.
if sy-lsind = 2.
MESSAGE e000(/bev1/emc) WITH con_drill_error.
endif.
ENDFORM.
*&---------------------------------------------------------------------*
*& Report Z27FINAL_PROJECT_PROG2
*&
*&---------------------------------------------------------------------*
*&Author: Samuel Matthews
*&Date: April 21st 2013
*&Description: This program will display the quality of the suppliers.
*&---------------------------------------------------------------------*
REPORT
Z27FINAL_PROJECT_PROG2.
data_part_counter(3) type p.
TOTAL_BAD_PARTS_COUNTER(3) TYPE P.
MI_BAD_PARTS(3) type p.
IO_BAD_PARTS(3) type p.
TT_BAD_PARTS(3) type p.
BP_BAD_PARTS(3) type p.
DATA
DATA
DATA
DATA
MI_COUNTER(3)
IO_COUNTER(3)
TT_COUNTER(3)
BP_COUNTER(3)
type
type
type
type
p.
p.
p.
p.
constants
constants
constants
constants
Cost
Del S
endform.
FORM SORTER.
CASE 'X'.
WHEN SORT_PART.
PERFORM GET_DATA_PART.
WHEN SORT_SUPL.
PERFORM GET_DATA_SUPL.
WHEN SORT_COST.
PERFORM GET_DATA_COST.
ENDCASE.
ENDFORM.
form get_data_part.
select Z27PART~part_id Z27PART~part_desc Z27PTQUAL~Cost Z27PTQUAL~DEL_QUAL
Z27PTQUAL~SPEC_QUAL
WHEN con_BP.
IF wa_SUPPLY_DATA-del_qual < 5 or wa_SUPPLY_DATA-spec_qual < 5 or
wa_SUPPLY_DATA-defect_rate < 5.
Add 1 to BP_Bad_Parts.
endif.
ADD 1 to BP_counter.
BP_DEL = BP_DEL + wa_SUPPLY_DATA-del_qual.
BP_SPEC = BP_SPEC + wa_SUPPLY_DATA-SPEC_qual.
BP_DFEC = BP_DFEC + wa_SUPPLY_DATA-DEFECT_RATE.
ENDCASE.
endloop.
endform.
form CALC_AVERAGE.
AVG_DEL_MI = MI_DEL / MI_COUNTER.
AVG_SPEC_MI = MI_SPEC / MI_COUNTER.
AVG_DFEC_MI = MI_DFEC / MI_COUNTER.
AVG_DEL_IO = IO_DEL / IO_COUNTER.
AVG_SPEC_IO = IO_SPEC / IO_COUNTER.
AVG_DFEC_IO = IO_DFEC / IO_COUNTER.
AVG_DEL_TT = TT_DEL / TT_COUNTER.
AVG_SPEC_TT = TT_SPEC / TT_COUNTER.
AVG_DFEC_TT = TT_DFEC / TT_COUNTER.
AVG_DEL_BP = BP_DEL / BP_COUNTER.
AVG_SPEC_BP = BP_SPEC / BP_COUNTER.
AVG_DFEC_BP = BP_DFEC / BP_COUNTER.
TOTAL_BAD_PARTS_COUNTER =
BAD_PARTS.
ENDFORM.
form write_summary.
skip 1.
uline .
write con_sum_info.
FORMAT COLOR 1.
skip 1.
write con_sup1.
skip 1.
write: con_bad_parts, MI_BAD_PARTS, con_del_avg, AVG_DEL_MI, con_spec_avg,
avg_spec_mi, con_def_avg, avg_dfec_mi.
FORMAT COLOR OFF.
FORMAT COLOR 3.
skip 1.
write con_sup2.
skip 1.
write: con_bad_parts, IO_BAD_PARTS, con_del_avg, AVG_DEL_IO, con_spec_avg,
avg_spec_IO, con_def_avg, avg_dfec_IO.
FORMAT COLOR OFF.
FORMAT COLOR 1.
skip 1.
write con_sup3.
skip 1.
write: con_bad_parts, TT_BAD_PARTS, con_del_avg, AVG_DEL_TT, con_spec_avg,
avg_spec_TT, con_def_avg, avg_dfec_TT.
FORMAT COLOR OFF.
FORMAT COLOR 3.
skip 1.
write con_sup4.
skip 1.
write: con_bad_parts, BP_BAD_PARTS, con_del_avg, AVG_DEL_BP, con_spec_avg,
avg_spec_BP, con_def_avg, avg_dfec_BP.
FORMAT COLOR OFF.
ULINE.
endform.
*&---------------------------------------------------------------------*
*& Report Z27FINAL_PROJECT_PROG3
*&
*&---------------------------------------------------------------------*
*&Author: Samuel Matthews
*&Date: April 21st 2013
*&Description: This program will show defective suppliers and their
*& contact information.
*&---------------------------------------------------------------------*
REPORT
Z27FINAL_PROJECT_PROG3.
CONSTANTS con_head(58)
TYPE C VALUE 'SupplierID PartID
Cost
DEL
SPEC
DEFECT'.
CONSTANTS con_message(40)
TYPE C VALUE 'Data successfully sent to exte
rnal file.'.
CONSTANTS con_error_message(289) TYPE C VALUE 'cannot drilldown any futher.'.
constants
on'.
CONSTANTS
CONSTANTS
CONSTANTS
CONSTANTS
CONSTANTS
CONSTANTS
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
C
C
C
C
C
C
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
Supplier Informati
'Supplier Name:
'.
'Contact First Name:'.
'Contact Last Name: '.
'Email:
'.
'City:
'.
'State:
'.
CONSTANTS con_country(19)
CONSTANTS con_code(19)
CONSTANTS con_def(3)
CONSTANTS con_and(3)
'.
'.
START-OF-SELECTION.
CALL SCREEN 200.
PERFORM get_data.
IF sy-ucomm = con_def OR sy-ucomm = con_and.
WRITE con_head.
PERFORM write_data.
ENDIF.
IF sy-ucomm = con_and.
PERFORM write_to_external_file.
ENDIF.
AT LINE-SELECTION.
PERFORM supplier_details.
FORM get_data.
SELECT z27ptqual~supl_id z27ptqual~part_id z27ptqual~cost z27ptqual~del_qua
l z27ptqual~spec_qual z27ptqual~defect_rate
z27supdtl~supl_nam z27supdtl~con_fnam z27supdtl~con_lnam z27supdtl~e
mail z27supdtl~city z27supdtl~state z27supdtl~country z27supdtl~code
INTO TABLE itab_supply_data
FROM z27supdtl JOIN z27ptqual
ON z27ptqual~supl_id = z27supdtl~supl_id.
ENDFORM.
FORM write_data.
LOOP AT itab_supply_data INTO wa_supply_data.
IF wa_supply_data-del_qual < 5 OR wa_supply_dataspec_qual < 5 OR wa_supply_data-defect_rate < 5.
FORMAT COLOR 6.
WRITE: / '|', wa_supply_data-supl_id,
10 '|', wa_supply_data-part_id,
20 '|', wa_supply_data-cost,
30 '|', wa_supply_data-del_qual,
40 '|', wa_supply_data-spec_qual,
50 '|', wa_supply_data-defect_rate,
60 '|'.
FORMAT COLOR OFF.
ELSE.
WRITE: / '|', wa_supply_data-supl_id,
10 '|', wa_supply_data-part_id,
20 '|', wa_supply_data-cost,
30 '|', wa_supply_data-del_qual,
40 '|', wa_supply_data-spec_qual,
50 '|', wa_supply_data-defect_rate,
60 '|'.
ENDIF.
HIDE: wa_supply_data-supl_nam, wa_supply_data-con_fnam, wa_supply_datacon_lnam, wa_supply_data-email, wa_supply_data-city, wa_supply_datastate, wa_supply_data-country, wa_supply_data-code.
ENDLOOP.
ENDFORM.
FORM write_to_external_file.
CONSTANTS supplier_file(12) TYPE c VALUE 'supplier.dat'.
OPEN DATASET supplier_file FOR OUTPUT IN BINARY MODE.
LOOP AT itab_supply_data INTO wa_supply_data.
TRANSFER wa_supply_data TO supplier_file.
MESSAGE s000(/ain/actvt_helper) WITH con_message.
ENDLOOP.
CLOSE DATASET supplier_file.
ENDFORM.
FORM supplier_details.
IF sy-lsind = 1.
ULINE (50).
skip 1.
write con_supplier_info.
skip 1.
uline (50).
WRITE: /, con_supl_name, wa_supply_data-supl_nam,
/, con_con_fname, wa_supply_data-con_fnam,
/, con_con_lname, wa_supply_data-con_lnam,
/, con_email, wa_supply_data-email,
/, con_city, wa_supply_data-city,
/, con_state, wa_supply_data-state,
/, con_country, wa_supply_data-country,
/, con_code, wa_supply_data-code.
SKIP 1.
ULINE (50).
ENDIF.
IF sy-lsind = 2.
Program 3 Summary
My program has two push buttons. One is to Display the defect report and the other is to
display the defects and send the data to an external file. When you push the display defect
report button. This table will display the supplier ID, part ID, cost, delivery quality, specification
quality, and defects. It will also display all of the parts and highlight the ones in red that have
defects below the level of five. The rest will remain un-highlighted similar to how program 2
operates.
This report is useful for the reason that you are able to see the quality of what your
suppliers are selling to you. The second level of this output screen when you drill down is all of
the suppliers contact information. This is also useful so that once you have singled out the
suppliers that are not providing products of acceptable quality you will be able to look up the
contact person, their name, email and address of the company. If you try to drill down any
further you will be greeted an error message telling you that you cannot do so.
If you push on the second button labeled display defects and send file you will be greeted
with a system message telling you that the data has been successfully sent to the external file.
After pressing this button you still have the drill-down capability and the safe guard against
drilling down too far. This program is very useful in the area of quality assurance. As you can
see from my coding this program also uses many ABAP concepts such as custom input screen,
Open SQL, External files, Forms, and Events.