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: 

Unable to fing tax amount in BAPI_ACC_DOCUMENT_POST

Former Member
0 Kudos

Hi,

Please can any one tell how to pass tax amount(bset-fwste) in bapi_acc_document_post. This is really important. I have searched all the structures and also tried filling TAX_AMT field in currency structure,but that din't work. Should this field be passed through extension? If so can you please mention to which field we have to field this value.Please advice.

I have searched the forums but I din't get the exact answer.

Thanks in advance.

Neelima.

7 REPLIES 7

Former Member
0 Kudos

Hi..

As far as i know you will not pass the tax amout to the BAPI

wht u need to pass is the tax code and the gl account and item number.

for that u use the structure bapiactx09

It takes the vendor/custmer line item amount and calculates the tax..

Regards

Ansari

0 Kudos

Hi,

Thanks for the reply. Usually we do not pass the tax amount as you said but as per our requirement the Legacy system is sending the tax amount and SAP have to post the invoices with tax amount. Please suggest.

Neelima.

Former Member
0 Kudos

Hi ,

For this BAPI you have to provide documentheader(structure BAPIACHE09) information. I used this BAPI in my program.

Former Member
0 Kudos

Hi ,

Please see the Where used list of this BAPI, you will get an idea.

0 Kudos

i hope you will be able to read it. in case any problem please reply.

Former Member
0 Kudos

Check this. your problem may be solved

*&---HEADER DECLARATION

DATA: HEADER TYPE BAPIACHE09. " HEADER DATA

*&----G/L ACCOUNT ITEM

DATA: ACCOUNTGL TYPE STANDARD TABLE OF BAPIACGL09.

*&----ACCOUNTS PAYABLE ITEMS

DATA: ACCOUNTPAYABLE TYPE STANDARD TABLE OF BAPIACAP09.

DATA: WA_ACCOUNTPAYABLE TYPE BAPIACAP09.

*&---CURRENCY ITEMS

DATA: CURRENCY_AMOUNT TYPE STANDARD TABLE OF BAPIACCR09.

*&----RETURN PARAMETER

DATA: RETURN TYPE STANDARD TABLE OF BAPIRET2 with header line.

**********************************************************************

  • WORK-AREA DECLARATION

**********************************************************************

*&----WORKAREA FOR G/L ACCOUNT ITEM

DATA: WA_ACCOUNTGL TYPE BAPIACGL09.

*&---WORKAREA FOR CURRENCY ITEMS

DATA: WA_CURRENCY_AMOUNT TYPE BAPIACCR09.

data :ACCOUNTRECEIVABLE TYPE STANDARD TABLE OF BAPIACAR09,

ACCOUNTTAX TYPE STANDARD TABLE OF BAPIACTX09,

CURRENCYAMOUNT TYPE STANDARD TABLE OF BAPIACCR09,

CRITERIA TYPE STANDARD TABLE OF BAPIACKEC9,

VALUEFIELD TYPE STANDARD TABLE OF BAPIACKEV9,

EXTENSION1 TYPE STANDARD TABLE OF BAPIACEXTC,

PAYMENTCARD TYPE STANDARD TABLE OF BAPIACPC09,

CONTRACTITEM TYPE STANDARD TABLE OF BAPIACCAIT,

EXTENSION2 TYPE STANDARD TABLE OF BAPIPAREX,

REALESTATE TYPE STANDARD TABLE OF BAPIACRE09,

ACCOUNTWT TYPE STANDARD TABLE OF BAPIACWT09.

**********************************************************************

INITIALIZATION.

**********************************************************************

**HEADER-OBJ_TYPE = 'BEBD'.

**HEADER-OBJ_KEY = '1000000050'.

**HEADER-OBJ_SYS = 'DEVCLNT300'.

HEADER-HEADER_TXT = 'TEST HEADER'.

HEADER-USERNAME = 'PUSHPA'.

HEADER-COMP_CODE = '5800'.

HEADER-FISC_YEAR = '2008'.

HEADER-DOC_DATE = SY-DATUM.

HEADER-PSTNG_DATE = SY-DATUM.

HEADER-TRANS_DATE = SY-DATUM.

HEADER-DOC_TYPE = 'SA'.

HEADER-BUS_ACT = 'RMRP'.

