REPORT zmmr_perf_eval_vend.

“Types Declaration
TYPES:BEGIN OF t_disp,
lifnr
TYPE lifnr,
name1
TYPE name1_gp,
bedat
TYPE bedat,
rfq 
TYPE I ,
quot
TYPE I ,
po  
TYPE I ,
cont
TYPE I ,
sch 
TYPE I ,
END OF t_disp,
BEGIN OF t_temp,
lifnr
TYPE lifnr,
CNT   TYPE I ,
END OF t_temp,
BEGIN OF t_lfa1,
lifnr
TYPE lifnr,
name1
TYPE name1_gp,
END OF t_lfa1.

“For ALV {
DATA: “it_layout   TYPE lvc_s_layo,
gr_table
TYPE REF TO cl_salv_table,
gr_functions
TYPE REF TO cl_salv_functions,
gr_columns
TYPE REF TO cl_salv_columns_table,
gr_column
TYPE REF TO cl_salv_column_table,
gr_display
TYPE REF TO cl_salv_display_settings,
lr_grid
TYPE REF TO cl_salv_form_layout_grid,
lr_gridx
TYPE REF TO cl_salv_form_layout_grid,
lr_logo
TYPE REF TO cl_salv_form_layout_logo,
lr_label
TYPE REF TO cl_salv_form_label,
lr_text
TYPE REF TO cl_salv_form_text,
lr_footer
TYPE REF TO cl_salv_form_layout_grid,
ls_color
TYPE lvc_s_colo
.
” For ALV }

DATA: it_disp TYPE TABLE OF t_disp,
wa_disp
LIKE LINE OF it_disp,
it_temp
TYPE TABLE OF t_temp,
wa_temp
LIKE LINE OF it_temp,
it_lfa1
TYPE TABLE OF t_lfa1,
wa_lfa1
LIKE LINE OF it_lfa1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT 001.
SELECT-OPTIONS : s_lifnr FOR wa_disp lifnr,
s_bedat
FOR wa_disp bedat.
SELECTION-SCREEN END OF BLOCK b1.

*———————————————————————-*
*       CLASS lcl_Perf_Eval DEFINITION
*———————————————————————-*
*
*———————————————————————-*
CLASS lcl_perf_eval DEFINITION .
PUBLIC SECTION.
METHODS: constructor ,
fill_disp
.
METHODS build_fc.
METHODS disp_alv.
METHODS set_tol.
METHODS end_of_page.

ENDCLASS.                   “lcl_perf_eval DEFINITION

*———————————————————————-*
*       CLASS lcl_perf_eval IMPLEMENTATION
*———————————————————————-*
*
*———————————————————————-*
CLASS lcl_perf_eval IMPLEMENTATION .
METHOD constructor.
TRY.
cl_salv_table
=> factory( IMPORTING r_salv_table = gr_table CHANGING t_table = it_disp ). “Calling Factory Obj of Cl_ALV_TABLE
CATCH cx_salv_msg.
ENDTRY .

IF gr_table IS INITIAL .
MESSAGE TEXT 002 TYPE ‘I’ DISPLAY LIKE ‘E’.
EXIT .
ENDIF .
ENDMETHOD.                   “constructor

METHOD fill_disp.
“RFQ
SELECT a~lifnr COUNT( DISTINCT a~ebeln ) AS rfq FROM ekko AS a
JOIN ekpo AS b ON a~ ebeln = b ~ebeln
INTO CORRESPONDING FIELDS OF TABLE it_disp
WHERE a~lifnr IN s_lifnr AND bedat IN s_bedat
AND b~loekz NE ‘X’
AND a~bstyp = ‘A’
GROUP BY a~lifnr .

“WRITE sy-dbcnt.
“Quot
SELECT lifnr COUNT( DISTINCT ebeln ) AS CNT FROM ekko
APPENDING CORRESPONDING FIELDS OF TABLE it_temp
WHERE lifnr IN s_lifnr AND bedat IN s_bedat
AND loekz EQ space
AND ( bstyp = ‘A’ AND statu = ‘A’ )
GROUP BY lifnr.

LOOP AT it_temp INTO wa_temp .
wa_disp
lifnr = wa_temp lifnr.
wa_disp
quot = wa_temp CNT.
MODIFY it_disp FROM wa_disp TRANSPORTING lifnr quot WHERE lifnr = wa_templifnr .
CLEAR : wa_disp, wa_temp.
ENDLOOP .

” PO
REFRESH it_temp.
SELECT lifnr COUNT( DISTINCT a~ ebeln ) AS CNT FROM ekko AS a JOIN ekpo AS b ON a~ ebeln = b ~ebeln
APPENDING CORRESPONDING FIELDS OF TABLE it_temp
WHERE lifnr IN s_lifnr AND bedat IN s_bedat
AND b~loekz EQ space
AND bsart NE ‘UB’
AND ( a~ bstyp = ‘F’ )
GROUP BY lifnr.<span