Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_ACC_DOCUMENT_POST

Former Member
0 Kudos

Hello,

I am trying to use the BAPI_ACC_DOCUMENT_POST for posting vendor invoices. But, I want to know if this BAPI allows us to post documents for Different vendors in different Line items in the AccountsPayable table? Can we use this BAPI for multiple Vendors?

Thanks a lot. I would appreciate your help

Regards,

Gopal.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Gopal,

This Funtional module can be multiple vendor line items refer to the code it might help you

FORM vendor_payable .
  DATA idx TYPE sy-tabix.

  CLEAR lin.
  LOOP AT it_vendor INTO lw_vendor.
    DESCRIBE TABLE it_bapiaccr09 LINES lin.
    idx = lin + 1.
    it_bapiacap09-itemno_acc   = idx.
    it_bapiacap09-vendor_no    = lw_vendor-saknr.
*  it_bapiacap09-PMNTTRMS     = '0001'.
    APPEND it_bapiacap09.
    CLEAR it_bapiacap09.
    lw_vendor-wrbtr  = -1 * lw_vendor-wrbtr.
    it_bapiaccr09-itemno_acc   = idx.
    it_bapiaccr09-currency_iso = 'INR'.
    it_bapiaccr09-amt_doccur   = lw_vendor-wrbtr .
    it_bapiaccr09-amt_base     = lw_vendor-wrbtr.
    APPEND it_bapiaccr09.
    CLEAR :it_bapiaccr09.

  ENDLOOP.


ENDFORM.                    " VENDOR_PAYABLE
*

Regards

Nilesh

8 REPLIES 8

Former Member
0 Kudos

Hi Gopal,

This Funtional module can be multiple vendor line items refer to the code it might help you

FORM vendor_payable .
  DATA idx TYPE sy-tabix.

  CLEAR lin.
  LOOP AT it_vendor INTO lw_vendor.
    DESCRIBE TABLE it_bapiaccr09 LINES lin.
    idx = lin + 1.
    it_bapiacap09-itemno_acc   = idx.
    it_bapiacap09-vendor_no    = lw_vendor-saknr.
*  it_bapiacap09-PMNTTRMS     = '0001'.
    APPEND it_bapiacap09.
    CLEAR it_bapiacap09.
    lw_vendor-wrbtr  = -1 * lw_vendor-wrbtr.
    it_bapiaccr09-itemno_acc   = idx.
    it_bapiaccr09-currency_iso = 'INR'.
    it_bapiaccr09-amt_doccur   = lw_vendor-wrbtr .
    it_bapiaccr09-amt_base     = lw_vendor-wrbtr.
    APPEND it_bapiaccr09.
    CLEAR :it_bapiaccr09.

  ENDLOOP.


ENDFORM.                    " VENDOR_PAYABLE
*

Regards

Nilesh

0 Kudos

Hi Nilesh,

Thanks a lot for your reply. But, in each Line Item can I give different Vendor Number. Which means paying 10 different vendors in one document. Do you understand what I mean. I tried doing this is SE37 by giving the input values in the AccountsPayable table with 10 vendors numbers. But, it is throwing an error message saying that the Document Type can only have one Vendor Number!!

Is there any option to resolve this problem. I would appreciate your help.

Regards,

Gopal.

0 Kudos

Hi Gopal

I got your requirement if look at the code i loop the vendor internal table with multiple vendor and passed to bapiacap09 table .

it is work fine.

Regards

Nilesh.

0 Kudos

Hi Gopal

I got your requirement if look at the code i loop the vendor internal table with multiple vendor and passed to bapiacap09 table .

it is work fine.

Regards

Nilesh.

0 Kudos

Hi Gopal

I got your requirement if look at the code i loop the vendor internal table with multiple vendor and passed to bapiacap09 table .

it is work fine.

Regards

Nilesh.

0 Kudos

It has any sense doing that?

Each vendor you enter is an account, and you have to sum 0 with the other accounts.

Example:

Vendor1 .... 1000u20AC

Account1.... -500u20AC

Account2.... -500u20AC

SUM = 0

Financially correct

Vendor1.... 1000u20AC

Vendor2.... 1000u20AC

Vendor3.... 1000u20AC

Account1.... -1000u20AC

Account2.... -1000u20AC

Account3.... -1000u20AC

SUM = 0. OK but financially not correct....

0 Kudos

Hi Jose,

Thanks a lot for your reply. Why is that the second method financially not Correct? Could you please explain me. I would appreciate your help.

Regards,

Gopal.

0 Kudos

Hello,

Any updates/suggestions Please

Regards,

Gopal