Application Development 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: 

VOFM - Vales not getting changed in the Screen

former_member628395
Active Participant
0 Kudos

Hi,

I am working on the VOFM routines and want to change the condition value for gross price using the same.

I have created the routine number 600 in the application V1.

I have put a breakpoint in the routine which is getting triggered. But when I try to change the value of the variable XKWERT, the

same does not reflect in the screen and it still shows the original condition value.

I read many posts on SDN and tried those suggestions, but in vain. What could be the possible reasons for the same.

Regards,

Sagar

13 REPLIES 13

krishnendu_laha
Active Contributor
0 Kudos

Could you please check in debugging that SY-SUBRC is still '0' after that routine execution, if not use sy-subrc = 0 statement after passing the value...

Thanks

0 Kudos

Hi,

I have checked the subrc, its 0. No problems there.

But after the execution of the routine, KOMV is being overwritten by RETTKOMV structure.

Is there anything I am missing out on?

Regards,

Sagar

Jelena
Active Contributor
0 Kudos

I don't think you're supposed to use VOFM routines to change the pricing conditions that are driven by condition records. This would kind of defy their purpose. You can use pricing user exits in SAP to influence how the pricing condition tables are accessed and such.

You might want to check with the functional consultant, it seems that the requirements have not been thought through here...

kiran_k8
Active Contributor
0 Kudos

Jelena,

Could you please share your knowledge on the appropriate usage of VOFM routines.Kindaa.... for what kind of requirements it is more advisable to define a custom routine in VOFM and for what kind of requirements we should go for Pricing User exits.

K.Kiran.

david_tuohy2
Participant
0 Kudos

Hi Sagar,

I had a similar problem, I have just solved it today, it was driving me nuts. Here is my solution:

I wanted to change the "Amount" column in the Pricing elements of the Condtitions TAB in Sales Order Header (KOMV-KBETR).

Eveytime I tried to change XKOMV-KBETR in my routine , it was overwritten by RETTKOMV.

There are two parts to the solution:

First of all, your VOFM routine is called in two places - from KOMV_BEWERTEN( in program LV61AA55 ) where it is overwritten as soon as it leaves your routine, but also from XKOMV_KWERT_ERMITTELN (in program LV61AA43) where it is not overwritten by RETTKOMV.

Put a break point in program LV61AA43 at this point in the code, and make sure your VOFM routine is called:


* calculation formula
  IF xkomv-kofrm NE 0.
    wertformel = 'X'.
    xkwert = xkomv-kwert.
    frm_kondi_wert-nr = xkomv-kofrm.
    PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND.
    xkomv-kwert = xkwert.
  ENDIF.

Still, when I changed XKOMV-KBETR the change was not reflected on screen.

I needed to MODIFY the structure TKOMV where KSCHL was equal to my Condition Type.

Use a line of code something like:

 modify tkomv transporting kbetr where KSCHL = 'ZXXX' AND (other conditions here) 

In my case, the change was then reflected on screen.

Hope this helps you,

David.

david_tuohy2
Participant
0 Kudos

Just as an additional note,

you can see from this code (see message above) why your XKWERT value is not changed

This is SAP standard code:

  
    xkwert = xkomv-kwert.
    frm_kondi_wert-nr = xkomv-kofrm.
    PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND.
    xkomv-kwert = xkwert.

A copy is made of XKOMV-KWERT, your routine is called (where you try to change the value),but then the copy is moved back to XKOMV-XKWERT, overwriting your change.

Hopefully this is helpful for you.

srinivasb8583
Explorer
0 Kudos

Hi,

We have the same issue. We have followed the suggestion to update TKOMV. The values of KBETR on pricing conditions are not updated correctly. For example - KBETR value for item 10 remains blank for the first time and then when we navigate to item 20 the values on 20 were getting displayed. The problem here is that the values populated on item 20 are the correct values for item 10 and so on for all other items.

Can you please help us? Are we missing anything? Thank you very much

Srinivas

Former Member
0 Kudos

Hi SAP gurus,

I'm facing a similar requirement. I'm updating the field "Condition Value" KWERT in a Purchase Order corresponding to a Z cond type KSCHL at the time of Goods Receipt with a value. But the value is not getting updated because the table XKOMV is getting overwritten due to the same code as described above.

I also updated TKOMV, but still the change is not getting shown on the screen as TKOMV is also modified later in the program iwth the old value.

Can you please help me out as what I'm missing here. Do I have to update any other table/structure apart from XKOMV and TKOMV.

Best Regards,

Anurag Khanna

0 Kudos

Hi can you post your code, so that any one can suggest you.

For reference try the below code,

data: tp_xk  type standard table of komv_index
                with header line initial size 50.

read table xkomv into tp_xk with key kschl = 'ZSMO'.   " you must another internal table so that data will not be over ridden

xkwert = tp_xk-kwert.

clear tp_xk.

0 Kudos

Hi Madhumahesh,

Thanks for the reply. Please find below the code:

DATA :  lv_kwert TYPE kwert.

FIELD-SYMBOLS : <lfs_xkomv> TYPE KOMV_INDEX,
                <lfs_tkomv> TYPE KOMV.

*calculate the value of Excise Duty
  CALL FUNCTION '/BGT/ED_PRICING_PURCHASE'
    EXPORTING
      i_komk        = komk
      i_komp        = komp
   IMPORTING
      e_wert        = lv_kwert.

  IF lv_kwert IS NOT INITIAL.
    xkwert = lv_kwert.
*modify XKOMV

    LOOP AT xkomv ASSIGNING <lfs_xkomv> WHERE kschl = 'ZI11'.
      <lfs_xkomv>-kwert = lv_kwert.
   ENDLOOP.

*modify TKOMV

    LOOP AT tkomv ASSIGNING <lfs_tkomv> WHERE kschl = 'ZI11'.
      <lfs_tkomv>-kwert = lv_kwert.
    ENDLOOP.

    UNASSIGN : <lfs_xkomv>, <lfs_tkomv>.

ENDIF.

But after coming out of "Condition Value formula", these values are overwritten by the standard SAP code (as described above in earlier posts- by RETTKOMV in Include LV61AA55).

Kindly let me know what I'm missing in my code.

Awaiting for your valuable response.

Best regards,

Anurag Khanna

0 Kudos

Hello Anurag,

                             Did you got any solution i have similar isue.

Regards

Manish

former_member204244
Active Participant
0 Kudos

Hello,

I am facing the same issue. If Could you please share your solution , that would be very helpful.

Regards,

Ishani

Former Member
0 Kudos

Hi Gurus,

             I am facing similar kind of issue. when I am updating quantity price is not getting updated as quantity.

I am not sure why condition control is E here. Any inputs