01-09-2007 7:45 AM
Hi Experts,
I have writen the below codes to create a sales order but it is showing the error message that ' sales order type OR is not defined'. Please help me.
data:itab_header like bapisdhead occurs 0 with header line,
itab_item like bapiitemin occurs 0 with header line,
itab_partner like BAPIPARTNR occurs 0 with header line,
itab_return like bapireturn1,
soldtoparty like bapisoldto occurs 0 with header line,
shiptoparty like bapishipto occurs 0 with header line,
salesdoc like BAPIVBELN-VBELN .
itab_header-doc_type = 'OR'.
itab_header-sales_org = '1000'.
itab_header-distr_chan = '10'.
itab_header-division = '00'.
append itab_header.
itab_item-material = 'M-01'.
itab_item-req_qty = '1'.
append itab_item.
itab_partner-partn_role = 'AG'.
itab_partner-partn_numb = '1000'.
append itab_partner.
clear itab_partner.
itab_partner-partn_role = 'WE'.
itab_partner-partn_numb = '1000'.
append itab_partner.
clear itab_partner.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
ORDER_HEADER_IN = itab_header
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = ' '
IMPORTING
SALESDOCUMENT = salesdoc
SOLD_TO_PARTY = soldtoparty
SHIP_TO_PARTY = shiptoparty
BILLING_PARTY =
RETURN = itab_return
TABLES
ORDER_ITEMS_IN = itab_item
ORDER_PARTNERS = itab_partner.
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CCARD =
ORDER_CFGS_BLOB =
ORDER_SCHEDULE_EX =.
.
if itab_return-type ne 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IMPORTING
RETURN =
write: salesdoc.
else.
write: itab_return-message.
endif.
01-09-2007 8:10 AM
Hi Dillip,
try to use 'BAPI_SALESORDER_CREATEFROMDAT2'.
Hope this helps.
Cheers,
Patrick
01-09-2007 8:10 AM
Hi Dillip,
try to use 'BAPI_SALESORDER_CREATEFROMDAT2'.
Hope this helps.
Cheers,
Patrick
01-09-2007 8:33 AM
Hi ,
Check in the config whether this document type is allowed for your sales area.
you can check this in se16 as well ,
see if the table vbak has any entries with the sales area as the one you are using in your case.
Regards,
Sunmit.
01-09-2007 8:50 AM
Hi Patrick,
Thanks for your suggestion. I have to use bapi_salesorder_createfromdat1 only.
01-09-2007 8:55 AM
Hi Sunmit,
Thanks for quick reply but I am sorry it didn't help me because before writing the program I have checked in VA01 giving the same record.
01-09-2007 10:20 AM
Hello Dillip
The BAPIs BAPI_SALESORDER_CREATE... have certain limitations. In case of BAPI_SALESORDER_CREATEFROMDAT1 you can only create orders for business object 'BUS2032'.
If you have the RFC-enabled function module <b>SD_SALESORDER_CREATE</b> available in your system (which I doubt) then you should use this fm instead of the BAPIs.
Regards
Uwe
01-10-2007 6:44 AM
Hi,
Thanks to all of you who tried to help me. I got the point where I was wrong.
convesion_exit_alpha_input will be used.
Regards,
Dillip.