Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

line-by-line tax issue while invoice posting

$
0
0

Lately I was working on a requirement where in I had to post an invoice from an idoc.

I have used BAPI_ACC_INVOICE_RECEIPT_POST to post the document.

 

While I used BAPI_ACC_INVOICE_RECEIPT_POST, I was able to post documents with TAX lines for some Jurisdiction Code Structure but for some I couldn't.

Bapi threw error - "Taxes by item is activated; consequently, transfer by item is mandatory." (FF-818)


Later I found the reason being due to a configuration in transaction OBCO, where a checkbox for "tax line-by-line" is checked.

1.JPG

This config meant that for each of line item entered in FB60 or BAPI, tax needs to be calculated individually. In other words, each line item in ACCOUNTGL structure for the bapi has to be linked with corresponding line item of ACCOUNTTAX.


Changing the config was out of question. And after a lot of research I came up with below solution:

 

1. Fill BAPI extension with a random value

 

      ls_extn-field1 = 'TAXLINE'.

      ls_extn-field2 = ls_accountgl-itemno_acc.

      APPEND ls_extn TO gt_extn1.

      CLEAR: ls_extn.

 

2. This extension will be passed to user exit ZXACCU15, where we link ACCOUNTGL with  ACCOUNTTAX.

 

FIELD-SYMBOLS: <fs_accit> TYPE accit.

FIELD-SYMBOLS: <fs_acctx> TYPE accbset.

 

 

READ TABLE extension WITH KEY field1 = 'TAXLINE'.

  IF sy-subrc EQ 0. 

    LOOP AT t_accit ASSIGNING <fs_accit>.

      <fs_accit>-taxps = 000001.

    ENDLOOP.

 

    LOOP AT t_acctx ASSIGNING <fs_acctx>.

      <fs_acctx>-taxps = 000001.

    ENDLOOP.

  ENDIF.

UNASSIGN: <fs_accit>, <fs_acctx>.

 

Linking taxps fields of both structures ensures calculating tax for each item separately.

 

 

Alternatively if we are using "BAPI_ACC_DOCUMENT_POST", solution is simpler


***Because of the implementation of the new notes (1886654 and 1982803) by SAP,

***  we need to pass the itemno_tax field in the BAPI. Otherwise, we get a lin-by-line tax issue

***  Hard-coding the value to 000001

      ls_tax_accnt-itemno_tax = 000001 and ls_accntgl-itemno_tax = 000001.

 

we have this field itemno_tax in both ACCOUNTGL and ACCOUNTTAX structures in common, which will ensure calculation of tax for each line item individually.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>