Skip to Content
-1

no sale document created with BAPI_SALESORDER_CREATEFROMDAT2

Hello,

I want to create a sales order Credit Memo by using

BAPI_SALESORDER_CREATEFROMDAT2

sy-subrc is always EQ 0, but no sales document is created!!

Any help please?

here is my used code:

" Header data
so_header-doc_type = p_styp.

so_header-sales_org = p_sorg.

so_header-distr_chan = p_sdis.

so_header-division = p_sdiv.

so_header-created_by = sy-uname.

" Item Data
so_item-bill_date = p_bill.
so_item-material = w_upload-matnr.

so_item-target_qty = w_upload-quantity.

so_item-target_qu = 'EA'.

so_item-purch_no_c = '*'.

APPEND so_item.


"filling the partner details
so_partnr-partn_role = 'PY'.

so_partnr-partn_numb = w_upload-kunnr.

APPEND so_partnr.


CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = so_header
IMPORTING
salesdocument = g_vbeln
TABLES
return = so_return
order_items_in = so_item
order_partners = so_partnr.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • May 16 at 05:33 AM

    This is your first call of a BAPI. Don't check sy-subrc but look at RETURN parameter for any Error or Abort message, only if none, use BAPI_TRANSACTION_COMMIT else BAPI_TRANSACTION_ROLLBACK.

    Hints: Read BAPI and BAPI parameters documentation. Note that BAPI usually use internal format of data, not external format as BDC used to. So take care of fields with domain conversion-exit (e.g. unit of measure, partner code, etc. in your code)


    Add comment
    10|10000 characters needed characters exceeded

  • May 15 at 04:10 PM

    check the customer code in debugger it has to be converted with routine

    Add comment
    10|10000 characters needed characters exceeded

  • May 16 at 04:08 AM

    Check to see if there is any value populated in g_vbeln. If so, then check if there is any update termiantion error.

    Add comment
    10|10000 characters needed characters exceeded

  • May 16 at 07:37 AM

    Thanks, all


    I get the following error in the Return:

    Unpermitted combination of business object BUS2032 and sales doc. category K

    Add comment
    10|10000 characters needed characters exceeded

  • May 15 at 04:07 PM

    Hello,

    Any message returned in table so_return? Tables conditions and schedules not needed?

    Add comment
    10|10000 characters needed characters exceeded

  • May 16 at 09:51 AM

    Hello Ouail Roukbi,

    When the sales document is a credit memo you have to use BAPI SD_SALESDOCUMENT_CREATE.


    Add comment
    10|10000 characters needed characters exceeded

    • I've found in the tcode sm12 , that there is a lock on the VBAK table as following:

      client user time lock mode table lock argument

      500 SQLI 16:11:08 S VBAK 500$%&sdbatch 0 1
      500 SQLI 16:11:08 E VBAK 5000060021869 0 1

  • May 16 at 01:11 PM

    the sale order has been now created with the following message , but I don't find it in VBAK !!!

    VBAKKOM has been processed successfully
    VBAPKOM has been processed successfully
    KONVKOM has been processed successfully
    Credit Memo Req. PSA 0060021860 has been saved
    Credit Memo Req. PSA 0060021860 has been saved

    Add comment
    10|10000 characters needed characters exceeded