2016 Jan 25 1:17 AM
Dear All,
Can you please suggest how can I set Calculate Tax(BKPF-XMWST) check box in BAPI_ACC_DOCUMENT_POST.
Thanks,
Surya
2016 Jan 25 2:05 AM
Hi Surya,
To set calculate tax, you need to implement a BADI 'ACC_DOCUMENT' method 'IF_EX_ACC_DOCUMENT~CHANGE'.
You need to pass on the extension2 parameters of the FM ,and then within the FM ,above mentioned BADI is triggered before posting the document, so that calculate tax can be enabled.Below code for BADI can be helpful
method IF_EX_ACC_DOCUMENT~CHANGE.
DATA: wa_extension TYPE bapiparex,
ext_value(960) TYPE c,
wa_accit TYPE accit,
l_ref TYPE REF TO data.
FIELD-SYMBOLS: <l_struc> TYPE ANY,
<l_field> TYPE ANY.
constants : lco_posnr1 TYPE posnr_acc VALUE '0000000001'.
SORT c_extension2 BY structure.
*in this peace of code will activate the field for calculating tax automatically
LOOP AT c_extension2 INTO wa_extension where structure = 'BAPIACHE09'.
IF wa_extension-valuepart1 = 'XMWST'.
LOOP AT c_accit INTO wa_accit WHERE POSNR = lco_posnr1 ."KUNNR IS NOT INITIAL.
wa_accit-xmwst = 'X'.
MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING xmwst.
ENDLOOP.
ENDIF.
ENDLOOP.
endmethod.
*-->Filling BAPI extension for calculate tax in the program
lwa_extnsn-structure = 'BAPIACHE09' "lco_extnstr.
lwa_extnsn-valuepart1 = 'XMWST'. "lco_extnfld.
APPEND lwa_extnsn TO lit_extnsn.
*-->Check accounting Document to be posted is correct
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = lwa_dochdr
* CUSTOMERCPD =
* CONTRACTHEADER =
TABLES
accountgl = lit_accgl
accountreceivable = lit_accrcvble
* ACCOUNTPAYABLE =
accounttax = lit_acctax
currencyamount = lit_curamt
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
return = lit_return
* PAYMENTCARD =
* CONTRACTITEM =
extension2 = lit_extnsn.
Note : Filling field names in extension2 and thereby identifing them in BADI is very specific to requirement.As per the existing previous BADI implementions in my system I followed this procedure.
Regards
Pallavi
2016 Jan 25 7:29 AM
Many thanks Pallavi
f
BADI implementation created but when I run the FM this method is not running since it's depends on Filter values.
Please let me know which value I have to specify.
Note:
I specified BKPF in filter value
Thanks,
Surya
2016 Jan 25 9:03 AM
Hi surya,
Specify BKPFF as filter value.
Hope this will be helpful.
Regards
Pallavi
2016 Jan 25 9:49 AM
Hi Pallavi,
It's working now, few more details please.
I filled these three tables
ACCOUNTGL -- this record item_acc number as 1
ACCOUNTPAYABLE -- this record item_acc number as 2
ACCOUNTTAX -- this record item_acc number as 3
I think this numbering is not correct. can you please provide the inputs on this while adding the data to these tables.
Thanks,
Surya
2016 Jan 25 10:11 AM
2016 Jan 25 7:49 AM
Could you also consider solution provided in 1873588 - Filling tax information for BAPIs
(and its correction 2070697 - Filling tax information for BAPIs , if required)
Regards,
Raymond