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

Regarding BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
2,039

Hi All,

In my report prgram iam using BAPI_ACC_DOCUMENT_POST to post Open Purchase orders.

I am passing the following parameters to BAPI

Document Header (BAPIACHE09)

u2022 HEADER_TXT = AUGUST

u2022 COMP_CODE = C001

u2022 DOC_DATE = SYDATUM

u2022 PSTNG_DATE = SYDATUM

u2022 DOC_TYPE = u201C ZO u201C

u2022 XREF1_HD = 'PROVISION'( Enhance BAPI to include this field from BKPF)

Table ACOUNTGL

a. GL_ACCOUNT = 2106000001

b. ITEM_TEXT = AUGUST

c. ACCT_TYPE = u201C S u201C

d. COMP_CODE = C001

e. WBS_ELEMENT = NFOSYS_TEST3_FOR_SRM1

f. PO_Number(BSEG-EBELN) = 1200000006

g. PO_line item(BSEG-EBELP) = 00010

Table CURRENCY AMOUNT

a. CURRENCY = RMB

b. AMT_DOCCUR = 0.00

I am taking all the above values in internal table and then passing these parameters to the BAPI.

However, in the return table there is an error message like

"FI/CO interface: Inconsistent FI/CO line item data for updating".

Can some one tell me hw to rectify this error.

Also i want to know

1) the purpose of BAPI_TRANSACTION_COMMIT.

2) Hw will i know whether a document is posted successfully or not?

3) Hw to capture document num created by the BAPI?

Regards

Balu

9 REPLIES 9
Read only

Former Member
0 Likes
1,233

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = wa_account_header

TABLES

accountgl = it_accountgl

accountpayable = it_account_pay

currencyamount = it_currency_amount

return = it_bapi_return.

CLEAR v_lineitem.

v_lineitem = 1.

LOOP AT it_bapi_return INTO wa_type_bapi_return.

-


To Save Success Record Through BAPI Commit----


IF wa_type_bapi_return-type = c_suc .''if it is success

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

ENDLOOP .

try to use like this .

'BAPI_TRANSACTION_COMMIT' will Update the database.

you can check in BAPIRET2 structure to find the error or success records.

Read only

Former Member
0 Likes
1,233

Hi Balu,

This is because you are trying to pass only one line item for this BAPI you need to have a balance amount[D/C] so please add one more line item for amount and GL Structure and then pass to get the results.

Thanks

Sudharshan

Read only

0 Likes
1,233

Hi,

thnks for ur response.

Output of my report will be similar to the below one.

PO amount currency gl_account check_box

1000 10 inr 00000107 X

1002 20 inr

For each chekbox being checked, bapi will be called.

hence there will be only one line item per PO selected for posting. Can u suggest me hw do i add one more line item for amount and GL structure?

Regards

Balu

Read only

0 Likes
1,233

Hi Balu ,

You can do one thing is create a dummy line item for the selected box,here you pass all the information of the line same only you have to change the sign of the amount field in the second line to make it balance.

Thanks

Sudharshan

Read only

0 Likes
1,233

thnks for ur suggestion Sudharshan, i'm working on it let me see wt will happen.

Read only

0 Likes
1,233

Hi Balu,

I hope you are using CHECK BAPI to check the line item is error free and if everything is okay then you can use POST BAPI.

Thanks

Sudharshan

Read only

Former Member
0 Likes
1,233

Hi,

1) the purpose of BAPI_TRANSACTION_COMMIT.

there are some FM that we use for creating trasaction . for example FM : that use for creating production order . if you execut the FM , the system will not create any data in the system so you need to excute the FM : BAPI_TRANSACTION_COMMIT to commit that creating the production order .

in case of commit work, that is a syntax in abap program . if you use this syntax after you insert ,update or delete table in the sap ,system will do it immediately otherwise the system will do it after execution is complete.

2) Hw will i know whether a document is posted successfully or not?

In the importing parameters you have a Return table in which you will have the messages just loop

through the table and read the table where type = s (success).

3) Hw to capture document num created by the BAPI?

After you call the BAPI_ACC_DOCUMENT_POST with correct parameters, the FI document (in your case vendor invoice) should be successfully posted and return table RETURN filled with system messages. Now loop at/read table RETURN with field TYPE = 'S' and ID = 'RW' and NUMBER = '605'. (These values have been hard-coded within the BAPI code by SAP - so you need not worry). If the read was successful, the document number posted will be the first 10 characters in the field MESSAGE_V2 in table RETURN.

Regards,

Raj.

Read only

Former Member
0 Likes
1,233

Hi Balu,

I am not clear with yor requirement as you have updated could please explain me more or atleast give me your code to analyse.

Thanks

Sudharshan

Read only

Former Member
0 Likes
1,233

thnks