Skip to Content
0
Former Member
Apr 19, 2010 at 11:34 AM

VOFM Custom Routine - Wrong values being stored in the database

280 Views

Hi Experts,

I am using a requirement routine in my Z condition type.

In invoices for new sales orders, the condition is coming directly at the line item level.

In the older open sales orders, at the time of creation of invoices we are manually entering this condition type at the header level. We don't enter any value at the header level. The routine calculates the values properly when we go to the line item condition tabs. But after saving the invoice, in change mode the value is being displayed as 0 against this condition type.

In case we enter the condition type at the item level, the same values are being displayed and the values get saved correctly. But since the number of line items are generally more than 100 at the invoice level, the users can't be expected to enter all condition type for all the line items.

I am writing the code in the form kobed_903. form kobev_903 is not accessed. SAP notes says that kobed is for the header and kobev for items. Can anyone suggest what am i doing wrong.

I am saving values as below.

read table tkomv assigning <f_komv> with key knumv = komk-knumv
                                             kposn = komp-kposn
                                             kschl = 'ZVPR'.
if sy-subrc eq 0.
  <f_komv>-kbetr = 'Calculated Value'.
  <f_komv>-kwert = 'Calculated Value'.
  <f_komv>-kwert_k = 'Calculated Value'.
  <f_komv>-waers = 'AED'.
  <f_komv>-kwaeh = 'AED'.
endif.

*The form ends with 
sy-subrc = 0.

Thanks,

Abdullah

Edited by: Abdullah Ismail on Apr 19, 2010 5:06 PM