2013 Aug 01 7:27 PM
Dear Gurus,
My requirement is very silly.I have created a sales order via 'BAPI_SALESORDER_CREATEFROMDAT2', now i have to insert some condition type into it. With respect to some validations in it,after commit work of BAPI_SALESORDER_CREATEFROMDAT2 i have called BAPI_SALESORDER_CHANGE and passed ITM_NUMBER, COND_TYPE, COND_VALUE,CURRENCY,CONDORIGIN, UPDATEFLAG in it.But still no condition types are getting inserted into the sales order.
Have searched extensively SCN and used all the given solutions, but could not get desired output.
Can anyone let me know what all i should pass other that this in CONDITIONS_IN and IT_CONDITIONS_INX in BAPI_SALESORDER_CHANGE for condition type insertion.
Should i have to use some other BAPI for this?
Waiting for your replies.
With Regards,
Jagan
2013 Aug 01 8:46 PM
Hi Jaganathan,
CONDITIONS_IN AND CONDITIONS_INX and ORDER_HEADER_INX would be sufficient to change condition type of sales order.
Fetch values from table KONV for the sales order created with your BAPI andthen call BAPI_SALESORDER_CHANGE by passing parameters values as explained below.
fetch condition values from table: KONV with condition KONV-KNUMV = VBAK-KNUMV
Pass below values
SALESDOCUMENT that was created
ORDER_HEADER_INX:UPDATEFLAG = U
CONDITIONS_IN : ITM_NUMBER = KONV-KPOSN, COND_ST_NO = KONV-STUNR, COND_COUNT = KONV-ZAEHK, COND_TYP =KONV-KAPPL,COND_VALUE
CONDITIONS_INX : ITM_NUMBER = KONV-KPOSN, COND_ST_NO = KONV-STUNR, COND_COUNT, COND_TYP =KONV-KAPPL,UPDATEFLAG = U, COND_VALUE= X .currency
If you are still not able t change condition type then check whetrher you are able to do the same in VA02. As for some condition types doesnt allow to change based on their configuration they should be deleted and reinserted again in ypur program.
Srikanth..
2013 Aug 02 6:27 AM
Dear Srikanth,
I have tried all the possible things what you have said.But data is not getting inserted into the sales order.Am i missing some thing??
ie,
header: COND_HANDL flag = 'X' and UPDATEFLAG = 'U'.
WA_COND-ITM_NUMBER = KPOSN.
WA_COND-COND_ST_NO = WA_KONV-STUNR.
WA_COND-COND_COUNT = ZAEHK.
WA_COND-COND_TYPE = 'ZMRE'.
WA_COND-COND_VALUE = AMOUNT.
WA_COND-CURRENCY = 'INR'.
WA_COND_INX-ITM_NUMBER = KPOSN.
WA_COND_INX-COND_ST_NO = '160'.
WA_COND_INX-COND_COUNT = ZAEHK.
WA_COND_INX-COND_TYPE = 'ZMRE'.
WA_COND_INX-UPDATEFLAG = 'I'.
WA_COND_INX-COND_VALUE = 'X'.
WA_COND_INX-CURRENCY = 'X'.
With Regards,
Jagan
2013 Aug 02 8:28 AM
Hi,
TRY using SET UPDATE TASK LOCAL statement after commit work of "BAPI_SALES...DATA2". then try again.
if you are still not able to change then check whether you are able to make change to condition type using VA02 for the same sales order created through program?.
Srikanth.
2013 Aug 02 7:11 AM
Try as follows:
headerx-updateflag = 'U'.
cond-itm_number = '000010'.
cond-COND_TYPE = 'ZZ10'.
cond-cond_value = '6000'.
condx-itm_number = '000010'.
condx-cond_type = 'X'.
condx-cond_value = 'X'.
condx-updateflag = 'I'.
APPEND:cond,condx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = vbeln
* ORDER_HEADER_IN =
order_header_inx = headerx
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
* 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 = cond
CONDITIONS_INX = condx
* EXTENSIONIN =
.
Commit Work and Wait.
Regards