cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation of two field columns.

Former Member
0 Kudos

Hi SDNers,

I have three Fields COST, QUANTITY, and NET QUANTITY in my alv table , Now i want to calculate the field NET QUANTITY based on COST and QUANTITY and display it in NET QUANTITY Here QUANTITY is a editable field and the value in COST is coming from the data base, Here if i manually enter the QUANTITY and click enter then the NET QUANTITY should be updated. how can i achieve This??

Thanks

Harish

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

You need to set the cell editor as Input Field for the quantity column, and also define an event handler for the onEnter event of the input field. In that method, you need to read the value entered and populate the net qty field. And then bind it to the context again.

Regards,

Nithya

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Perhaps I am missing something in your requirements, but this seems really simple. In your event handler, you just read the data from your context. Do the calculation in ABAP setting the new results back into the context. You can use the code wizard to help with the logic to read and write to/from the context. The calcuation itself is really basic ABAP (var1 * var2 = var3).

What part are you having problems with?