*&---------------------------------------------------------------------*
*& Report ZVVF_MMRO_QUALITYFORGR *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
*-------------------------------------------------------------*
* GR QUALITY REPORT
*-------------------------------------------------------------*
* 1. Functional area : MM
*--------------------------------------------------------------*
* GR Quality Report
*--------------------------------------------------------------*
*--------------------------------------------------------------*
* MODULE : MM .
*--------------------------------------------------------------*
* Title
* -----
* Quality Inspection for given plant within given date
* range.
*--------------------------------------------------------------*
* Description
* -----------
*This report gives full detail of Quality Inspection.
*Here user may enter Plant, Material, Vendor, Broker , Purchase order
*no. Material Document No. Inspection Lot No. and Date.
*According to the user input the report gathers all the data.
*While showing output for each material document this report
*shows Plant, Material, Vendor Code, Broker Code, Material Document
*No. , Truck No. , GR Date , Truck reporting Date, Material Description,
*Vendor Description, Broker Description.
*Then for each Material Document it finds corresponding Inspection Lot
*No. , GR Quantity, Challan Quantity, Quality Parameter Description
*and its value.
*--------------------------------------------------------------*
* Amendent History
*--------------------------------------------------------------*
* Who/Date Reason
*
*
*--------------------------------------------------------------*
* Transaction Code : zgrquality
*--------------------------------------------------------------*
REPORT ZVVF_MMRO_QUALITYFORGR
no standard page heading
LINE-SIZE 132
LINE-COUNT 65(1).
*=============
* Tables used
*=============
TABLES : mseg, mkpf, ekpa, qals, qamv, qamr, makt, lfa1.
SELECT-OPTIONS : s_werks for mseg-werks,
s_matnr for mseg-matnr,
s_lifnr for mseg-lifnr,
s_lifn2 for ekpa-lifn2,
s_ebeln for mseg-ebeln,
s_mblnr for mseg-mblnr,
s_prflos for qals-prueflos,
s_budat for mkpf-budat.
*============
* Base Table
*============
DATA : WS_TDID LIKE STXH-TDID.
DATA: begin of i_base occurs 0,
prueflos like qals-prueflos, " inspection lot no
verwmerkm like qamv-verwmerkm, "master inspection char
mittelwert like qamr-mittelwert, " arithmatic mean
werks like mseg-werks,
matnr like mseg-matnr,
lifnr like mseg-lifnr, " vendor
ebeln like mseg-ebeln,
mblnr like mseg-mblnr,
frbnr like mkpf-frbnr, " Truck No
lifn2 like ekpa-lifn2, " broker
budat like mkpf-budat, " posting date
losmenge like qals-losmenge, " inspection lot size
lsmng like mseg-lsmng, "Quantity in unit of measure
bldat like mkpf-bldat, " document date
charg like qals-charg,
kurztext like qpmt-kurztext,
SOLLWERT type f,"like plmk-SOLLWERT,
TOLERANZOB type f,"like plmk-TOLERANZOB,
TOLERANZUN type f,"like plmk-TOLERANZUN,
SOLLWERT1 TYPE F,
TOLERANZOB1 TYPE F,
TOLERANZUN1 type f,
SOLLWERT2 TYPE P DECIMALS 3,
tOLERANZOB2 TYPE P DECIMALS 3,
TOLERANZUN2 TYPE P DECIMALS 3,
mandt like plmk-mandt,
PLNTY like plmk-plnty,
PLNNR like plmk-plnnr,
plnkn like plmk-plnkn,
merknr like plmk-merknr,
zaehl like plmk-zaehl,
end of i_base.
*=========================
* Table for unique plants
*=========================
DATA : WS_DESC(40) TYPE C.
DATA : begin of i_werks occurs 0,
werks like mseg-werks,
matnr like mseg-matnr,
end of i_werks.
data : w_s(5) type c.
data : w_zb(5) type c.
data : w_zu(5) type c.
DATA : BEGIN OF ST_LINE OCCURS 0,
TDFORMAT LIKE TLINE-TDFORMAT,
TDLINE LIKE TLINE-TDLINE,
END OF ST_LINE.
DATA : W_TDNAME LIKE STXH-TDNAME.
*====================================
* Table for unique Inspection Lot No.
*====================================
DATA : begin of i_prueflos occurs 0,
prueflos like qals-prueflos,
losmenge like qals-losmenge,
verwmerkm like qamv-verwmerkm,
mittelwert like qamr-mittelwert,
kurztext like qpmt-kurztext,
SOLLWERT type f,"like plmk-SOLLWERT,
TOLERANZOB type f,"like plmk-TOLERANZOB,
TOLERANZUN type f,"like plmk-TOLERANZUN,
SOLLWERT1 TYPE F,
TOLERANZOB1 TYPE F,
TOLERANZUN1 type f,
SOLLWERT2 TYPE P DECIMALS 3,
tOLERANZOB2 TYPE P DECIMALS 3,
TOLERANZUN2 TYPE P DECIMALS 3,
mandt like plmk-mandt,
PLNTY like plmk-plnty,
PLNNR like plmk-plnnr,
plnkn like plmk-plnkn,
merknr like plmk-merknr,
zaehl like plmk-zaehl,
end of i_prueflos.
DATA : v_ebeln like mseg-ebeln,
flag type i,
flag1 type i,
v_maktx like makt-maktx,
v_vname like lfa1-name1,
v_bname like lfa1-name1.
data : w_string like qamv-verwmerkm.
data : w_word(20) type c.
data : w_word1(255) type c.
AT SELECTION-SCREEN.
START-OF-SELECTION.
*============
* Base Table
*============
select a~prueflos f~verwmerkm b~mittelwert c~werks c~matnr c~lifnr
c~ebeln c~mblnr d~frbnr e~lifn2 d~budat a~losmenge c~lsmng
d~bldat a~charg into table i_base
from qals as a
inner join qamr as b
on b~prueflos = a~prueflos
inner join qamv as f
on f~prueflos = a~prueflos
and f~merknr = b~merknr
inner join mseg as c
on c~mblnr = a~mblnr
inner join mkpf as d
on d~mblnr = a~mblnr
inner join ekpa as e
on c~ebeln = e~ebeln
where c~werks in s_werks and
c~matnr in s_matnr and
c~lifnr in s_lifnr and
e~lifn2 in s_lifn2 and
c~ebeln in s_ebeln and
c~mblnr in s_mblnr and
d~budat in s_budat and
a~prueflos in s_prflos and
a~matnr = c~matnr.
sort i_base by werks ebeln mblnr prueflos verwmerkm.
delete adjacent duplicates from i_base comparing ebeln mblnr prueflos
verwmerkm.
loop at i_base.
select single kurztext into i_base-kurztext from qpmt where ZAEHLER = i_base-werks and MKMNR = i_base-verwmerkm.
select single SOLLWERT TOLERANZOB TOLERANZUN mandt PLNTY PLNNR plnkn merknr zaehl into
(i_base-SOLLWERT, i_base-TOLERANZOB, i_base-TOLERANZUN, i_base-mandt, i_base-plnty, i_base-plnnr, i_base-plnkn
, i_base-merknr, i_base-zaehl) from plmk where VERWMERKM = i_base-VERWMERKM.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = i_base-SOLLWERT
NO_TYPE_CHECK = 'X'
ROUND_SIGN = ' '
UNIT_IN = 'S'
UNIT_OUT = 'H'
IMPORTING
OUTPUT = i_base-SOLLWERT1.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i_base-SOLLWERT2 = i_base-SOLLWERT1.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = i_base-TOLERANZOB
NO_TYPE_CHECK = 'X'
ROUND_SIGN = ' '
UNIT_IN = 'S'
UNIT_OUT = 'H'
IMPORTING
OUTPUT = i_base-TOLERANZOB1.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i_base-TOLERANZOB2 = i_base-TOLERANZOB1.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = i_base-TOLERANZUN
NO_TYPE_CHECK = 'X'
ROUND_SIGN = ' '
UNIT_IN = 'S'
UNIT_OUT = 'H'
IMPORTING
OUTPUT = i_base-TOLERANZUN1.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i_base-TOLERANZUN2 = i_base-TOLERANZUN1.
modify i_base.
endloop.
loop at i_base.
i_werks-werks = i_base-werks.
i_werks-matnr = i_base-matnr.
append i_werks.
endloop.
loop at i_base.
i_prueflos-prueflos = i_base-prueflos.
i_prueflos-losmenge = i_base-losmenge.
i_prueflos-verwmerkm = i_base-verwmerkm.
i_prueflos-mittelwert = i_base-mittelwert.
i_prueflos-kurztext = i_base-kurztext.
i_prueflos-SOLLWERT = i_base-SOLLWERT.
i_prueflos-TOLERANZOB = i_base-TOLERANZOB.
i_prueflos-TOLERANZUN = i_base-TOLERANzun.
i_prueflos-SOLLWERT1 = i_base-SOLLWERT1.
i_prueflos-TOLERANZOB1 = i_base-TOLERANZOB1.
i_prueflos-TOLERANZUN1 = i_base-TOLERANzun1.
i_prueflos-SOLLWERT2 = i_base-SOLLWERT2.
i_prueflos-TOLERANZOB2 = i_base-TOLERANZOB2.
i_prueflos-TOLERANZUN2 = i_base-TOLERANzun2.
i_prueflos-mandt = i_base-mandt.
i_prueflos-PLNTY = i_base-plnty.
i_prueflos-PLNNR = i_base-plnnr.
i_prueflos-plnkn = i_base-plnkn.
i_prueflos-merknr = i_base-merknr.
i_prueflos-zaehl = i_base-zaehl.
append i_prueflos.
endloop.
*=====================================
* Get unique Purchase Order No and GR
*=====================================
sort i_base by werks ebeln mblnr .
delete adjacent duplicates from i_base comparing ebeln mblnr.
*===============================
* Get unique Plant and Material
*===============================
sort i_werks by werks matnr.
delete adjacent duplicates from i_werks comparing werks matnr.
*======================
* Final Output Display
*======================
loop at i_base.
format color col_heading.
write:/(99) sy-uline.
write:/1 sy-vline.
write:2 'PLANT'.
write:7 sy-vline.
write:8 'MATERIAL'.
write:17 sy-vline.
write:18 'VENDOR'.
write:25 sy-vline.
write:26 'BROKER'.
write:33 sy-vline.
write:34 'P.O. NO.'.
write:45 sy-vline.
write:46 'G.R. NO.'.
write:57 sy-vline.
write:58 'Vendor B.N. '.
write:67 sy-vline.
write:68 'GR DATE'.
write:77 sy-vline.
write:78 'TRUCK REPORTING DATE'.
write:99 sy-vline.
format reset.
write:/(99) sy-uline.
format color col_normal.
write:/1 sy-vline.
write:2 i_base-werks.
write:7 sy-vline.
write:8 i_base-matnr.
write:17 sy-vline.
write:18 i_base-lifnr.
write:25 sy-vline.
write:26 i_base-lifn2.
write:33 sy-vline.
write:34 i_base-ebeln.
write:45 sy-vline.
write:46 i_base-mblnr.
write:57 sy-vline.
write:58 i_base-charg. "i_base-frbnr.
write:67 sy-vline.
write:68 i_base-budat.
write:77 sy-vline.
write:78 i_base-bldat.
write:99 sy-vline.
write:/(99) sy-uline.
format reset.
write:/.
format color col_heading.
write:/(95) sy-uline.
write:/1 sy-vline.
write:2 'MATERIAL DESCRIPTION'.
write:25 SY-VLINE.
write:26 'VENDOR DESCRIPTION'.
write:60 SY-VLINE.
write:61 'BROKER DESCRIPTION'.
write:95 SY-VLINE.
write:/(95) SY-ULINE.
format reset.
*============================================
* Get Material , Vendor , Broker Description
*============================================
clear v_maktx.
clear v_vname.
clear v_bname.
select single maktx into v_maktx
from makt
where matnr = i_base-matnr.
select single name1 into v_vname
from lfa1
where lifnr = i_base-lifnr.
select single name1 into v_bname
from lfa1
where lifnr = i_base-lifn2.
format color col_normal.
write:/1 sy-vline.
write:2 v_maktx.
write:25 sy-vline.
write:26 v_vname.
write:60 sy-vline.
write:61 v_bname.
write:95 sy-vline.
write:/(95) sy-uline.
format color col_heading.
format reset.
write:/.
write:/(128) sy-uline.
write:/1 sy-vline.
write:2 'INSP. LOT. NO.'.
write:15 SY-VLINE.
write:16 'GR QUANTITY'.
write:30 sy-vline.
write:31 'CHALLAN QUANTITY'.
WRITE:50 sy-vline.
write:51 'Master Recp NO'.
write:65 sy-vline.
write:66 'Description'.
write:106 sy-vline.
write:107 'value'.
write:128 sy-vline.
write:/(128) sy-uline.
format reset.
format color col_normal.
flag = 1.
write:/1 sy-vline.
write:2 i_base-prueflos.
write:15 sy-vline.
write:16 i_base-losmenge left-justified.
write:30 sy-vline.
write:31 i_base-lsmng left-justified.
write:50 sy-vline.
format reset.
loop at i_prueflos where prueflos = i_base-prueflos.
format color col_normal.
if ( flag = 1 ).
write:1 sy-vline.
write:15 sy-vline.
write:30 sy-vline.
write:50 sy-vline.
flag = 2.
else.
write:/1 sy-vline.
write:15 sy-vline.
write:30 sy-vline.
write:50 sy-vline.
endif.
w_string = i_prueflos-verwmerkm.
translate w_string to upper case.
if w_string cs 'FUNGUS'.
write:51 'GREEN COPRA'.
else.
write:51 i_prueflos-verwmerkm.
endif.
write:65 sy-vline.
* write i_base-TOLERANZOB left-justified decimals 2 exponent 0 to w_zb.
* write:66 i_prueflos-mittelwert left-justified decimals 2 exponent 0.
write:66 i_prueflos-kurztext.
write:106 sy-vline.
w_s = i_prueflos-SOLLWERT2.
w_zb = i_prueflos-TOLERANZOB2.
w_zu = i_prueflos-TOLERANZun2.
concatenate i_base-mandt i_base-plnty i_base-plnnr i_base-plnkn into W_TDNAME.
CONCATENATE W_TDNAME i_base-merknr INTO W_TDNAME separated BY SPACE.
CONCATENATE W_TDNAME i_base-zaehl INTO W_TDNAME.
select single tdid into ws_tdid from stxh
where TDOBJECT = 'QSS' AND TDID = 'QM' AND TDNAME = W_TDNAME.
IF SY-SUBRC = 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'QM'
LANGUAGE = 'E'
NAME = W_TDNAME
OBJECT = 'QSS'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = ST_LINE
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* NOT_FOUND = 4
* OBJECT = 5
* REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT ST_LINE.
MOVE ST_LINE-TDLINE TO WS_DESC.
ENDLOOP.
ENDIF.
* concatenate '<=' i_base-TOLERANZOB1 '>=' i_base-TOLERANZun1 '=' i_base-SOLLWERT1 into w_word.
IF ( W_ZB EQ SPACE OR W_ZB EQ 0 ) AND ( W_ZU EQ SPACE OR W_ZU EQ 0 ) AND ( W_S EQ SPACE OR W_S EQ 0 ).
W_WORD = WS_DESC.
ELSEIF ( W_ZB NE SPACE OR W_ZB NE 0 ) AND ( W_ZU EQ SPACE OR W_ZU EQ 0 ) AND ( W_S EQ SPACE OR W_S EQ 0 ).
CONCATENATE '<=' w_zb INTO W_WORD.
ELSEIF ( W_ZU NE SPACE OR W_ZU NE 0 ) AND ( W_ZB EQ SPACE OR W_ZB EQ 0 ) AND ( W_S EQ SPACE OR W_S EQ 0 ).
CONCATENATE '>=' w_zb INTO W_WORD.
ELSEIF ( W_S NE SPACE OR W_S NE 0 ) AND ( W_ZU EQ SPACE OR W_ZU EQ 0 ) AND ( W_ZB EQ SPACE OR W_ZB EQ 0 ).
CONCATENATE '=' w_zb INTO W_WORD.
ELSEIF ( W_ZB NE SPACE OR W_ZB NE 0 ) AND ( W_S EQ SPACE OR W_S EQ 0 ) AND ( W_ZU EQ SPACE OR W_ZU EQ 0 ).
CONCATENATE W_ZB '-' W_S INTO W_WORD.
ELSEIF ( W_ZU NE SPACE OR W_ZB NE 0 ) AND ( W_S EQ SPACE OR W_S EQ 0 ) AND ( W_ZB EQ SPACE OR W_ZB EQ 0 ).
CONCATENATE W_ZU '-' W_S INTO W_WORD.
ELSEIF ( W_ZB NE SPACE OR W_ZB NE 0 ) AND ( W_ZU NE SPACE OR W_ZU NE 0 ) AND ( W_S NE SPACE OR W_S NE 0 ).
concatenate '<=' w_zb '>=' w_zu '=' w_s into w_word.
ENDIF.
write:107:w_word.
write:128 sy-vline.
write:/(128) sy-uline.
format reset.
endloop.
write:/(75) sy-uline.
write:/.
endloop.
No comments:
Post a Comment