‎2007 Apr 11 5:03 AM
Hello Guys..
I have created one report are mention below.I am having two problem with the report .
1. The report is generated in ALV, But I am not able to look a graph from report.
I have change the type of variable fron C to i, Then it's giving me dump.
castsd(10) type c,
Metltemp(10) type c,
watertemp(10) type c,
bartempMIL(10) type c,
bartempIH(10) type c,
IHRATING(10) type c,
bartempAIH(10) type c,
RLMILLD(10) type c,
EMTMP(10) type c,
COILTMP(10) type c,
What can I do.
2. I am facting data from MSEG table , this taking more time performance is poor of the reprort, Can some other idea.
Please check my code.
REPORT ZPP_RE_P.
TABLES : MCHA,MCH1,CRHD,mara,t001w,S022.
Data :Wa_CUOBJ_BM like mch1-CUOBJ_BM ,wa_atwrt like ausp-atwrt.
data :WA_objek like ausp-objek,WA_ATINN LIKE CABN-ATNAM.
DATA: wA_STR(2) TYPE C.
DATA ld_color TYPE C.
TYPES: BEGIN OF t_it_main_data ,
ersda like mch1-ersda,
matnr LIKE mseg-matnr,
arbpl like crhD-arbpl,
charg LIKE mseg-charg,
castsd(10) type c,
Metltemp(10) type c,
watertemp(10) type c,
bartempMIL(10) type c,
bartempIH(10) type c,
IHRATING(10) type c,
bartempAIH(10) type c,
RLMILLD(10) type c,
EMTMP(10) type c,
COILTMP(10) type c,
line_color(4) type c, "Used to store row color attributes
END OF t_it_main_data.
DATA: it_main_data TYPE STANDARD TABLE OF t_it_main_data WITH HEADER LINE INITIAL SIZE 0.
TYPES: BEGIN OF t_it_mcha ,
matnr LIKE mcha-matnr,
charg LIKE mcha-charg,
END OF t_it_mcha.
DATA: it_mcha TYPE STANDARD TABLE OF t_it_mcha WITH HEADER LINE INITIAL SIZE 0.
TYPES: BEGIN OF t_it_mch1 ,
matnr LIKE mch1-matnr,
charg LIKE mch1-charg,
lwedt like mch1-lwedt,
CUOBJ_bm like mch1-CUOBJ_bm,
CUOBJ_bm1 like ausp-objek,
END OF t_it_mch1.
DATA: it_mch1 TYPE STANDARD TABLE OF t_it_mch1 WITH HEADER LINE INITIAL SIZE 0.
TYPES: BEGIN OF t_it_ausp,
OBJEK LIKE ausp-OBJEK,
ATINN LIKE ausp-ATINN,
ATWRT like ausp-ATWRT,
END OF t_it_ausp.
DATA: it_ausp TYPE STANDARD TABLE OF t_it_ausp WITH HEADER LINE INITIAL SIZE 0.
TYPES: BEGIN OF t_it_mseg,
matnr LIKE mseg-matnr,
charg LIKE mseg-charg,
aufnr like mseg-aufnr,
END OF t_it_mseg.
DATA: it_mseg TYPE STANDARD TABLE OF t_it_mseg WITH HEADER LINE INITIAL SIZE 0.
TYPES: BEGIN OF t_it_S022,
arbpl LIKE S022-arbpl,
matnr like S022-MATNR,
aufnr like S022-aufnr,
END OF t_it_S022.
DATA: it_S022 TYPE STANDARD TABLE OF t_it_S022 WITH HEADER LINE INITIAL SIZE 0.
Selection Screen ************************************
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE sel.
Parameters : P_werks like mchb-werks.
select-options: s_matnr for mch1-matnr,
s_arbpl for crhd-arbpl,
s_ersda for mch1-ersda.
SELECTION-SCREEN : END OF BLOCK blk1.
initialization.
sel = 'Selection Screen'.
w_repid = sy-repid.
Validatation ***************************************
At Selection Sceen ***********************************
AT SELECTION-SCREEN ON BLOCK blk1.
if s_matnr-low <> ''.
SELECT SINGLE * FROM mara WHERE matnr in s_matnr.
IF sy-subrc <> 0.
MESSAGE e015(zmo) WITH 'Material No Not Exist ' s_matnr.
ENDIF.
endif.
if p_werks <> ''.
SELECT SINGLE * FROM t001w WHERE werks = p_werks.
IF sy-subrc <> 0.
MESSAGE e015(zmo) WITH 'Plant Not Exist ' p_werks.
ENDIF.
endif.
At Selection Sceen ***********************************
To Validate data is There or Not.
at selection-screen.
Select * from mcha into corresponding fields
of table it_mcha where
matnr in s_matnr and werks = p_werks.
and ersda in s_ersda.
if sy-subrc <> 0.
message e015(zmo) with 'No Data to Display ..'.
endif.
******************************************************************
Start of Selection **********************************
******************************************************************
Start-of-selection.
PERFORM Data_Fetch. " DATA FETCH FROM THE TABLES
PERFORM Arrange_Data. " DATA FETCH FROM THE TABLES
PERFORM build_fieldcatalog. " To Down Load in ALV GRID
PERFORM Grid. " To Down Load in ALV GRID
END-OF-SELECTION.
&----
*& Form Data_Fetch
&----
text
----
--> p1 text
<-- p2 text
----
form Data_Fetch .
Select * from mch1 into corresponding fields
of table it_mch1
for all entries in it_mcha
where matnr = it_mcha-matnr and charg = it_mcha-charg
and lwedt in s_ersda and CUOBJ_BM <> 0.
To Check the Value of Material and Batch for in MSEG Table **************
Select * from mseg into corresponding fields
of table it_mseg
for all entries in it_mcha
where matnr = it_mcha-matnr
and charg = it_mcha-charg and aufnr <> ''.
select * from S022 into corresponding fields
of table it_S022
for all entries in it_mseg
where aufnr = it_mseg-aufnr AND ARBPL IN S_ARBPL.
*********************************************************************************
loop at it_mch1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_mch1-cuobj_bm
IMPORTING
OUTPUT = Wa_CUOBJ_BM.
it_mch1-cuobj_bm1 = Wa_CUOBJ_BM.
modify it_mch1.
endloop.
select * from ausp into corresponding fields
of table it_ausp for all entries in it_mch1
where OBJEK = it_mch1-cuobj_bm1.
if sy-subrc = 0.
endif.
refresh it_main_data.
clear it_main_data.
loop at it_mch1.
loop at it_ausp where objek = it_mch1-cuobj_bm1.
CLEAR WA_ATWRT.
CLEAR WA_ATINN.
CALL FUNCTION 'CONVERSION_EXIT_ATINN_OUTPUT'
EXPORTING
input = it_ausp-ATINN
IMPORTING
OUTPUT = WA_ATINN.
if wa_atinn = 'CASTSPEED'.
it_main_data-castsd = it_ausp-atwrt.
elseif wa_atinn = 'METALTEMPINTUNDISH'.
it_main_data-Metltemp = it_ausp-atwrt.
elseif wa_atinn = 'WATERTEMP'.
it_main_data-watertemp = it_ausp-atwrt.
elseif wa_atinn = 'BARTEMPATMILLENTRY'.
it_main_data-bartempMIL = it_ausp-atwrt.
elseif wa_atinn = 'BARTEMPATIHENTRY'.
it_main_data-bartempIH = it_ausp-atwrt.
elseif wa_atinn = 'IHRATING'.
it_main_data-IHRATING = it_ausp-atwrt.
elseif wa_atinn = 'BARTEMPAFTERIH'.
it_main_data-bartempAIH = it_ausp-atwrt.
elseif wa_atinn = 'ROLLINGMILLLOAD'.
it_main_data-RLMILLD = it_ausp-atwrt.
elseif wa_atinn = 'EMULSIONTEMP'.
it_main_data-EMTMP = it_ausp-atwrt.
elseif wa_atinn = 'COILTEMP'.
it_main_data-COILTMP = it_ausp-atwrt.
endif.
it_main_data-ersda = it_mch1-lwedt.
it_main_data-matnr = it_mch1-matnr.
it_main_data-charg = it_mch1-charg.
WA_STR = it_main_data-charg.
read table it_mseg with key matnr = it_mch1-matnr charg = it_mch1-charg.
if sy-subrc = 0.
read table it_S022 with key matnr = it_mch1-matnr aufnr = it_mseg-aufnr.
if sy-subrc = 0.
it_main_data-Arbpl = it_S022-arbpl.
endif.
endif.
if WA_STR = 'E1' OR WA_STR = 'A1'.
it_main_data-Arbpl = 'RRM01'.
ELSEIF WA_STR = 'E2' OR WA_STR = 'A2'.
it_main_data-Arbpl = 'RRM02'.
ELSEIF WA_STR = 'E3' OR WA_STR = 'A3'.
it_main_data-Arbpl = 'RRM03'.
ENDIF.
endloop.
IF IT_MAIN_DATA-MATNR <> '' and IT_MAIN_DATA-arbpl <> '' and ( it_main_data-castsd <> '' or
it_main_data-Metltemp <> '' or
it_main_data-watertemp <> '' or
it_main_data-bartempMIL <> '' or
it_main_data-bartempIH <> '' or
it_main_data-IHRATING <> '' or
it_main_data-bartempAIH <> '' or
it_main_data-RLMILLD <> '' or
it_main_data-EMTMP <> '' or
it_main_data-COILTMP <> '' ).
ld_color = ld_color + 1.
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into IT_MAIN_DATA-line_color.
append it_main_data.
ENDIF.
CLEAR it_main_data.
COLOR IN alv GRID
endloop.
DELETE ADJACENT DUPLICATES FROM IT_MAIN_DATA COMPARING MATNR CHARG ERSDA arbpl.
sort it_main_data by ersda matnr charg arbpl.
endform. " Data_Fetch
I have shown here only logic , ALV Coding I have not given.
REgards
Swati.
‎2007 Apr 11 5:20 AM
Hi,
Try to mension all the fields names in SELECT which r useful...try to avoid SELECT *.
definitely u will get some better performance.
Kishor.
‎2007 Apr 11 5:20 AM
Hi,
Try to mension all the fields names in SELECT which r useful...try to avoid SELECT *.
definitely u will get some better performance.
Kishor.
‎2007 Apr 11 5:25 AM
Swati,
Try to execute SELECT statement outside the internal table loop.
Because that many times DATABASE will come into the picture.
Regards,
Amey
‎2007 Apr 11 5:27 AM
Hi swati,
in ur quirey <b> try to avoid select * and into corresponding fields of instead of that try to give the field named directly</b> .
<b>insead of IF try to use CASE statement </b>
if this helps u reward points...
ravi
Message was edited by:
ravi r
Message was edited by:
ravi r