cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_ACC_INVOICE_RECEIPT_POST

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I used it a lot of times, but i dont have an example program with me.

I dont know what fields you need help, but here go something that can help you:

DOCUMENTHEADER:

OBJ_TYPE: This field must be IBKPF

OBJ_KEY: This is an unique key. For example, SAP create it with company code, document number and fiscal year. But if your document class is to internal numbered, you must invent your own way to create this number. For example, you can put an identifier to the process "0001" and then use a range number (SNRO) to get next number.

OBJ_SYS: Is the name of the locial system asociated to the client where you are using the BAPI. (This is client customizing).

USERNAME: Obligatory, sy-uname.

HEADER_TXT: text

OBJ_KEY_R: Not necesary

COMP_CODE: Company Code (BUKRS)

AC_DOC_NO: Only if the document class is customized like external numbered.

FISC_YEAR: Not necesary

DOC_DATE: Obligatory (BLDAT)

PSTNG_DATE: Obligatory (BUDAT)

TRANS_DATE: Not necesary

FIS_PERIOD: Not necesary

DOC_TYPE: Obligatory (BLART)

REF_DOC_NO: Ref. Number (XBLNR).

COMPO_ACC: Not necesary

REASON_REV: Not necesary

CUSTOMERCPD:

This segment is necesary only if you use a CPD Vendor (One time vendor)...

ACCOUNTPAYABLE:

This segment is use to vendor item in the document. You will note that you can't put the post key, the BAPI put a 21 if amount is positive and 31 if it is negative.

ITEMNO_ACC: Is obligatory, this field let you to asign the amount segment, with this segment.

VENDOR_NO: Vendor Number...

The others fields are the fields in bseg (document item)... you would see wich ones you need to feel. The fields that are not incuded here, you must send them in the EXTENSION segment and then move then in the user exit.

ACCOUNTGL: The same that last segment, but for gl accounts items.

ACCOUNTTAX: The same that last segment, but for Tax items.

CURRENCYAMOUNT: You have to add one of this segment for each of the other 3 segments that you put. You ralacionate with the ITEMNO_ACC field.

CURR_TYPE: is the type of currency (local, company or gobal)

AMT_DOCCUR: the amount, you must put it with sign (not necesary if is +).

The other segments are used to PA posting...

The segment EXTENSION1 have four fields of 250 characters each. It is used to send fields, that are not included in the header of items segments. You can move then to estructures (ACCIT for items, ACCHD for header) in the user exit ACBAPI01, component EXIT_SAPLACC4_001.

If you need more help, just ask...

Enjoy...

PabloX

0 Kudos

Pablo, I was able to call it with no errors, although I had to place 0's in both itemno_acct. Otherwise I get an error: Type: "E", ID: "F5" Message: "balance in currency transaction".

I´m not sure if IBKPF is the correct object_type value I should use since that refers to an IDoc and I´m not using an IDoc. I tried BKKSU, BKPFF and BKPFI all with the same results.

Any ideas?

Thank you for your help.

Paolo

Former Member
0 Kudos

Hi Paolo,

The problem with currencies, is that you have to put sign. And the negative amounts must be the same that the positive one. For example, if you only put 2 items, and the first is 100, the second one must be -100.

About Object Type, you have to read documentation to decide the correct one. I am using IBKPF because i am using IDocs. I think that all BKPF should give same result.

Regards

PabloX

0 Kudos

thank you. that solved it.

Former Member
0 Kudos

Hello

I have a question... What happen with ACCT_KEY from ACCOUNTGL?... Because I need to generate a 31 posting key and a 25 posting key... At least this what actually FB01 does.

I know that 31 posting key is made at the moment of execute a ITEM in ACCOUNTPAYABLE with negative sign, but i dont know what i have to do to include a 25 posting key.

Former Member
0 Kudos

Hola Abel,

I dont think that ACCT_KEY field can be used to choose the account posting key.

You have to use extension segment to send the acct_key if you need one that it is not 31 or 21. Remember extension segment is a segment with four fields, with 250 character each. And you have the user exit (component EXIT_SAPLACC4_001) to move this values.

I think the best way is to create a new structure in abap dictionary, to re-define each field of extension segment.

For example: i can create the following structure called ZEXT:

ITEMNO_ACC POSNR_ACC NUMC 10

BSCHL BSCHL CHAR 2

Then, in the user exit, i can code:

DATA: v_zext LIKE zext.

LOOP AT EXTENSION.

MOVE EXTENSION-FIELD1 TO v_zext.

LOOP AT t_accit where posnr EQ v_zext-itemno_acc.

MOVE v_zext-bschl TO t_accit-bschl.

MODIFY t_accit.

ENDLOOP.

ENDLOOP.

Of course, you have use extension in the same way to send any other field that is not in any other segment.

Regards,

PabloX.

0 Kudos

We are receiving a message saying that the accounting was done successfully after executing this BAPI. The message includes a reference number to a document. If we look for the document, it does´nt exist! There´s no record showing that the accounting was in fact realized. It seems as though the transaction was not committed for some reason.

Does anyone have an idea why this is happening?

Thanks

Former Member
0 Kudos

Hi Microsoft,

Whenever you call a BAPI you need to follow up with a BAPI_TRANSACTION_COMMIT.

This must be done in the same logical unit of work (LUW). If you are testing the BAPI in SE37 you will need to create a test sequence (refer to ).

If you are calling the BAPI externally, then you will need to call the bapi and the commit in one connection.

Hope that helps.

Brad

0 Kudos

Thanks for the idea Brad. We actually tried it from our application but we couldn´t get it to compile. What we did was to copy the BAPI´s code and included a call to "Commit Work". That solved our problem.

Thanks to all.

Former Member
0 Kudos

Hi,

I am currently using the above BAPI for FB01. I gave parameters as below:

DOCUMENTHEADER

OBJ_TYPE BKPF

OBJ_KEY 123456789 (Unique number)

OBJ_SYS SAPDEV015 (SAPsy-sysidclient)

USERNAME DSOMANI (User id)

HEADER_TXT TESTING

COMP_CODE US10

FISC_YEAR 2005

DOC_DATE 10.08.2005

PSTNG_DATE 10.08.2005

ACCOUNTPAYABLE

ITEMNO_ACC 0000000001

VENDOR_NO C1000

ACCOUNTGL

ITEMNO_ACC 0000000002

GL_ACCOUNT 611030

COMP_CODE US10

DOC_TYPE Z7

FISC_YEAR 2005

FIS_PERIOD 08

TAX_CODE V1

ITEM_TEXT Commision accurals

COSTCENTER 2000-03

CURRENCYAMOUNT

ITEMNO_ACC 0000000001

CURR_TYPE 00

CURRENCY USD

CURRENCY_ISO

AMT_DOCCUR 1,0001

ITEMNO_ACC 0000000002

CURR_TYPE 00

CURRENCY USD

CURRENCY_ISO

AMT_DOCCUR 1,0002

In our case we need to have Commissions accured only for G/L acc and Vendor items and hence only 2 line items in CURRENCYAMOUNT.

However, after executing, I am getting error as:

"Error in document: BKPF 123456789 SAPDEV015;

Incorrect entry in field OBJ_TYPE: BKPF "

Can anyone tell me how to rectify it?

Thanks in advance.

Debs

Answers (0)