2011 Oct 30 1:06 PM
hi Gurus,
I have one ALV grid i need the multiplication of two column and result in one column can any one plz tell me how to achive this below is my ALV grid Filed catalog plz suggest me by see the below code ,
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = 'WC'.
ls_fcat-fieldname = 'INSUL'.
ls_fcat-ref_table = 'I_ALV2'.
ls_fcat-outputlen = '04'.
ls_fcat-col_pos = '7'.
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = ' LV '.
ls_fcat-fieldname = 'LMNGA'.
ls_fcat-ref_table = 'I_ALV2'.
ls_fcat-outputlen = '08'.
ls_fcat-col_pos = '8'.
ls_fcat-DO_SUM = 'X'.
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = ' qnty '.
ls_fcat-fieldname = 'LMNGA' . " here i need the multilpication with 100 Like Qnty is 10 then result shold be 10*100
ls_fcat-ref_table = 'I_ALV2'.
ls_fcat-outputlen = '08'.
ls_fcat-col_pos = '8'.
ls_fcat-DO_SUM = 'X'.
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
2011 Oct 30 2:25 PM
Hi
The quick way is to do as follows;
1. You add a column in the type I_ALV2 itself.
2. Before you call display Alv Grid, update your internal table I_ALV2 for the column you required.
3. Put that in the Catalog
Regards,
Venkat
2011 Oct 31 6:45 AM
Hi,
Thanks for replay, Nut still i didnt got soln WIll you plz specify your answer in detail ,thanks its really apericate.
Thanks,
2011 Oct 31 6:56 AM
hi ,
simply declare one more variable in the final internal table and in that field store the multiplication result .
eg :
data : lsmw1 type c .
lsmw1 = quant * 100 .
regards
ranjan
2011 Nov 01 4:05 AM
2011 Nov 01 5:52 AM
"After fetching all data, loop through the internal table updating the required value
LOOP AT itab INTO wa.
wa-lmnga = wa-insul * wa-lmnga. " Multiply
MODIFY itab FROM wa INDEX sy-tabix TRANSPORTING lmnga. " Update value
ENDLOOP.