on 04-05-2010 7:43 PM
Is there another SAP bapi other than the BAPI_SALESORDER_CREATEFROMDAT2 that would be able to create Debit Memos using Business Object: BUS2096?
BAPI_SALESORDER_CREATEFROMDAT2 creates the orders using BUS2032 which won't work for a Debit Memo.
Thanks........
Anyone? Do I have this question in the right forum?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had used long back in credit/ debit memo creation prog.
Pls try to use simillar code in your program , definitely u will get the right results.
************************************************************************
w_order_header_in *
*
************************************************************************
CLEAR w_order_header_in.
w_order_header_in-doc_type = v_doctyp. "sales order doc type
w_order_header_in-sales_org = p_it_lines-vkorg . "sales organization
w_order_header_in-distr_chan = p_it_lines-vtweg. "distribution channel
w_order_header_in-division = p_it_lines-spart. "division
w_order_header_in-purch_no_c = p_memo. "cust PO
w_order_header_in-purch_date = sy-datum. "cust PO date
w_order_header_in-ord_reason = v_reason_code.
************************************************************************
order item *
*
************************************************************************
wa_order_items_in-material = p_it_lines-matnr. "material.
wa_order_items_in-plant = p_it_lines-werks. "plant
wa_order_items_in-store_loc = p_it_lines-lgort. "storage location
p_it_lines-fkimg = p_it_lines-fkimg * 1000.
wa_order_items_in-target_qty = p_it_lines-fkimg. "billing qty
wa_order_items_in-currency = c_curr.
wa_order_items_in-cond_type = v_condtype.
wa_order_items_in-cond_value = v_var.
APPEND wa_order_items_in TO it_order_items_in.
CLEAR wa_order_items_in.
************************************************************************
it_order_partner *
*
************************************************************************
wa_order_partners-partn_numb = p_it_lines-kunnr_sp.
wa_order_partners-partn_role = 'AG'.
APPEND wa_order_partners TO it_order_partners.
CLEAR wa_order_partners.
wa_order_partners-partn_numb = p_it_lines-kunnr_sh.
wa_order_partners-partn_role = 'WE'.
APPEND wa_order_partners TO it_order_partners.
CLEAR wa_order_partners.
***********************************************************************
************************************************************************
determine business object
CASE v_doctyp.
WHEN c_cdocty. "credit memo doc type
v_busobj = 'BUS2094'.
WHEN c_ddocty. "debit memo doc type
v_busobj = 'BUS2096'.
ENDCASE.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA'
EXPORTING
order_header_in = w_order_header_in
business_object = v_busobj
without_commit = ' '
convert_parvw_auart = 'X'
IMPORTING
salesdocument = v_salesdocument
return = it_return
TABLES
order_items_in = it_order_items_in
order_partners = it_order_partners.
CLEAR : w_order_header_in,v_busobj.
REFRESH : it_order_items_in,it_order_partners.
IF it_return IS NOT INITIAL.
wa_lines-status = 'FAILED'.
wa_lines-err_log = it_return-message.
EXIT.
ELSE.
set the flag to commit work and wait
v_wait = 'X'.
CLEAR it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = v_wait "Commit work and wait
IMPORTING
return = it_return1.
wa_lines-crdr_memo = v_salesdocument.
wa_lines-status = 'SUCCESSFUL'.
wa_lines-err_log = it_return1-message.
ENDIF.
Edited by: Prashant Phirke on Apr 7, 2010 7:14 AM
Edited by: Prashant Phirke on Apr 7, 2010 7:15 AM
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.