‎2009 Jan 22 7:16 AM
Hi All,
I am trying to create Sales Orders using BAPI_SALESORDER_CREATEFROMDAT2.
I am giving all inputs properly and still getting the following error.
"Condition ZPR0 is not allowed as header condition".
This is related to Condition Type that i am specifying in the table ORDERS_CONDITIONS_IN.
I have entered the condition Type, Rate and Currency in the table ORDERS_CONDITIONS_IN.
How to resolve this issue?
Please help me out.....
Regards
Pavan
‎2009 Jan 22 8:12 AM
If you are using Header condition, you need to fill CONDCOINHD field also in the condition table and don't fill the ITM_NUMBER field.
‎2009 Jan 22 8:47 AM
Abhishek,
Thanks for your reply.
But can anyone tell me what value should i pass into ORDER_CONDITIONS_IN-CONDCOINHD?
Regards
Pavan
‎2009 Jan 22 9:00 AM
Try passing counter '01' , '02' etc. in the field.
Regards
Abhishek
‎2009 Jan 23 6:47 AM
Hi All,
I have written the following code to create Sales Order.
HEADER-DOC_TYPE = I_SALES-AUART.
HEADER-SALES_ORG = I_SALES-VKORG.
HEADER-DISTR_CHAN = I_SALES-VTWEG.
HEADER-DIVISION = I_SALES-SPART.
HEADER-PURCH_NO_C = I_SALES-BSTKD.
HEADER-PURCH_DATE = I_SALES-BSTDK.
LOOP AT I_SALES.
CHECK: V_PONO = I_SALES-BSTKD.
ITEM-ITM_NUMBER = I_SALES-POSNR.
ITEM-MATERIAL = I_SALES-MATNR.
ITEM-CUST_MAT35 = I_SALES-KDMAT.
ITEM-TARGET_QTY = I_SALES-KWMENG.
item-PROFIT_CTR = i_sales-PROFIT_CTR.
item-WBS_ELEM = i_sales-WBS_ELE.
item-plant = i_sales-plant.
APPEND ITEM.
**-- Condition Type
condition-cond_type = 'ZPR0'.
condition-cond_value = i_sales-kbetr.
condition-CURRENCY = i_sales-waers.
condition-condcoinhd = '01'.
append condition.
**-- Sold to Party
IF I_SALES-AG = 'AG'.
PARTNER-PARTN_ROLE = 'AG'.
PARTNER-PARTN_NUMB = I_SALES-KUNNR.
APPEND PARTNER.
ENDIF.
**-- Ship to party
IF I_SALES-WE = 'WE'.
PARTNER-PARTN_ROLE = 'WE'.
PARTNER-PARTN_NUMB = I_SALES-KUNNR_SH.
APPEND PARTNER.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM PARTNER COMPARING PARTN_ROLE PARTN_NUMB.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
ORDER_HEADER_IN = header
* ORDER_HEADER_INX = 'X'
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
IMPORTING
SALESDOCUMENT = v_vbeln
TABLES
RETURN = return1
ORDER_ITEMS_IN = item
* ORDER_ITEMS_INX = 'X'
ORDER_PARTNERS = partner
* ORDER_SCHEDULES_IN =
* ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN = condition
* ORDER_CONDITIONS_INX =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* ORDER_CCARD =
* ORDER_TEXT =
* ORDER_KEYS =
* EXTENSIONIN =
* PARTNERADDRESSES =
.
ENDLOOP.
IF NOT IT_VBELN[] IS INITIAL.
WRITE: 'The Following sales are created:' COLOR 5.
LOOP AT IT_VBELN.
WRITE: / IT_VBELN-VBELN.
ENDLOOP.
ENDIF.
IF NOT RETURN1[] IS INITIAL.
WRITE: / 'The Following are the return messages' COLOR 6.
LOOP AT RETURN1.
WRITE: / RETURN1-MESSAGE.
ENDLOOP.
ENDIF.
ENDIF.Now, when i execute the BAP throws an error as follows....
The success message: SALES_HEADER_IN has been processed successfully
The Error message: Condition ZPR0 is not allowed as header condition
I am unable to understand the error message pertaining with Condition Type.
Your help will be appreciated......
Thanks,
Pavan
Regards
Pavan
Edited by: Pavan Sanganal on Jan 23, 2009 2:48 PM
‎2009 Feb 20 11:32 AM