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

Error in BAPI_SALESORDER_CHANGE while updating condition

Former Member
0 Likes
789

Hi,

I am using this BAPI to change an existing pricing condition. However, I am getting an error " Manual change of condition type is not possible". I'm not sure whether this is a coding error or is it related to configuration. this is how I am populating the structures:

so_cond_in-itm_number = wa_vbap1-posnr.

so_cond_in-cond_count = wa_konv-zaehk.

so_cond_in-cond_st_no = wa_konv-STUNR.

so_cond_in-cond_type = wa_konv-kschl.

so_cond_in-cond_value = wa_konv-kbetr.

so_cond_in-currency = wa_konv-waers.

so_condx_in-itm_number = wa_vbap1-posnr.

so_condx_in-updateflag = 'U'.

so_condx_in-cond_st_no = wa_konv-STUNR.

so_condx_in-cond_count = wa_konv-zaehk.

so_condx_in-cond_type = wa_konv-kschl.

so_condx_in-cond_value = 'X'.

so_condx_in-currency = 'X'.

APPEND so_condx_in.

CLEAR so_condx_in.

APPEND so_cond_in.

CLEAR so_cond_in.

st_logswitch-cond_handl = 'X'.

Any help would be appreciated.

Thanks

SM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
697

Hi Sneha ,

Can you please check the code for using the BAPI_SALESORDER_CHANGE bapi. this is similar to your chase. Please compare with the passing parameters

then you will get some idea on your code.

*- Population of Order Item data

ls_order_item-itm_number = ls_submit-posnr. "Item

ls_order_item-prc_group5 = '003'."lc_004. "Material Group5

IF ls_submit-zmeng = 0.

ls_order_item-reason_rej = lc_99. "Reason for Rejection

ENDIF.

APPEND ls_order_item TO lt_order_item.

*-Population of update flag for Order Item

ls_order_itemx-itm_number = ls_submit-posnr."Item

ls_order_itemx-updateflag = lc_u. "Update flag

ls_order_itemx-prc_group5 = gc_x. "Material Group5 update

*- if the required quanity is zero then reject the line

IF ls_submit-zmeng = 0.

ls_order_itemx-reason_rej = gc_x. "Reason for Rejection

ENDIF.

APPEND ls_order_itemx TO lt_order_itemx.

*-Population of

ls_schedule_lines-itm_number = ls_submit-posnr.

ls_schedule_lines-sched_line = ls_submit-etenr.

ls_schedule_lines-req_qty = ls_submit-zmeng.

APPEND ls_schedule_lines TO lt_schedule_lines.

*-Population of update flag for Schedule line data

ls_schedule_linesx-itm_number = ls_submit-posnr.

ls_schedule_linesx-sched_line = ls_submit-etenr.

ls_schedule_linesx-updateflag = lc_u.

ls_schedule_linesx-req_qty = gc_x.

APPEND ls_schedule_linesx TO lt_schedule_linesx.

*- at the end of Order call the BAPI to Update the Order

ls_order_head-collect_no = ls_submit-vbeln.

ls_order_headx-updateflag = lc_u.

ls_order_headx-collect_no = gc_x.

*- BAPI Call to Update the Order

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = ls_submit-vbeln

order_header_in = ls_order_head

order_header_inx = ls_order_headx

TABLES

return = lt_return

order_item_in = lt_order_item

order_item_inx = lt_order_itemx

schedule_lines = lt_schedule_lines

schedule_linesx = lt_schedule_linesx.

*- Check for the errors and based on that populate the log

READ TABLE lt_return INTO ls_return WITH KEY type = lc_e.

IF sy-subrc EQ 0.

LOOP AT lt_return INTO ls_return WHERE type = lc_e.

ls_log-excep = 1.

ls_log-vbeln = ls_submit-vbeln.

ls_log-message = ls_return-message.

APPEND ls_log TO gt_log.

CLEAR: ls_log,

ls_submit-vbeln .

ENDLOOP.

ELSE.

*- Commit the Changes

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = gc_x.

*- Check for the success message and populate the log

LOOP AT lt_return INTO ls_return WHERE number = lc_311.

ls_log-excep = 3.

ls_log-vbeln = ls_submit-vbeln.

ls_log-message = ls_return-message.

APPEND ls_log TO gt_log.

CLEAR: ls_log,

ls_submit-vbeln .

ENDLOOP.

ENDIF.

Thanks

Sekhar

Hi,

I am using this BAPI to change an existing pricing condition. However, I am getting an error " Manual change of condition type is not possible". I'm not sure whether this is a coding error or is it related to configuration. this is how I am populating the structures:

