BAPI_ACC_INVOICE_RECEIPT_POST - can it calculate taxes
Hi folks,
I've serious problems with this BAPI. Thing is that I get document data for posting via IDoc INVOIC01.
Now I want to map this data into structures of BAPI BAPI_ACC_INVOICE_RECEIPT_POST to post document via RFC in another system. Idoc data don't contain tax data.
I expected that this BAPI can calculate tax, but it seems like I have to calculate tax one my own. This logic is to difficult.
Is there a way to start the BAPI so that it calculates the tax internally and creates the line items accordingly???
Thanks and best regards, Thomas
Hi folks,
I've serious problems with this BAPI. Thing is that I get document data for posting via IDoc INVOIC01.
Now I want to map this data into structures of BAPI BAPI_ACC_INVOICE_RECEIPT_POST to post document via RFC in another system. Idoc data don't contain tax data.
I expected that this BAPI can calculate tax, but it seems like I have to calculate tax one my own. This logic is to difficult.
Is there a way to start the BAPI so that it calculates the tax internally and creates the line items accordingly???
Thanks and best regards, Thomas
Similar Messages
-
BAPI_ACC_INVOICE_RECEIPT_POST how to calculate tax
Hallo folks,
i can't figuere out how to calculate the tax with the bapi BAPI_ACC_INVOICE_RECEIPT_POST. I already searched the Forums and google but no Solution helped me.
I don't really get it, which fields i have to fill. For example i do i have to fill the amt_base for every item or just for the tax structure?
ls_accgl-comp_code = ls_outtab-zzfaleiemp.
ls_accgl-tax_code = 'V3'.
ls_accgl-profit_ctr = ls_outtab-prctr.
ls_accgl-sales_ord = ls_outtab-kdauf.
ls_accgl-s_ord_item = ls_outtab-kdpos.
APPEND ls_accgl TO lt_accgl.
CLEAR ls_curamt.
ls_curamt-itemno_acc = l_itemno.
ls_curamt-currency_iso = 'EUR'.
ls_curamt-amt_doccur = ls_outtab-zzsum.
ls_acctax-itemno_acc = l_itemno.
ls_acctax-tax_rate = '19.000'.
ls_acctax-gl_account = ls_accgl-gl_account.
ls_acctax-tax_code = 'V3'.
ls_acctax-acct_key = 'VST'.
ls_acctax-cond_key = 'MWVS'.
APPEND ls_acctax TO lt_acctax.
CLEAR ls_curamt.
ls_curamt-itemno_acc = l_itemno.
ls_curamt-currency = 'EUR'.
* ls_curamt-amt_doccur = l_sum.
ls_curamt-amt_base = l_sum.
APPEND ls_curamt TO lt_curamt.
Because it doesn't matter what field i fill in TA FB03 there never come any taxes up.
has anybody some Ideas?
Best regards
MathiasHi,
check the below code
Read Invoice Work item data
CLEAR: lwa_inv_header.
SELECT SINGLE * INTO lwa_inv_header
FROM zbw_inv_header
WHERE zinv_id = i_documentheader-zinv_id.
IF sy-subrc = 0.
Get history line count
SELECT COUNT(*) INTO lv_hist_lineid
FROM zbw_wi_history
WHERE zinv_id = i_documentheader-zinv_id.
Get exception line count
SELECT COUNT(*) INTO lv_lineid
FROM zbw_wi_exception
WHERE zinv_id = i_documentheader-zinv_id.
Get document type
SELECT SINGLE zdoctype INTO lv_doc_type
FROM zbw_doc_types
WHERE zinvtype = i_documentheader-zinvoicetype AND
zinvind = i_documentheader-invoice_ind.
IF sy-subrc <> 0.
CLEAR t_return.
t_return-ztype = 'E'.
t_return-zmessage = 'Document type configuration is not done'.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
Read posting date config
SELECT SINGLE * INTO lwa_posting
FROM zbw_posting_date
WHERE zarea = i_documentheader-zinvoicetype.
IF sy-subrc <> 0.
CLEAR t_return.
t_return-ztype = 'E'.
t_return-zmessage = 'Posting date configuration is not done'.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
IF lwa_posting-zcurrentdate = 'X'.
Todays date as posting date
lwa_documentheader-pstng_date = sy-datum.
ELSE.
lv_today = sy-datum.
CLEAR: lv_days,
lv_months,
lv_years,
lv_calcdt.
Calculate last day of previous month as posting date
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = lv_today
days = lv_days
months = lv_months
signum = '-'
years = lv_years
IMPORTING
calc_date = lv_calcdt.
IF sy-subrc <> 0.
CLEAR t_return.
t_return-ztype = 'E'.
CONCATENATE 'Error while calculating the'
'Last day of previous month'
INTO t_return-zmessage SEPARATED BY space.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = lv_calcdt
IMPORTING
last_day_of_month = lwa_documentheader-pstng_date
EXCEPTIONS
day_in_no_date = 1
OTHERS = 2.
ENDIF.
Populate the header data
lwa_documentheader-obj_type = 'IBKPF'.
CONCATENATE sy-datum sy-uzeit lwa_documentheader-comp_code
INTO lwa_documentheader-obj_key.
lwa_documentheader-obj_sys = sy-sysid.
lwa_documentheader-username = sy-uname.
lwa_documentheader-header_txt = 'HD BAPI Test'.
lwa_documentheader-comp_code = i_documentheader-comp_code.
lwa_documentheader-fisc_year = i_documentheader-zfisc_year.
lwa_documentheader-doc_date = i_documentheader-doc_date.
lwa_documentheader-trans_date = sy-datum.
lwa_documentheader-fis_period = i_documentheader-zfisc_period.
lwa_documentheader-doc_type = lv_doc_type.
ALL ITEM DATA *
Populate Account payble data
CLEAR lt_accountpayable.
lt_accountpayable-itemno_acc = 1.
lt_accountpayable-vendor_no = i_documentheader-zvendor.
lt_accountpayable-item_text = 'Webdesk invoice posting'.
APPEND lt_accountpayable.
clear lt_accountpayable.
Populate the currency for Account payble
CLEAR lt_currencyamount.
lt_currencyamount-itemno_acc = 1.
lt_currencyamount-currency = i_documentheader-currency.
lt_currencyamount-amt_doccur = i_documentheader-gross_amount * -1.
APPEND lt_currencyamount.
clear lt_currencyamount.
Loop the GL table
CLEAR lv_errfl.
LOOP AT t_glacc.
CONCATENATE i_documentheader-supcountry t_glacc-tax_code
INTO lv_vakey SEPARATED BY space.
SELECT knumh INTO lv_knumh
UP TO 1 ROWS
FROM konh
WHERE vakey = lv_vakey.
ENDSELECT.
IF sy-subrc = 0.
SELECT SINGLE kbetr INTO lv_kbetr
FROM konp
WHERE knumh = lv_knumh.
IF sy-subrc <> 0.
lv_errfl = 'X'.
ENDIF.
ELSE.
lv_errfl = 'X'.
ENDIF.
lv_kbetr = lv_kbetr / 10.
IF t_glacc-tax_base_amount IS INITIAL.
lv_taxamt = ( i_documentheader-gross_amount * lv_kbetr ) / 100.
ELSE.
lv_taxamt = ( t_glacc-tax_base_amount * lv_kbetr ) / 100.
ENDIF.
Populate the GL data
lt_accountgl-itemno_acc = 2.
lt_accountgl-gl_account = t_glacc-gl_account.
lt_accountgl-tax_code = t_glacc-tax_code.
lt_accountgl-acct_key = t_glacc-zacct_key.
lt_accountgl-item_text = 'Webdesk invoice posting'.
APPEND lt_accountgl.
clear lt_accountgl.
CLEAR lt_currencyamount.
lt_currencyamount-itemno_acc = 2.
lt_currencyamount-currency = i_documentheader-currency.
lt_currencyamount-amt_doccur = t_glacc-item_amount - lv_taxamt.
APPEND lt_currencyamount.
clear lt_currencyamount.
IF NOT t_glacc-tax_code IS INITIAL.
Populate the Tax data
lt_accounttax-itemno_acc = 3.
lt_accounttax-gl_account = t_glacc-ztaxgl_account.
lt_accounttax-tax_code = t_glacc-tax_code.
lt_accounttax-acct_key = t_glacc-zacct_key.
APPEND lt_accounttax.
clear lt_accounttax.
CLEAR lt_currencyamount.
lt_currencyamount-itemno_acc = 3.
lt_currencyamount-currency = i_documentheader-currency.
lt_currencyamount-amt_doccur = lv_taxamt.
IF t_glacc-tax_base_amount IS INITIAL.
lt_currencyamount-amt_base = i_documentheader-gross_amount.
ELSE.
lt_currencyamount-amt_base = t_glacc-tax_base_amount.
ENDIF.
APPEND lt_currencyamount.
clear lt_currencyamount.
ENDIF.
ENDLOOP.
IF lv_errfl = 'X'.
CLEAR t_return.
t_return-ztype = 'E'.
CONCATENATE 'Error while calculating the'
'Tax amount'
INTO t_return-zmessage SEPARATED BY space.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
CALLING BAPI *
CLEAR lwa_wi_history.
lwa_wi_history-zinv_id = i_documentheader-zinv_id.
lwa_wi_history-zlineid = lv_hist_lineid.
lwa_wi_history-zstep_id = i_stepid.
lwa_wi_history-zuser = sy-uname.
lwa_wi_history-zdate = sy-datum.
lwa_wi_history-ztime = sy-uzeit.
CLEAR: lt_return[].
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
EXPORTING
documentheader = lwa_documentheader
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountpayable = lt_accountpayable
accountgl = lt_accountgl
accounttax = lt_accounttax
currencyamount = lt_currencyamount
return = lt_return.
Thanks & Regards,
Sateesh. -
How I can calculate tax !
Hi !
I wonder how I can calculate tax !
Now, I'm investigating if i can make MM-Invoice with batch-input,
and i got 1 question.
In making MM-Invoice, I have to decide total invoice amount with tax before going batch-input.
While I could find total amount ( by deal × per amount), I couldn't find how to get amount of tax.
Is there any function module or tables that have tax-rate?check table RBVD
-
Problem with "Tax Code" and "Calculate tax automatically" fields
Hi again.
I have made a program which posts account documents through the BAPI_ACC_DOCUMENT_POST function module, and, since there were some fields which weren't available for me to fill having the FM by itslef, I have implemented the AC_DOCUMENT BAdI.
All document data is provided by means of an SAP XI interface, through a Z IDoc.
When I create the Account Receivable (and/or Payable) structure, I fill, through the BAdI, the BKPF-XMWST (Calculate tax automatically) and BSEG-MWSKZ (Tax code) fields. However, even the resulting posted document does have the Tax Information fields completed (the ones in the BSET table), the BAPI doesn't create the tax position automatically (just like the FB01 or FB60 transactions do). Note that the amounts are sent in their gross value by the interface (that's why the debit and credit sides remain consistent and the document is posted correctly).
How can I have that position created? Is there a function module which I can call or something?
Thanks a lot in advance.Hi
I only use the fm CALCULATE_TAX_FROM_NET_AMOUNT or CALCULATE_TAX_FROM_GROSSAMOUNT in order to get all information I need to transfer to the BAPI. Both fms return the data by table parameter T_MWDAT.
U can read this table and get all information u need, these code is from my old program, I hope it can help you:
- Calculate tax data:
CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'
EXPORTING
I_BUKRS = BUK_TO
I_MWSKZ = T_BASE-MWSKZ_OUT
I_WAERS = _BKPF-WAERS
I_WRBTR = T_BASE-WRBTR
TABLES
T_MWDAT = T_MWDAT
EXCPTIONS.
IF SY-SUBRC <> 0.
ELSE.
* Load tax item
LOOP AT T_MWDAT.
CLEAR W_GL_ITEM.
W_GL_ITEM-HKONT = T_MWDAT-HKONT.
W_GL_ITEM-MWSKZ = T_BASE-MWSKZ_OUT.
IF T_BASE-KBETR = T_MWDAT-KBETR.
W_GL_ITEM-WRBTR = T_BASE-FWSTE.
ELSE.
W_GL_ITEM-WRBTR = T_MWDAT-WMWST.
ENDIF.
W_GL_ITEM-IVA = 'X'.
W_GL_ITEM-KTOSL = T_MWDAT-KTOSL.
W_GL_ITEM-TXJCD = T_MWDAT-TXJCD.
W_GL_ITEM-KSCHL = T_MWDAT-KSCHL.
W_GL_ITEM-TXJCD_DEEP = T_MWDAT-TXJCD_DEEP.
W_GL_ITEM-TXJLV = T_MWDAT-TXJLV.
W_GL_ITEM-BASE = T_BASE-WRBTR.
COLLECT W_GL_ITEM INTO GL_ITEM.
- Append GL or Tax item for the BAPI
LOOP AT GL_ITEM INTO W_GL_ITEM .
ITEMNO_ACC = ITEMNO_ACC + 1.
IF W_GL_ITEM-IVA = SPACE.
* GL item
ELSE.
* Tax item
ACCOUNTTAX-ITEMNO_ACC = ITEMNO_ACC.
ACCOUNTTAX-TAX_CODE = W_GL_ITEM-MWSKZ.
ACCOUNTTAX-ACCT_KEY = W_GL_ITEM-KOSTL.
ACCOUNTTAX-COND_KEY = W_GL_ITEM-KSCHL.
ACCOUNTTAX-TAXJURCODE = W_GL_ITEM-TXJCD.
ACCOUNTTAX-TAXJURCODE_DEEP = W_GL_ITEM-TXJCD_DEEP.
ACCOUNTTAX-TAXJURCODE_LEVEL = W_GL_ITEM-TXJLV.
APPEND ACCOUNTTAX.
PERFORM FILL_AMOUNT USING W_GL_ITEM-WRBTR W_GL_ITEM-BASE.
ENDIF.
ENDLOOP.
Max
Edited by: max bianchi on Nov 25, 2009 7:43 PM -
When the user press the button Calculate Tax and click on Tax details then this should be updated automatically. But it does not work it is empty and the user has to update manually.
All setup looks fine.
Please let me know what can be done on this?
Regards,
PeuHarryAustralia wrote:
I recently updated my ipad wifi only to the new ios 6.1.2 and initially I had the auto cover lock option which can be seen in the Generals tab, but then it stoped working!! Before the update, the auto cover lock worked fine. So after trying all the options, I then did a complete reset on the ipad and now its gone all together from the General tab!! I can no longer see the "auto cover lock" option.
The iPad cover lock is for when you use a cover with magnets in it to lock and unlock the iPad when you close the cover or open it. Try running a refrigerator magnet along the sides of the iPad and see if that trips the iPad Cover Lock back into the settings.
That is not the same thing as the iPad Auto Lock setting which allows you to set an allotted time before the iPad goes to sleep.
You can try resetting all settings to see if the Auto Lock feature retinrs to the iPad.
Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. This can be a little time consuming re-entering all of the device settings again. -
How to calculate taxes in purchase register
Hi all,
i want to calculate taxes in purchase register for that
i use function module 'calculate_tax_item' but it calculates
tax on po . i want taxes should calculate as per miro
means it should be calculated on basic amount.
Thanks
DineshHi,
i dont know whether there is any function module available of no.. but u can get it from FI tables... link is from MIRO u can get the invoice no.. go to BKPF table in that there is a AWKEY filed is there put the MIRO No + Miro Year in that..u can use a select single .. from that u get the FI document .... field is BELNR.. then go to BSET table.. it contain the duty amount put that FI document number , FI year and Compny code and also put Debit/credit indicator as S.. u will list of records with duty.. from that HWBAS is he duty amount field and there is one percentage field.. if it is 12 % in that field its look like 120 as a multiple of 10. Note this BSET will only be populated if there is any tax involved.. other wise it will be empty(ofcourse it cointian the whole accessable value amount).. i think it will help u..
Regards
Maneesh Chandran -
How to calculate tax / discount amount on PO
Hi,
I have to calculate tax and discount on Purchase order and have add that to ekpo-netwr to get the actual amount. Can you please tell me how to do that?
So far I have been taking the EKKO-KNUMV and going to KONV table and serach for records with that KNUMV. But here I am stuck.
I can not understand (I mean I can not find the field to distinguish) which of the records is actually being used in the PO and has an amount (non-zero) against it, which I see in ME23N in "Condition" at header label.
Reward Points Guaranteed.
Regards,
AnidHi,
Ya. Actually I need to know the Discount, Indiviual taxes (Like Freight tax etc) which we see the the "condition" tab of Header Data in ME23N. I have to make a total of them and subtract from (Sum of EKPO-NETWR ) to calculate the ACTUAL PRICE. -
Calculate tax item field name in bapi .. bapi_acc_document_post
Hello Friends,
Im using Bapi>> Bapi_acc_document_post to post vendor and customer invoices, im not getting mapping field for the "calculate tax item(checkbox)" technical name is xmwst in any of the bapi strucuture.
please tell me in which bapi structure we have to pass this field so that the tax amount should get calculated automatically.
regards,
SunnyYou can try the Financial Posting Interface (FIPI).
*=======================================================================
CONSTANTS:
*=======================================================================
c_typehead TYPE stype_pi VALUE 'K',
c_typepos TYPE stype_pi VALUE 'P',
c_waers TYPE waers VALUE 'EUR',
c_blart TYPE blart VALUE 'ZN',
c_debit TYPE bschl VALUE '40',
c_credit TYPE bschl VALUE '50',
c_inddebit TYPE shkzg VALUE 'S',
c_indcredit TYPE shkzg VALUE 'H'.
*===================================================================
FORM append_ftpost
*===================================================================
USING p_stype TYPE stype_pi
p_count TYPE count_pi
p_fnam TYPE bdc_fnam
p_fval TYPE any
CHANGING pt_ftpost TYPE tt_ftpost.
DATA: ls_ftpost LIKE LINE OF pt_ftpost.
CLEAR ls_ftpost.
ls_ftpost-stype = p_stype.
ls_ftpost-count = p_count.
ls_ftpost-fnam = p_fnam.
ls_ftpost-fval = p_fval.
APPEND ls_ftpost TO pt_ftpost.
ENDFORM. "append_ftpost
*===================================================================
FORM post_document
*===================================================================
USING p_bukrs TYPE bukrs
p_gjahr TYPE gjahr
p_monat TYPE monat
p_tip TYPE zga_nomtipcont
p_saknr TYPE saknr
p_bktxt TYPE bktxt
pt_pos TYPE tt_pos.
DATA: lt_blntab TYPE tt_blntab,
lt_ftpost TYPE tt_ftpost,
lt_fttax TYPE tt_fttax,
ls_blntab LIKE LINE OF lt_blntab.
REFRESH: lt_blntab,
lt_ftpost,
lt_fttax.
CALL FUNCTION 'ENQUEUE_EZGA_NOMLOG'
EXPORTING
bukrs = p_bukrs
gjahr = p_gjahr
monat = p_monat
tipcont = p_tip
_wait = 'X'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc IS NOT INITIAL.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM fill_bkpf USING p_bukrs p_gjahr
p_monat p_bktxt
CHANGING lt_ftpost.
PERFORM fill_bseg USING p_saknr p_bktxt
CHANGING pt_pos lt_ftpost.
CALL FUNCTION 'POSTING_INTERFACE_START'
EXPORTING
i_function = 'C'
i_mode = 'N'
i_update = 'S'.
CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'
EXPORTING
i_tcode = 'FB01'
IMPORTING
e_msgid = sy-msgid
e_msgno = sy-msgno
e_msgty = sy-msgty
e_msgv1 = sy-msgv1
e_msgv2 = sy-msgv2
e_msgv3 = sy-msgv3
e_msgv4 = sy-msgv4
e_subrc = sy-subrc
TABLES
t_blntab = lt_blntab
t_ftpost = lt_ftpost
t_fttax = lt_fttax.
IF sy-subrc IS NOT INITIAL.
MESSAGE i021(zga_nom).
ELSE.
* Grabación en tabla de log y mensaje
READ TABLE lt_blntab INTO ls_blntab INDEX 1.
IF sy-subrc IS INITIAL AND
ls_blntab-belnr IS NOT INITIAL.
PERFORM insert_log USING p_bukrs
p_gjahr
p_monat
p_tip
ls_blntab-belnr.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
CALL FUNCTION 'POSTING_INTERFACE_END'
EXCEPTIONS
session_not_processable = 1
OTHERS = 2.
CALL FUNCTION 'DEQUEUE_EZGA_NOMLOG'
EXPORTING
bukrs = p_bukrs
gjahr = p_gjahr
monat = p_monat
tipcont = p_tip.
ENDFORM. " post_document
*===================================================================
FORM insert_log
*===================================================================
USING p_bukrs TYPE bukrs
p_gjahr TYPE gjahr
p_monat TYPE monat
p_tip TYPE zga_nomtipcont
p_belnr TYPE belnr_d.
DATA: lv_belnr TYPE belnr_d,
ls_log TYPE zga_nomlog.
CLEAR: lv_belnr, ls_log.
ls_log-bukrs = p_bukrs.
ls_log-gjahr = p_gjahr.
ls_log-monat = p_monat.
ls_log-tipcont = p_tip.
ls_log-belnr = p_belnr.
SELECT SINGLE belnr INTO lv_belnr
FROM zga_nomlog
WHERE bukrs = p_bukrs AND
gjahr = p_gjahr AND
monat = p_monat AND
tipcont = p_tip.
IF sy-subrc IS INITIAL.
UPDATE zga_nomlog FROM ls_log.
ELSE.
INSERT zga_nomlog FROM ls_log.
ENDIF.
ENDFORM. "insert_log
*===================================================================
FORM get_posting_date
*===================================================================
USING p_gjahr TYPE gjahr
p_monat TYPE monat
CHANGING p_date TYPE dats.
DATA: lv_date TYPE dats,
lv_month TYPE tfmatage.
IF p_monat <= '12'.
CONCATENATE p_gjahr p_monat '01' INTO lv_date.
CALL FUNCTION 'FIMA_END_OF_PERIOD_DETERMINE'
EXPORTING
i_date = lv_date
i_months = '1'
IMPORTING
e_date_end_of_period = p_date.
ELSE.
CONCATENATE p_gjahr '1231' INTO p_date.
ENDIF.
ENDFORM. "get_posting_date
*======================================================================
FORM fill_bkpf
*======================================================================
USING p_bukrs TYPE bukrs
p_gjahr TYPE gjahr
p_monat TYPE monat
p_bktxt TYPE bktxt
CHANGING pt_ftpost TYPE tt_ftpost.
DATA: lv_posting_date TYPE dats,
lv_dats TYPE char10.
PERFORM get_posting_date USING p_gjahr p_monat
CHANGING lv_posting_date.
WRITE lv_posting_date TO lv_dats.
PERFORM append_ftpost USING c_typehead '1'
'BKPF-BUKRS' p_bukrs
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typehead '1'
'BKPF-MONAT' p_monat
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typehead '1'
'BKPF-BLART' c_blart
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typehead '1'
'BKPF-BUDAT' lv_dats
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typehead '1'
'BKPF-BLDAT' lv_dats
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typehead '1'
'BKPF-WAERS' c_waers
CHANGING pt_ftpost.
*PERFORM append_ftpost USING c_typehead '1'*
*'BKPF-XMWST' 'X'*
*CHANGING pt_ftpost.*
PERFORM append_ftpost USING c_typehead '1'
'BKPF-BKTXT' p_bktxt
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typehead '1'
'BKPF-XBLNR' p_bktxt+0(16)
CHANGING pt_ftpost.
ENDFORM. "fill_bkpf
*===================================================================
FORM fill_bseg
*===================================================================
USING p_saknr TYPE saknr
p_bktxt TYPE bktxt
CHANGING pt_pos TYPE tt_pos
pt_ftpost TYPE tt_ftpost.
DATA: ls_pos LIKE LINE OF pt_pos,
ls_ftpost LIKE LINE OF pt_ftpost,
lv_item TYPE buzei,
lv_wrbtr TYPE wrbtr,
lv_saknr TYPE saknr,
lv_bschl TYPE bschl,
lt_poscont TYPE TABLE OF zga_nompospost,
ls_poscont LIKE LINE OF lt_poscont,
ls_poscontaux LIKE LINE OF lt_poscont.
CLEAR: ls_pos, ls_ftpost.
REFRESH lt_poscont.
LOOP AT pt_pos INTO ls_pos.
MOVE-CORRESPONDING ls_pos TO ls_poscont.
APPEND ls_poscont TO lt_poscont.
ENDLOOP.
SORT lt_poscont BY saknr.
lv_item = '002'.
LOOP AT lt_poscont INTO ls_poscontaux.
ls_poscont = ls_poscontaux.
AT NEW saknr.
CLEAR: lv_wrbtr,
lv_saknr,
lv_bschl.
ENDAT.
CASE ls_poscont-shkzg.
WHEN c_inddebit.
lv_bschl = c_debit.
WHEN c_indcredit.
lv_bschl = c_credit.
ENDCASE.
IF ls_poscont-saknr IS INITIAL.
lv_saknr = p_saknr.
ELSE.
lv_saknr = ls_poscont-saknr.
ENDIF.
IF ls_poscont-indhkont = abap_true.
lv_wrbtr = lv_wrbtr + ls_poscont-wrbtr.
ELSE.
PERFORM fill_bsegpos USING lv_bschl lv_saknr
ls_poscont-wrbtr p_bktxt
ls_poscont-kostl ls_poscont-prctr
lv_item
CHANGING pt_ftpost.
CLEAR: lv_wrbtr,
lv_saknr,
lv_bschl.
lv_item = lv_item + 1.
ENDIF.
AT END OF saknr.
IF ls_poscont-indhkont = abap_true.
PERFORM fill_bsegpos USING lv_bschl lv_saknr
lv_wrbtr p_bktxt
ls_poscont-kostl ls_poscont-prctr
lv_item
CHANGING pt_ftpost.
lv_item = lv_item + 1.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. "fill_bseg
*===================================================================
FORM fill_bsegpos
*===================================================================
USING p_bschl TYPE bschl
p_saknr TYPE saknr
p_wrbtr TYPE wrbtr
p_bktxt TYPE bktxt
p_kostl TYPE kostl
p_prctr TYPE prctr
p_pos TYPE buzei
CHANGING pt_ftpost TYPE tt_ftpost.
DATA: lv_wrbtrstr TYPE char16.
WRITE p_wrbtr TO lv_wrbtrstr
CURRENCY c_waers NO-SIGN.
PERFORM append_ftpost USING c_typepos p_pos
'BSEG-BSCHL' p_bschl
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typepos p_pos
'BSEG-HKONT' p_saknr
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typepos p_pos
'BSEG-WRBTR' lv_wrbtrstr
CHANGING pt_ftpost.
PERFORM append_ftpost USING c_typepos p_pos
'BSEG-SGTXT' p_bktxt
CHANGING pt_ftpost.
IF p_kostl IS NOT INITIAL.
PERFORM append_ftpost USING c_typepos p_pos
'COBL-KOSTL' p_kostl
CHANGING pt_ftpost.
ENDIF.
IF p_prctr IS NOT INITIAL.
PERFORM append_ftpost USING c_typepos p_pos
'COBL-PRCTR' p_prctr
CHANGING pt_ftpost.
ENDIF.
ENDFORM. "fill_bsegpos
Edited by: Javier Meavilla Olivas on Feb 25, 2010 1:25 PM -
How to calculate tax in me49 price
hi guys,
I want to change the standard me49 transaction. the reason is this the rate value it is giving is without excise and tax means flat rate. but i hav to showhere the rate including tax excise etc etc. Can you please give me brief description in this,thx in advanceYou don't need to calculate tax by yourself. The proper tax code will take care it.
Thanks,
Gordon -
Could I Manually calculate tax in MIRO
Dear
1, We know that we can use auto-calculate tax function in Tcode MIRO.
2, But there is a little difference of tax between actual invoice and auto-calculated by SAP. Meanwhile the tax field is disable if we use auto-calculate tax function. So, we want to manually enter this tax instead of auto-calculated. and then add one adjustment item. this way is OK?
Regards
HenryWhile entering MIRO, please uncheck auto tax calculation check box, then system will allow you to put manually tax amount.
Hope this helps. -
I want "Calculate tax" check box in miro to be ticked and in display mode.
How to do it?hi!
You can set transaction variant for your requirement using T.code SHD0 and that too only if the requirement is needed for all LIV postings. In SHD0 you can enable the tick and set the field in display mode. If the requirement is not for all postings then you copy the MIRO trtansaction USING T.Code OMW9 and set the transaction variant for that new t.code. But if you want to create a new t.code its upto you to check all other requirements.
Reward if useful.
Yuvi. -
How to pass the check 'calculate Tax Automatically' in IDOC
Hi,
I need mark the check box in the 'calculate Tax Automatically' in the IDOC. The IDOC will then go to BDC session 'FB01' to post. Which program I should to make the modification and what IDOC structure has this XMWST field?
Any help is appreciated!
Thanks,
HelenI am trying to do the same using INVOIC01 MM and MIRO
I found an OSS note that I thought may help but found a few anomolies.
Solution
The user exit CUSTOMER-FUNCTION '015' is available in the subroutine MRM_DOCUMENT_COMPLETE (include LMRMH1F). In this user exit, the "Calculate Tax" indicator (XMWST) can be set automatically for the IDoc.
Here the field e_rbkpv-xmwst must be set to 'x' in the structure e_rbkpv. In addition, f_change must be set to 'x'.
The Include is not LMRM1F but LMRMHFOT, in this include if I change the two fields rbkpv-xmwst and f_change in debugging, it works. There must be a way to do this!
We already do this using FI posting with INVOIC02 and the calculate taxes is flagged when you set calculate taxes on net amount in FB00.
Any suggestions would be gratefully recieved.
Thanks Ian -
Calculate Tax using BAPI_SALESORDER_SIMULATE
Hi All,
I am doing a proof of concept to get some data from the third party tool and calculate tax using BAPI_SALESORDER_SIMULATE.
I am gonna wrap this BAPI in a web service and pass the calculated tax amount back to the third party. I want to pass the default values for all the fields except for the credit card parameters.
Can some one help me with the default values that I can pass to this BAPI to check how it works.
Thanks,
Guru.Hi Anurita,
How did you solve this issue? Do you also have an example code?
I am trying to enable auto vat calculation for vendor invoices.
Many Thanks!
Kenan -
Invoice Date as default to calculate tax in MIRO
Hi,
I need to make Invoice date as default to calculate tax in MIRO.Can anybody suggest me User-Exit or BADI to do the same?
i need to calculate the tax according to Invoice date and not system date (posting date).hi!
You can set transaction variant for your requirement using T.code SHD0 and that too only if the requirement is needed for all LIV postings. In SHD0 you can enable the tick and set the field in display mode. If the requirement is not for all postings then you copy the MIRO trtansaction USING T.Code OMW9 and set the transaction variant for that new t.code. But if you want to create a new t.code its upto you to check all other requirements.
Reward if useful.
Yuvi. -
How does the system calculate taxes?
Dear All,
How does the system calculate taxes?
Can anybody explain in detail how the values will flow from PB00 / PBXX to BASB ?
Is this flow will remains same in both deductible & non deductible taxes ..??
Pls explain
With RegdsHi
Just remove the base type 362 in the taxing procedure & check if your tax is calculating or not.
The Tax determination still works.
FORM FRM_KOND_BASIS_362.
*Application country specific
*This alternate base value is to be attached to BASB. This routine
*fetches KZWI6 captured in the pricing procedure.
Thanks & Regards
Kishore
Maybe you are looking for
-
Issue with non-english application in thin client - virtual directory issue
Hi, I have just completed Siebel 8 installation on solaris machine along with SunOne Web server 6.1. I have installed both ENU and ARA language packs for Siebe Enterprise, Sweapps. The issue is after installation and repository installation for both
-
X121e randomly wake up from suspended status and real time clock error
Hi all Previously I considered my x121e suffer from overheating issue and causes real time clock error (RTC). However, after more testing and investigation, I believe the problem is related to other hardware issues and I like to hear people opinion b
-
Color issue w/ Sony KDS50A2000
Shortly after replacing the bulb (original finally died) I noticed the color was "off". I have played with the settings for over a month now and tried matching them to those posted on the web by others. Still no fix. The blue and green is definite
-
Error in job REFRESH_ADMIN_DATA_FROM_SUPPORT
Hi, We are facing errors in REFRESH_ADMIN_DATA_FROM_SUPPORT. It fiished successfully but contain errors as below. Job started Step 001 started (program AI_SC_REFRESH_READ_ONLY_DATA, variant , user ID WF-BATCH) No system headers will be generated in S
-
Albumart for albums with less than 5 songs?
So i REALLY would like to see the albumart on albums (for instance EP's, singles) with less than 5 songs. Is there any Terminal line to do this?