2009 Dec 10 4:48 PM
I am updating the xkomv table in a user exit using the code at the bottom of this message. The xkomv table appears to be updated correctly and works when there is only 1 line item on my order. However, when there are 2 line items or more then the pricing conditions are added but the "Condition value" is not populated. I can scroll through the line items and then F3 out of the order and get a popup asking if I want to save changes. I respond yes (although I did not change anything in the order I just scrolled through the line items while looking at the conditions tab using the black arrow at top left of screen). When I pull the order back up the "Condition value" is populated.
i need the "condition value" to be populated by the code and work properly. I am a new ABAPer and would appreciate any advice about adding pricing conditions to xkomv.
Code
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'KF00'.
IF sy-subrc = 0.
found KF00 condition for line item so update rate
xkomv-kwert = lrate.
wa_komv-kwert = lrate / rcnt.
wa_komv-kbetr = lrate / rcnt.
MODIFY xkomv FROM wa_komv INDEX sy-tabix.
ELSE.
no KF00 condition so create it
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'PR00'.
IF sy-subrc = 0.
xkomv-kposn = xvbap-posnr.
PERFORM get_confition_types TABLES xkomv
USING 'KF00'.
xkomv-kwert = lrate.
xkomv-kbetr = lrate / rcnt.
APPEND xkomv.
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'KF00'.
wa_komv-kwert = lrate / rcnt.
wa_komv-kbetr = lrate / rcnt.
MODIFY xkomv FROM wa_komv INDEX sy-tabix.
ELSE.
append xkomv.
ENDIF.
ENDIF.
End of code
I am updating the xkomv table in a user exit using the code at the bottom of this message. The xkomv table appears to be updated correctly and works when there is only 1 line item on my order. However, when there are 2 line items or more then the pricing conditions are added but the "Condition value" is not populated. I can scroll through the line items and then F3 out of the order and get a popup asking if I want to save changes. I respond yes (although I did not change anything in the order I just scrolled through the line items while looking at the conditions tab using the black arrow at top left of screen). When I pull the order back up the "Condition value" is populated.
i need the "condition value" to be populated by the code and work properly. I am a new ABAPer and would appreciate any advice about adding pricing conditions to xkomv.
Code
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'KF00'.
IF sy-subrc = 0.
found KF00 condition for line item so update rate
xkomv-kwert = lrate.
wa_komv-kwert = lrate / rcnt.
wa_komv-kbetr = lrate / rcnt.
MODIFY xkomv FROM wa_komv INDEX sy-tabix.
ELSE.
no KF00 condition so create it
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'PR00'.
IF sy-subrc = 0.
xkomv-kposn = xvbap-posnr.
PERFORM get_confition_types TABLES xkomv
USING 'KF00'.
xkomv-kwert = lrate.
xkomv-kbetr = lrate / rcnt.
APPEND xkomv.
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'KF00'.
wa_komv-kwert = lrate / rcnt.
wa_komv-kbetr = lrate / rcnt.
MODIFY xkomv FROM wa_komv INDEX sy-tabix.
ELSE.
append xkomv.
ENDIF.
ENDIF.
End of code
2009 Dec 10 4:58 PM
just changing the values in user exit might not work always... specially when you are making changes to condition based value and condition value.. there is lots of logic involved, to determine and make sure values are correct.
if you want to change the value then try to write code in pricing routines, which are attached to your condition types... pricing routines can be seen in Tr. VOFM, its the functional team which have to guide to create a P routine.
there is a lot of other validations which take place on re-pricing and on any change done in SO of Inv.
2009 Dec 17 5:25 PM
I worked with a funcitonal consultant that got the pricing conditions added for me via Config and Master Data. I then update those pricing conditions with the code above and it is working as expected.
I believe my issue was primarily how I created the pricing conditions. So having SAP create them and then just modifying the amounts accordingly is working for me.
2009 Dec 17 5:25 PM
I worked with a funcitonal consultant that got the pricing conditions added for me via Config and Master Data. I then update those pricing conditions with the code above and it is working as expected.
I believe my issue was primarily how I created the pricing conditions. So having SAP create them and then just modifying the amounts accordingly is working for me.
2009 Dec 17 7:03 PM
[Step by Step Process:- VOFM is the Transaction, where we can create New Routine.|http://sapdocs.info/sap/sd-related-topics/routines-in-sd/]
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |