Skip to Content
0

Issue While passing Sales Order number in BAPI_ACC_DOCUMENT_POST

Apr 09 at 10:59 AM

63

avatar image
Former Member

Dear All,

While creating customer down payment(f-29) by bapi BAPI_ACC_DOCUMENT_POST , I am encountering an issue that is please enter Sales order number as it is mandatory in our system. But I there is no such field in BAPIACAR09, So I am not able to pass in the BAPI. Kindly suggest some soluction.

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

4 Answers

Gabriel Felipe Coleti Apr 09 at 01:31 PM
1

Dear Omprakash,


I recently posted a blog about Enlarging the use of BAPI_ACC_DOCUMENT_POST

Check the solution there and how you can solve your problem with this article.

Best Regards,

Gabriel Coleti

Share
10 |10000 characters needed characters left characters exceeded
G Lakshmipathi
Apr 09 at 01:04 PM
0

Check whether OSS note 561175 helps you. Else, you can try with BAPI_PAYMENTREQUEST_CREATE

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Apr 09 at 01:35 PM
0

Dear Lakshmipathi,

Kindly share some sample code to pass in BAPI_PAYMENTREQUEST_CREATE. So it will help me a lot.


Regards,

Om

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Apr 09 at 01:49 PM
0

Dear Gabriel,

Thanks for your valuable input, Is BADI implementation is the only way to pass the values in extensions.

Here is my code, I am trying to pass so number in extension but it is not passing,

lwa_bapi_docheader-obj_type = 'BKPFF'.
lwa_bapi_docheader-obj_key = '$'.
lwa_bapi_docheader-obj_sys = sy-mandt.
lwa_bapi_docheader-bus_act = 'RFBU'.
lwa_bapi_docheader-username = sy-uname.
lwa_bapi_docheader-header_txt = 'HEADER TEXT BAPI'.
lwa_bapi_docheader-comp_code = '9000'.
lwa_bapi_docheader-doc_date = sy-datum.
lwa_bapi_docheader-pstng_date = sy-datum.
lwa_bapi_docheader-ref_doc_no = 'REF DOC NO BAPI'.
lwa_bapi_docheader-doc_type = 'DZ'.
lwa_bapi_docheader-AC_DOC_NO = ''.

CLEAR lwa_bapi_acctgl.
* lwa_bapi_acctgl-itemno_acc = '0000000010'.
* lwa_bapi_acctgl-gl_account = '0000112315'.
* lwa_bapi_acctgl-comp_code = '9000'.
* lwa_bapi_acctgl-pstng_date = sy-datum.
* lwa_bapi_acctgl-item_text = 'ITEM TEXT BAPI'.
* lwa_bapi_acctgl-S_ORD_ITEM = '000010'.
* lwa_bapi_acctgl-DOC_TYPE = 'DZ'.
* lwa_bapi_acctgl-BUS_AREA = '1400'.
* lwa_bapi_acctgl-PROFIT_CTR = 'O11151'.
* APPEND lwa_bapi_acctgl TO lt_bapi_acctgl.


lwa_bapi_acctgl-itemno_acc = '0000000020'.
lwa_bapi_acctgl-gl_account = '0000112315'.
lwa_bapi_acctgl-comp_code = '9000'.
lwa_bapi_acctgl-pstng_date = sy-datum.
lwa_bapi_acctgl-item_text = 'ITEM TEXT BAPI'.
* lwa_bapi_acctgl-CUSTOMER = '0000070033'.
lwa_bapi_acctgl-DOC_TYPE = 'DZ'.
lwa_bapi_acctgl-BUS_AREA = '1400'.
lwa_bapi_acctgl-PROFIT_CTR = 'O11151'.
* lwa_bapi_acctgl-SALES_ORD = '1140000347'.
APPEND lwa_bapi_acctgl TO lt_bapi_acctgl.

* Fill Account receivable for customer
lwa_bapi_acctrcv-itemno_acc = '0000000010'.
lwa_bapi_acctrcv-customer = '0000070033'.
lwa_bapi_acctrcv-item_text = 'ITEM TEXT BAPI'.
lwa_bapi_acctrcv-sp_gl_ind = 'A'.
lwa_bapi_acctrcv-pymt_cur_iso = 'INR'.
lwa_bapi_acctrcv-COMP_CODE = '9000'.
lwa_bapi_acctrcv-TAX_CODE = '00'.
* lwa_bapi_acctrcv-RES_DOC = '1140000347'.
* CLEAR lwa_bapi_acctrcv.
* lwa_bapi_acctrcv-itemno_acc = '0000000020'.
** lwa_bapi_acctrcv-customer = '0000070033'.
* lwa_bapi_acctrcv-item_text = 'ITEM TEXT BAPI'.
* lwa_bapi_acctrcv-sp_gl_ind = 'A'.
* lwa_bapi_acctrcv-pymt_cur_iso = 'INR'.
* lwa_bapi_acctrcv-COMP_CODE = '9000'.
* lwa_bapi_acctrcv-TAX_CODE = '00'.


APPEND lwa_bapi_acctrcv TO lt_bapi_acctrcv.

* Fill amounts
CLEAR lwa_currencyamount.
lwa_currencyamount-itemno_acc = '0000000010'. "'0000900000'.
lwa_currencyamount-currency = 'INR'.
lwa_currencyamount-amt_doccur = '-10000.00'.
APPEND lwa_currencyamount TO lt_currencyamount.


CLEAR lwa_currencyamount.
lwa_currencyamount-itemno_acc = '0000000020'. "'0000900000'.
lwa_currencyamount-currency = 'INR'.
lwa_currencyamount-amt_doccur = '10000.00'.
APPEND lwa_currencyamount TO lt_currencyamount.


************************************Tax Calculation
amount = 10000.
* DATA:tax_item1 TYPE i.
DESCRIBE TABLE lt_currencyamount LINES item_no.
DESCRIBE TABLE lt_bapi_acctgl LINES tax_item.
DESCRIBE TABLE lt_bapi_acctrcv LINES tax_item1.
tax_item = tax_item + tax_item1.
DATA : i_companycode TYPE bukrs,
TAX_CODE TYPE mwskz,
I_CURRENCY_KEY TYPE WAERS,
I_INVOICE_AMOUNT TYPE DMBTR.
i_companycode = 9000.
TAX_CODE = '00'.
I_CURRENCY_KEY = 'INR'.
I_INVOICE_AMOUNT = 10000.
DESCRIBE TABLE lt_currencyamount LINES item_no.
CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'
EXPORTING
i_bukrs = i_companycode
i_mwskz = TAX_CODE
* I_TXJCD = ' '
i_waers = I_CURRENCY_KEY

i_wrbtr = I_INVOICE_AMOUNT
IMPORTING
e_fwnav = lv_f1
e_fwnvv = lv_f2
e_fwste = lv_f3
e_fwast = lv_f4
TABLES
t_mwdat = t_mwdat .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT t_mwdat INTO wa_mwdat WHERE hkont IS NOT INITIAL.
tax_item = tax_item + 1.
wa_accounttax-itemno_acc = tax_item.
wa_accounttax-cond_key = wa_mwdat-kschl.
wa_accounttax-acct_key = wa_mwdat-ktosl.
wa_accounttax-taxjurcode = wa_mwdat-txjcd.
wa_accounttax-taxjurcode_deep = wa_mwdat-txjcd_deep.
wa_accounttax-taxjurcode_level = wa_mwdat-txjlv.
wa_accounttax-gl_account = wa_mwdat-hkont.
wa_accounttax-itemno_tax = item_no.
wa_accounttax-tax_code = '00'.

APPEND wa_accounttax TO lt_accounttax.
CLEAR:wa_accounttax.

lwa_currencyamount-itemno_acc = tax_item.
lwa_currencyamount-curr_type = '00'.
lwa_currencyamount-currency = 'INR'.
lwa_currencyamount-amt_doccur = wa_mwdat-wmwst."wa_gldata-invoice_amount * ( -1 ).
lwa_currencyamount-amt_base = wa_mwdat-kawrt."wa_gldata-invoice_amount.
APPEND lwa_currencyamount TO lt_currencyamount.
CLEAR:lwa_currencyamount.
ENDLOOP.

wa_extension1-field1 = '1'.
wa_extension1-field2 = 'VBEL2'.
wa_extension1-field3 = '4329812323'.
APPEND wa_extension1 TO lt_extension1.
* CLEAR:p_base_amount, wa_extension1.

DATA: ls_zzz type STANDARD TABLE OF ACCIT with header line,
i_ext2 TYPE STANDARD TABLE OF bapiparex WITH HEADER LINE.

*CLEAR i_ext2.
*
i_ext2-structure = 'ACCIT'.
*
ls_zzz-posnr = 1.
**
**ls_zzz-awref_reb = '123654'.
**
**ls_zzz-aworg_reb = '654654'.
**
**ls_zzz-aubel = '0000001364'. "KDAUF
*
ls_zzz-kdauf = '1140000344'. "KDAUF
*
MOVE ls_zzz TO i_ext2-valuepart1.
*
APPEND i_ext2.
************************************************************************
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = lwa_bapi_docheader
TABLES
accountgl = lt_bapi_acctgl
accountreceivable = lt_bapi_acctrcv
currencyamount = lt_currencyamount
* ACCOUNTTAX = lt_accounttax
* EXTENSION1 = lt_extension1
EXTENSION2 = i_ext2
return = lt_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.

Regards,

Om prakash

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

Dear Omprakash,


First you can implement the BAdI BADI_ACC_DOCUMENT (Interface IF_EX_ACC_DOCUMENT). I posted the Source Code of the BAdI in there.


Second you can use the EXTENSION2 table like the following:

wa_extension2-structure = 'ACCOUNTGL'. "Here is the BAPI input parameter table where you want to add the sales order

wa_extension2-valuepart1 = '0000000020'. "Here is the line item ID where you want to add the sales order

wa_extension2-valuepart2 = 'C_ACCIT'. "Here is the BAdI table where you want to add the Sales Order

wa_extension2-valuepart3 = 'KDAUF'. "Here is the Field of the BAdI - KDAUF is the Sales Order

wa_extension2-valuepart4 = '1140000347'. "This is the Sales Order Number


Best regards,


Gabriel Coleti

0