WA_ACCOUNTGL-ITEMNO_ACC = '0000000010'.

WA_ACCOUNTGL-GL_ACCOUNT = '0007100019'.

WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.

WA_ACCOUNTGL-DE_CRE_IND = 'S'.

*wa_accountgl-costcenter = 'JK000'.

WA_ACCOUNTGL-WBS_ELEMENT = 'AUP.07.RV.RV.07.1.1'.

*WA_ACCOUNTGL-VENDOR_NO = 'A125'.

WA_ACCOUNTGL-REF_KEY_3 = '31'.

APPEND WA_ACCOUNTGL TO ACCOUNTGL.

CLEAR WA_ACCOUNTGL.

WA_ACCOUNTGL-ITEMNO_ACC = '0000000020'.

WA_ACCOUNTGL-GL_ACCOUNT = '0007100019'.

WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.

WA_ACCOUNTGL-DE_CRE_IND = 'H'.

*wa_accountgl-costcenter = 'JK000'.

WA_ACCOUNTGL-WBS_ELEMENT = 'AUP.07.RV.RV.07.1.2'.

WA_ACCOUNTGL-REF_KEY_3 = '40'.

APPEND WA_ACCOUNTGL TO ACCOUNTGL.

CLEAR WA_ACCOUNTGL.

*WA_ACCOUNTPAYABLE-ITEMNO_ACC = '10'.

*WA_ACCOUNTPAYABLE-VENDOR_NO = 'A125'.

*WA_ACCOUNTPAYABLE-REF_KEY_3 = '31'.

*WA_ACCOUNTPAYABLE-BUS_AREA = 'JKTD'.

*

*APPEND WA_ACCOUNTPAYABLE TO ACCOUNTPAYABLE.

*CLEAR WA_ACCOUNTPAYABLE.

*

*

*WA_ACCOUNTPAYABLE-ITEMNO_ACC = '20'.

*WA_ACCOUNTPAYABLE-GL_ACCOUNT = '400200'.

*WA_ACCOUNTPAYABLE-REF_KEY_3 = '40'.

*WA_ACCOUNTPAYABLE-BUS_AREA = 'JKTD'.

*

*APPEND WA_ACCOUNTPAYABLE TO ACCOUNTPAYABLE.

*CLEAR WA_ACCOUNTPAYABLE.

*

WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000010'.

WA_CURRENCY_AMOUNT-AMT_DOCCUR = '500'.

WA_CURRENCY_AMOUNT-CURRENCY = 'INR'.

APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.

CLEAR WA_CURRENCY_AMOUNT.

WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000020'.

WA_CURRENCY_AMOUNT-AMT_DOCCUR = '-500'.

WA_CURRENCY_AMOUNT-CURRENCY = 'INR'.

APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.

CLEAR WA_CURRENCY_AMOUNT.

**************************************************************

  • START-OF-SELECTION

**************************************************************

START-OF-SELECTION.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = HEADER

  • CUSTOMERCPD =

  • CONTRACTHEADER =

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

TABLES

ACCOUNTGL = ACCOUNTGL

  • ACCOUNTRECEIVABLE = ACCOUNTRECEIVABLE

  • ACCOUNTPAYABLE = ACCOUNTPAYABLE

  • ACCOUNTTAX = ACCOUNTTAX

CURRENCYAMOUNT = CURRENCY_AMOUNT

  • CRITERIA = CRITERIA

  • VALUEFIELD = VALUEFIELD

  • EXTENSION1 = EXTENSION1

RETURN = RETURN

  • PAYMENTCARD = PAYMENTCARD

  • CONTRACTITEM = CONTRACTITEM

  • EXTENSION2 = EXTENSION2

  • REALESTATE = REALESTATE

.

IF return-type EQ 'S'.

COMMIT WORK.

*CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    • EXPORTING

    • WAIT =

  • IMPORTING

  • RETURN = RETURN

  • .

WRITE:/ RETURN-TYPE.

write:/ return-message.

ELSE.

WRITE:/ RETURN-TYPE.

write:/ return-message.

ENDIF. .

0 Kudos

Hi,

Thanks for the reply.

The sample code you have send is correct for posting the doucment but dose not post the document with tax amount.

When a document is posted with the tax amount a seperate line item is created with the tax amount(when posted using fb01).

Neelima.