2005 Jan 13 4:43 PM
Hello Forum,
I am trying to change a pricing condition value to zero in a sales order using the BAPI_SALESORDER_CHANGE Function module. Now as far as I am aware from the postings on this and other forums, the BAPI should deactivate the original condition record by setting the indicator field 'KINAK' to 'M' for manual change in the KONV table and then insert a new line for the condition record with the new price value.
However when I am doing the same by filling the tables CONDITION_IN and CONDITION_INX in the BAPI with the relevant values ( UPDATEFLAG = 'U' and filling in the item number and the values with the flags set to 'X' in the INX table), it inserts two lines for the same condition record in the sales order one with old value and one with new. HOWEVER it DOES NOT deactivate the original entry of the condition record.
Thus I have 2 entries
ZABC with Initial value
ZABC with changed value (Zero)
BOTH are active in the table which results in the net value of the sales order line item remaining the same.
Is there any way to work around this ?
Regards,
Preet
2005 Jan 13 4:59 PM
Hello Preet,
according to note 188972, you shouldn't fill CONDITION_INX. Only then original conditions will be deactivated (otherwise they stay active).
Regards,
Christian
2005 Jan 13 5:25 PM
Hi Preet,
Did you give the entire key to the pricing record while filling in the CONDITION_IN and CONDITION_INX structures?
You can use the function module SD_SALES_PRICING_INFORMATION to get the pricing data by sales order and line item and then you can use it while calling the BAPI.
Please close your previous posting by rewarding those who helped you.
Regards,
Srinivas
2005 Jan 13 6:05 PM
Hi all,
I did give the entire key to the condition_in tables and have tried running the BAPI with the condition_INX tables export line commented out. However it still behaves the same way.
I also tried moving as many fields from the KONV table for that condition type to the CONDITION_IN internal table with no change in results.
Is this behaviour related to some changes in customizing perhaps?
Srinivas, how do I go about rewarding you guys.
Regards,
Preet
2005 Jan 13 8:25 PM
Hi Preet,
I am sorry that we are back to square one. I checked OSS and two OSS notes specifically mention that you cannot do anything with condition records if you are in a version lower than 4.7.
That leaves us with the option that I mentioned in your earlier posting which is to make config changes, and then write a small program to do repricing. That way all the sales orders will be repriced and based on the new configuration, the condition should disappear.
You can give points by clicking the yellow star sign at the header of a post. You can give one 10 points for the post solving your issue, two 6 points for very helpful answers and unlimited 2 points for helpful answers.
Regards,
Srinivas
Sorry forgot to mention the OSS notes. They are 593246 and 597970.
Message was edited by: Srinivas Adavi
2005 Jan 14 8:40 AM
Hi,
so bad news from Srinivas for 4.6c and older.
To your customizing question: in transaction V/06 are two flags in box 'Changes which can be made': 'Delete' and 'Value' for allowing line deletions or value changes in documents - but I guess you have already tested your changes manually (BDC-tests) and theses flags allow changes.
I although thought about repricing the documents (C = copy manual, new rest).
When you add a temporary requirement (if sy-uname = 'BATCH'. sy-subrc = 4. endif.) and push the re-pricing button in condition view of sales docs, then ZABC should vanish.
But I guess, because your orders are coming from a sub-system, you might have many 'manual' conditions (determined by sub-system, not automatically in SAP). Then either all or none conditions might change.
When you make a test, be sure to have a second manual condition included (or be sure, there are no other manual conditions).
Regards,
Christian
2006 Nov 14 7:10 AM
Hello preet,
How did you solve this issue.Am working on version 4.5b,can you please let me know.
Thanks
Mahendhar Reddy
2024 Feb 27 3:35 PM
This is an old thread but it's the first one to come up in google, so I thought I would share our solution.
We experimented a bit with different values and different fields. This was on ECC 6. Marking it as manual and inactive due to manual entry and control value of C while leaving the UPDATEFLAG blank seemed to do it.
<ls_conditions_in>-cond_type = 'PR00'.
<ls_conditions_in>-cond_value = 0.
<ls_conditions_in>-CONDISACTI = 'M'.
<ls_conditions_in>-CONDCHAMAN = 'X'.
<ls_conditions_in>-CONDCNTRL = 'C'.
<ls_conditions_inx>-itm_number = '000020'.
<ls_conditions_inx>-cond_type = 'PR00'.
<ls_conditions_inx>-cond_value = 'X'.
*<ls_conditions_inx>-updateflag = 'I'. "Intentionally leave this blank
REPORT zcrv_recet_price.
DATA:
salesdocument LIKE bapivbeln-vbeln,
order_header_inx LIKE bapisdh1x,
return TYPE STANDARD TABLE OF bapiret2,
conditions_in TYPE STANDARD TABLE OF bapicond,
conditions_inx TYPE STANDARD TABLE OF bapicondx,
LOGIC_SWITCH LIKE BAPISDLS.
FIELD-SYMBOLS: <ls_conditions_in> LIKE LINE OF conditions_in,
<ls_conditions_inx> LIKE LINE OF conditions_inx.
salesdocument = '1100491686'.
order_header_inx-updateflag = 'U'.
LOGIC_SWITCH-cond_handl = 'X'.
APPEND INITIAL LINE TO conditions_in ASSIGNING <ls_conditions_in>.
<ls_conditions_in>-itm_number = '000020'.
*<ls_conditions_in>-cond_count = '06'.
<ls_conditions_in>-cond_type = 'PR00'.
<ls_conditions_in>-cond_value = 0.
<ls_conditions_in>-currency = 'USD'.
<ls_conditions_in>-CONDISACTI = 'M'.
<ls_conditions_in>-CONDCHAMAN = 'X'.
<ls_conditions_in>-CONDCNTRL = 'C'.
APPEND INITIAL LINE TO conditions_inx ASSIGNING <ls_conditions_inx>.
<ls_conditions_inx>-itm_number = '000020'.
*<ls_conditions_inx>-cond_count = 'X'.
<ls_conditions_inx>-cond_type = 'PR00'.
<ls_conditions_inx>-cond_value = 'X'.
*<ls_conditions_inx>-updateflag = 'I'.
<ls_conditions_inx>-currency = 'X'.
*<ls_conditions_inx>-CONDCNTRL = 'X'.
*<ls_conditions_inx>-CONDCHAMAN = 'X'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = salesdocument
* ORDER_HEADER_IN =
order_header_inx = order_header_inx
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH = LOGIC_SWITCH
* NO_STATUS_BUF_INIT = ' '
TABLES
return = return
* ORDER_ITEM_IN =
* ORDER_ITEM_INX =
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* SCHEDULE_LINES =
* SCHEDULE_LINESX =
* ORDER_TEXT =
* ORDER_KEYS =
conditions_in = conditions_in
conditions_inx = conditions_inx
* EXTENSIONIN =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.