Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

VOFM Custom Routine - Wrong values being stored in the database

Former Member
0 Likes
1,294

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

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,013

Are you updating the pricing of all the line items ? In this exit what is the value of "komp-kposn" ?

Are you using the mentioned code in loop, so that it will be applied to all line items?

Regards

Vinod

Read only

0 Likes
1,013

the routine is called for all the line items. I do not run a loop here. komp-kposn is the current line item number from the communication structure.

Thanks,

Abdullah.

Read only

0 Likes
1,013

Hi Abdullah,

Have you tried updating the structure "XKOMV" instead of "TKOMV". This a suggestion, as currently i don't have the SAP system, so that I can test the same.

Regards

Vinod

Edited by: Vinod Kumar on Apr 19, 2010 5:16 PM

Read only

0 Likes
1,013

XKOMV does not serve the purpose. I want to do some calculations and then save it against the condition type for the particular line item.

Thanks,

Abdullah.

Read only

0 Likes
1,013

If I enter the condition at the item level, the invoice saves the value. But if I enter the condition at the header level, the value is being displayed at the item level by performing the necessary calculations but it does not save. So I am changing the value of KHERK from D to C in the row of TKOMV for this particular condition type. The values are being stored now but is this advisable?

Thanks,

Abdullah

Read only

0 Likes
1,013

Can anyone also suggest why KOBEV routine is not called in VF01?

Thanks,

Abdullah