2023 Oct 04 11:20 AM
Dear Team
I need help clearing Plant, Product Code, Product Description, Base Qty, and UOM filed repeated value in the ALV report. required output in the following format in ALV.
I use the below logic to achieve this type of output in ALV.
loop at itab into data(wa_tab). " Final Table For ALV
CLEAR : w_flag , lv_matnr.
at new matnr.
w_flag = abap_true.
lv_matnr = wa_tab-matnr.
endat.
IF w_flag ne abap_true .
CLEAR : wa_tab-werks,wa_tab-matnr,wa_tab-maktx,wa_tab-bmeng,wa_tab-bmein.
MODIFY itab FROM wa_tab TRANSPORTING werks matnr maktx bmeng bmein.
ENDIF.
CLEAR : wa_tab.
endloop.
try .
call method cl_salv_table=>factory
importing
r_salv_table = lr_alv
changing
t_table = itab.
catch cx_salv_msg .
endtry.
lr_alv->display( ).
but I did not get the correct output as per requirement I get the output as per below.
2023 Oct 04 11:48 AM
Don't clear the fields in the internal table, just define those fields as sort criteria and ALV will hide duplicates.
(Also in your code clearing the field will trigger at new on next record)
2023 Oct 04 12:13 PM
Dear Raymond Giuseppi
Actually, initially, I did this it displayed okay in ALV, but when we exported this data into a Spreadsheet(.xlsx) file the data was exported as usual.
2023 Oct 04 1:08 PM
Not sure that possible in ALV export to Excel, you may be required to code your own download with OLE2 or Abap2XLSX.
2023 Oct 04 5:16 PM
lfumakiya Remember to provide all the important information in the initial question, instead of adding supplementary questions each time there is a good answer.
2023 Oct 05 8:35 AM
Qustion could have been 'How To Clear merged duplicate values when exporting from ALV report to Excel'
2023 Oct 04 12:39 PM
delete adjanced duplicates from itab comparing Plant, Product Code, Product Description, Base Qty and fields you need to delete duplicates
2023 Oct 04 1:10 PM
Dear Amir Barzegar
I have performed the task you requested, but I only retrieved two records with different materials. This report comprises both header and item data. The fields mentioned above contain header data, while the remaining fields contain item-level data. For example, the first four columns represent Bill of Materials (BOM) materials header data, while the other columns represent their corresponding component data.