Skip to Content
author's profile photo Former Member
Former Member

Problem in creating sales order using the FM BAPI_SALESORDER_CREATEFROMDAT

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 08:10 AM

    Hi Dillip,

    try to use 'BAPI_SALESORDER_CREATEFROMDAT2'.

    Hope this helps.

    Cheers,

    Patrick

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 08:10 AM

    Hi Dillip,

    try to use 'BAPI_SALESORDER_CREATEFROMDAT2'.

    Hope this helps.

    Cheers,

    Patrick

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 08: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 08:50 AM

    Hi Patrick,

    Thanks for your suggestion. I have to use bapi_salesorder_createfromdat1 only.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2007 at 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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 06: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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.