Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3189

Re: Modify internal table and do calculation in Query

$
0
0

First make sure that the POSNR value is populated correctly in it_vbfa.

Then do the following (do minor modifications where necessary):

 

loop at it_sum into wa_sum.

 

  read table it_vbfa into wa_vbfa

                               with key vbeln = wa_sum-vbeln

                                             posnr = wa_sum-posnr.

 

if wa_vbfa-vbtyp_n = 'N'.

wa_sum-fkimg = wa_sum-fkimg * -1.        " Make it negative

endif.

 

 

"Add the record to new internal table

read table it_final assigning <fs_final>

                             with key vbeln = wa_sum-vbeln.

if sy-subrc = 0.   

 

   " Already record exists

  <fs_final>-billing_qty = <fs_final>-billing_qty + wa_sum-fkimg.

else.

 

wa_final-vbeln = wa_sum-vbeln.

wa_final-billing_qty = wa_sum-fkimg.

append wa_final to it_final.

endif.

 

endloop.


Viewing all articles
Browse latest Browse all 3189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>