so_cond_in-itm_number = wa_vbap1-posnr.

so_cond_in-cond_count = wa_konv-zaehk.

so_cond_in-cond_st_no = wa_konv-STUNR.

so_cond_in-cond_type = wa_konv-kschl.

so_cond_in-cond_value = wa_konv-kbetr.

so_cond_in-currency = wa_konv-waers.

so_condx_in-itm_number = wa_vbap1-posnr.

so_condx_in-updateflag = 'U'.

so_condx_in-cond_st_no = wa_konv-STUNR.

so_condx_in-cond_count = wa_konv-zaehk.

so_condx_in-cond_type = wa_konv-kschl.

so_condx_in-cond_value = 'X'.

so_condx_in-currency = 'X'.

APPEND so_condx_in.

CLEAR so_condx_in.

APPEND so_cond_in.

CLEAR so_cond_in.

st_logswitch-cond_handl = 'X'.

Any help would be appreciated.

Thanks

SM

3 REPLIES 3
Read only

Former Member
0 Likes
697

this bcos of Config settings, U cannt change Condition value by any methods .

Regards

Prabhu

Read only

Former Member
0 Likes
697

Hi Sneha

Please check the below to confirm:

1. Try to change the price manually via VA02.

2. Check the value of field KMANU in table T685A for the condition type.

If the value is "D" you can not change it manually.

If the value is SPACE or A or C, you can change the price.

Kind Regards

Eswar

Read only

Former Member
0 Likes
698

Hi Sneha ,

Can you please check the code for using the BAPI_SALESORDER_CHANGE bapi. this is similar to your chase. Please compare with the passing parameters

then you will get some idea on your code.

*- Population of Order Item data

ls_order_item-itm_number = ls_submit-posnr. "Item

ls_order_item-prc_group5 = '003'."lc_004. "Material Group5

IF ls_submit-zmeng = 0.

ls_order_item-reason_rej = lc_99. "Reason for Rejection

ENDIF.

APPEND ls_order_item TO lt_order_item.

*-Population of update flag for Order Item

ls_order_itemx-itm_number = ls_submit-posnr."Item

ls_order_itemx-updateflag = lc_u. "Update flag

ls_order_itemx-prc_group5 = gc_x. "Material Group5 update

*- if the required quanity is zero then reject the line

IF ls_submit-zmeng = 0.

ls_order_itemx-reason_rej = gc_x. "Reason for Rejection

ENDIF.

APPEND ls_order_itemx TO lt_order_itemx.

*-Population of

ls_schedule_lines-itm_number = ls_submit-posnr.

ls_schedule_lines-sched_line = ls_submit-etenr.

ls_schedule_lines-req_qty = ls_submit-zmeng.

APPEND ls_schedule_lines TO lt_schedule_lines.

*-Population of update flag for Schedule line data

ls_schedule_linesx-itm_number = ls_submit-posnr.

ls_schedule_linesx-sched_line = ls_submit-etenr.

ls_schedule_linesx-updateflag = lc_u.

ls_schedule_linesx-req_qty = gc_x.

APPEND ls_schedule_linesx TO lt_schedule_linesx.

*- at the end of Order call the BAPI to Update the Order

ls_order_head-collect_no = ls_submit-vbeln.

ls_order_headx-updateflag = lc_u.

ls_order_headx-collect_no = gc_x.

*- BAPI Call to Update the Order

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = ls_submit-vbeln

order_header_in = ls_order_head

order_header_inx = ls_order_headx

TABLES

return = lt_return

order_item_in = lt_order_item

order_item_inx = lt_order_itemx

schedule_lines = lt_schedule_lines

schedule_linesx = lt_schedule_linesx.

*- Check for the errors and based on that populate the log

READ TABLE lt_return INTO ls_return WITH KEY type = lc_e.

IF sy-subrc EQ 0.

LOOP AT lt_return INTO ls_return WHERE type = lc_e.

ls_log-excep = 1.

ls_log-vbeln = ls_submit-vbeln.

ls_log-message = ls_return-message.

APPEND ls_log TO gt_log.

CLEAR: ls_log,

ls_submit-vbeln .

ENDLOOP.

ELSE.

*- Commit the Changes

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = gc_x.

*- Check for the success message and populate the log

LOOP AT lt_return INTO ls_return WHERE number = lc_311.

ls_log-excep = 3.

ls_log-vbeln = ls_submit-vbeln.

ls_log-message = ls_return-message.

APPEND ls_log TO gt_log.

CLEAR: ls_log,

ls_submit-vbeln .

ENDLOOP.

ENDIF.

Thanks

Sekhar