Application Development and Automation 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: 
Read only

Problem in posting in FB01 using BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
1,625

Hi all,

I am trying to post document in FB01 using bapi BAPI_ACC_DOCUMENT_POST.My requirement is to post document by uploading related data from file.

Data format is as follows:


Doc	Company Code	Post Date	Doc Date	Header Text	Currency	PK	GL Account	Amount	Tax Code	Cost Center	Line item text	Tax amount	Ignore
KA	7150	20090831	20090831	NDF 08/2009	EUR	40	609600	150.18	V1	310169	6593NDF 08/2009 PINAULT	0	NOTE DE FRAIS STANDARD             


here,
i have following fields in excel sheet
Doc type: KA
comp code: 7150
post date:....
doc date:..
HEader  text: NDF 08/2009	EURPINAULT
currency:EUR
PK: 40
GL accnt..
Amount:377.73
tax code: v1
cost cntr: 310169
line item text:--
tax amount :
ignore:

In BApi i can pass only few fields,

but to pass rest of the fields such as post key and gl account for next line item,i am not getting how to proceed.

The required doc will look like this,which will have line items also:


 Doc.type : KA ( Vendor document ) Normal document
 Doc. Number    1700000034       Company code    7150         Fiscal year     2009
 Doc. date      09/25/2009       Posting date    09/25/2009   Period          12
 Doc.currency   EUR
 Doc.head.text  NDF 08/2009


Itm PK Account    Account short text   Assignment         Tax Jur.        Tx Cost Ctr             Amount Material

  1 40 617300     Mileage              0000310148                            310148               27.20
  2 40 617900     Entertainment Exp.   0000310148                         V1 310148              177.26
  3 40 144000     Input-VAT            20090925                           V4                      34.74
  4 31 1019186    B.E.N. MR SAUVAT                                        V1                     239.20-

Please help me in this ,how should i proceed.

Your valuable suggestions be appreciated.

Best regards,

Meenakshi

Edited by: meenakshi239 on Sep 30, 2009 2:27 PM

5 REPLIES 5
Read only

christine_evans
Active Contributor
0 Likes
985

This BAPI has lots of input table structures with associated help screens for you to read. ACCOUNTGL may be a good place to start.

ACCOUNTGL	LIKE	BAPIACGL09
ACCOUNTRECEIVABLE	LIKE	BAPIACAR09
ACCOUNTPAYABLE	LIKE	BAPIACAP09
ACCOUNTTAX	LIKE	BAPIACTX09
CURRENCYAMOUNT	LIKE	BAPIACCR09
CRITERIA	LIKE	BAPIACKEC9
VALUEFIELD	LIKE	BAPIACKEV9
EXTENSION1	LIKE	BAPIACEXTC
RETURN	LIKE	BAPIRET2
PAYMENTCARD	LIKE	BAPIACPC09
CONTRACTITEM	LIKE	BAPIACCAIT
EXTENSION2	LIKE	BAPIPAREX
REALESTATE	LIKE	BAPIACRE09
ACCOUNTWT	LIKE	BAPIACWT09

Read only

0 Likes
985

But,how to get the line items here through BAPI

Read only

Former Member
0 Likes
985

Hi

The main parameters of BAPI BAPI_ACC_DOCUMENT_POST are:

- DOCUMENTHEADER (BAPIACHE09) to transfer the header data

- ACCOUNTGL (BAPIACGL09) to transfer the g/l item data

- ACCOUNTRECEIVABLE (BAPIACAR09) to transfer the customer item data

- ACCOUNTPAYABLE (BAPIACAP09) to transfer the vendor item data

So u need to use one of parameters above to transfer the header and item data, the amount data for every item have to be transfered by parameters CURRENCYAMOUNT

U should also considere the posting key is automatically set by BAPI, and it depends on the item type and the sign of amount:

- 40/50 for G/l

- 01/11 for customer

- 21/31 for vendor

1 40 617300     Mileage              0000310148                            310148               27.20
2 40 617900     Entertainment Exp.   0000310148                         V1 310148              177.26
3 40 144000     Input-VAT            20090925                           V4                      34.74
4 31 1019186    B.E.N. MR SAUVAT                                        V1                     239.20-

Lines 1/2 data move to ACCOUNTGL and CURRENCYAMOUNT

Line 4 data move to ACCOUNTPAYABLE and CURRENCYAMOUNT

The line 3 seems to be a TAX line, in this case u need to use ACCOUNTTAX and CURRENCYAMOUNT

The header data to be transfered to DOCUMENTHEADER

Max

Read only

Former Member
0 Likes
985

Thank you all.I used BDC instead of BAPI and it worked.

Read only

Former Member
0 Likes
985

Hi,

I done FB01 posting with all the feilds using BDC.

For that i written some code in recorded code.

I splitted the data into header & Item data.

Loop the header data. In that Loop the item table with reference to ref document no.

& using call transaction syntax.

Thank u,

Nagaphani