Skip to Content
-1

no sale document created with BAPI_SALESORDER_CREATEFROMDAT2

May 15 at 03:48 PM

55

avatar image

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'.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

7 Answers

Raymond Giuseppi May 16 at 05:33 AM
0

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)


Share
10 |10000 characters needed characters left characters exceeded
Ravi G May 15 at 04:10 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Shanthi Kumar Juluru May 16 at 04:08 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Ouail Roukbi May 16 at 07:37 AM
0

Thanks, all


I get the following error in the Return:

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

Share
10 |10000 characters needed characters left characters exceeded
Teresa Gonçalves May 15 at 04:07 PM
0

Hello,

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

Share
10 |10000 characters needed characters left characters exceeded
Teresa Gonçalves May 16 at 09:51 AM
0

Hello Ouail Roukbi,

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


Show 5 Share
10 |10000 characters needed characters left characters exceeded

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

Any help ?

0

Still using BAPI BAPI_TRANSACTION_COMMIT? Have you tried VA03?

0

yes, I'm using the BAPI_TRANSACTION_COMMIT, in the VA03 says :

SD document xxxxxxx is not in the database or has been archived

0

Check table return from BAPI_TRANSACTION_COMMIT. Any message?

Maybe there is any authorization missing, you could set a trace to check it.

0

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

0
Ouail Roukbi May 16 at 01:11 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded