Extension2 in bapi_acc_document_post
hi,
i am posting account documnet in using bapi_acc_document_post with custom feilds on BKPF.
so i already append custom structure as Z0CUST01 to BKPF table which contains ZA1, ZA2.
when i tried to post, i got no error , document successfully posted, but no customed filed saved in BKPF table.
what's wrong? please help me
DATA: ls_zzz TYPE Z0CUST01.
CLEAR it_ext2.
it_ext2-structure = 'Z0CUST01'.
ls_zzz-za1 = 'AAA'.
ls_zzz-za2 = 'BBB'.
MOVE ls_zzz TO it_ext2-valuepart1.
APPEND it_ext2.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
importing
obj_type = l_type
obj_key = l_key
obj_sys = l_sys
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
Hi,
have a look at [SAP documentation|http://help.sap.com/saphelp_nw04/helpdata/en/6b/3f6d2b6d0711d396a50004ac96334b/frameset.htm].
Cheers
Similar Messages
-
Issue with posting G/L using the BAPI " BAPI_ACC_DOCUMENT_POST"
Hi all,
I am trying to create a G/L document using the BAPI "BAPI_ACC_DOCUMENT_POST". The Bapi is returning me a success message, but i am not able to see the document in BKPF/BSEG.
Can somebody please let me know if there is any customization that needs to be done to get the document number reflected in the corresponding tables after i execute this BAPI.
Here is the part of the code that i am using to fill the header structure:
docheader-obj_type = 'REACI'.
docheader-obj_key = 'TEST'.
docheader-obj_sys = 'ECSCLNT010'.
docheader-bus_act = 'RFBU'.
docheader-username = sy-uname.
docheader-header_txt = 'HDR TEXT'.
docheader-comp_code = 'SC01'.
docheader-doc_date = sy-datum.
docheader-pstng_date = sy-datum.
CASE wa_input_tmp-batch_type .
WHEN '0'.
docheader-doc_type = 'SA'.
WHEN '1'.
docheader-doc_type = 'RA'.
ENDCASE.
Any help is much appreciated.
Thanks in Advance,
SureshSee the below code :
I have tested program in my system :
*&---HEADER DECLARATION
DATA: HEADER TYPE BAPIACHE09. " HEADER DATA
INTERNAL TABLE DECLARATION
*&----G/L ACCOUNT ITEM
DATA: ACCOUNTGL TYPE STANDARD TABLE OF BAPIACGL09.
*&---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.
INITIALIZATION
HEADER-HEADER_TXT = 'TEST HEADER'.
HEADER-USERNAME = 'DEVELOPER'.
HEADER-COMP_CODE = '0002'.
HEADER-FISC_YEAR = '2007'.
HEADER-DOC_DATE = '20070502'.
HEADER-PSTNG_DATE = '20070502'.
HEADER-TRANS_DATE = '20070502'.
HEADER-DOC_TYPE = 'SA'.
HEADER-BUS_ACT = 'RFBU'.
WA_ACCOUNTGL-ITEMNO_ACC = '0000000010'.
WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.
WA_ACCOUNTGL-DE_CRE_IND = 'S'.
APPEND WA_ACCOUNTGL TO ACCOUNTGL.
CLEAR WA_ACCOUNTGL.
WA_ACCOUNTGL-ITEMNO_ACC = '0000000020'.
WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.
WA_ACCOUNTGL-DE_CRE_IND = 'H'.
APPEND WA_ACCOUNTGL TO ACCOUNTGL.
CLEAR WA_ACCOUNTGL.
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 =
ACCOUNTPAYABLE =
ACCOUNTTAX =
currencyamount = CURRENCY_AMOUNT
CRITERIA =
VALUEFIELD =
EXTENSION1 =
return = RETURN
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
IF return-type NA 'EA'.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IMPORTING
RETURN = RETURN.
write:/ return-message.
else.
write:/ return-message.
ENDIF.
Reward Points if it is helpful
Thanks
Seshu -
Getting Error while posting through BAPI_ACC_DOCUMENT_POST
Hi Folks,
I could not post an GL account using the BAPI function module BAPI_ACC_DOCUMENT_POST . The code was,
wa_docheader-bus_act = 'RFBU'.
wa_docheader-username = 'CHARAN'.
wa_docheader-comp_code = '0147'.
wa_docheader-doc_date = '20101006'.
wa_docheader-pstng_date = '20101006'.
wa_docheader-DOC_TYPE = 'SA'.
*wa_docheader-REF_DOC_NO = 'UNASSIGNED'.
wa_glaccnt-itemno_acc = '0010'.
wa_glaccnt-gl_account = '0000100632'.
wa_glaccnt-item_text = 'POSTING TO GL'.
APPEND wa_glaccnt TO i_glaccnt.
wa_glaccnt-itemno_acc = '0020'.
wa_glaccnt-gl_account = '0000100634'.
wa_glaccnt-item_text = 'POSTING TO GL'.
APPEND wa_glaccnt TO i_glaccnt.
*wa_pyaccnt-itemno_acc = '0000100634'.
*wa_pyaccnt-gl_account = '0001234567'.
*APPEND wa_pyaccnt TO i_pyaccnt.
wa_curamt-itemno_acc = '0010'.
wa_curamt-currency = 'USD'.
wa_curamt-curr_type = '00'.
wa_curamt-amt_doccur = 200 .
APPEND wa_curamt TO i_curamt.
wa_curamt-itemno_acc = '0020'.
wa_curamt-currency = 'USD'.
wa_curamt-curr_type = '00'.
wa_curamt-amt_doccur = 200.
APPEND wa_curamt TO i_curamt.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = wa_docheader
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
TABLES
accountgl = i_glaccnt
ACCOUNTRECEIVABLE =
accountpayable = i_pyaccnt
ACCOUNTTAX =
currencyamount = i_curamt
CRITERIA =
VALUEFIELD =
EXTENSION1 =
return = i_ret
PAYMENTCARD =
CONTRACTITEM =
extension2 = i_ext2
REALESTATE =
ACCOUNTWT =
The Output error i'm getting is :
Error in document : BKPFF $ BH2CLNT200 400.00 USD
Balance in transaction currency.
Please help me in posting the Gl document successfully. Help will be rewarded.
Thanks in advance.Total amount of internal table I_CURAMT-AMT_DOCCURR should be zero (Credit & Debit).
Edit : See [Accounting Document Interface |http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=195726664] for reference.
Edited by: Vinod Kumar on Oct 8, 2010 1:04 PM -
BAPI_ACC_DOCUMENT_POST with TAX posting for FB60 t-code
Hi Experts,
I am trying upload the data using BAPI_ACC_DOCUMENT_POST with Tax(ACCOUNTTAX) for the FB60 t-code. But not getting right.
Any help on this issue greatly appreciated.
Thanks & Regards,
HarishHi,
Check out this-
FU BAPI_ACC_DOCUMENT_POST
Short Text
Accounting: Posting
Functionality
Using this method you can create a posing in accounting for certain business transactions.
Possible ( Business Transactions):
Postings that generally only affect the general ledger. (RFBU)
Billing: For billing in Sales and Distribution, accounting is supplied with the relevant billing data. (SD00) Billing Document
Accounting can use the data of a logistics system that result from an Invoice Receipt. (RMRP)
Goods Movement are triggered by transactions in Sales and Distribution or by inventory postings. Within logistics, they lead to a change in the warehouse stocks of <DS:GLOS.Inventory Management>Inventory Management. This results in a posting in accounting. This is why accounting is supplied with the relevant data from logistics. (RMWA)
Example
Billing document:
By selling goods in accordance with targets, revenue is generated. The revenue is posted in billing and forwarded to accounting.
Invoice receipt:
Raw materials are purchased in accordance with targets. The invoice receipt is posted in a logistics system. The data from the raw materials is forwarded to accounting.
Goods Movment:
The use of raw materials leads to a change in stock in inventory managment. The posting of raw material consumption is forwarded to accounting.
G/L Account Posting:
Provision posting for an expected warranty service. This can refer to acquisitions or retirements belonging to stocks that are not in subledger accounting relevant to inventory management. This is particularly the case if such materials are not displayed as vendor/customer, materials, loans etc. or cannot be displayed in this way. This can also refer to write-ups or depreciation that contain higher aggregations of values than are maintained in a corresponding subledger that is relevant to inventory management.
The conversion of foreign currencies for receivables/payables due to large exchange rate changes that should not lead to an update of the accounts payable or accounts receivable accounting. A similar transaction can arise for the revaluation of raw materials if this revaluation takes place at a correspondingly aggreagated level.
Reclassification of inventory of P&L statement accounts that are only used for reconcilliation purposes in the general ledger (this rearranges values for balance sheet items).
Balance reclassifications of stocks to receivables with different return times.
Notes
If the parameter CurrencyAmount is filled with the currency fields, a complete document check including characteristics and value components of profitability analysis (CO-PA). Otherwise, the account assignment objects are checked.
Messages are returned in the parameter Return. In the parameter documentation you can find the return values and their meaning.
Further information
You can find further information in the SAP Library under "Financials -> Accounting - General (AC) -> Interfaces to Accounting (AC)".
Parameters
DOCUMENTHEADER
CUSTOMERCPD
CONTRACTHEADER
OBJ_TYPE
OBJ_KEY
OBJ_SYS
ACCOUNTGL
ACCOUNTRECEIVABLE
ACCOUNTPAYABLE
ACCOUNTTAX
CURRENCYAMOUNT
CRITERIA
VALUEFIELD
EXTENSION1
RETURN
PAYMENTCARD
CONTRACTITEM
EXTENSION2
REALESTATE
ACCOUNTWT
Reward if useful! -
How to use EXTENSION1 in BAPI_ACC_DOCUMENT_POST
Hi,
I am using BAPI_ACC_DOCUMENT_POST for posting documents similar to what is posted using FBS1 transaction code.
I'm not able to populate reversal date in the BAPI_ACC_DOCUMENT_POST. There is a provision it seems using the EXTENSION1 tables parameter.
Can anyone please tell me the procedure preferably a small piece of sample code in which I can know how to pass the Reversal Date using the EXTENSION1 structure.
Also which process code is required to be used in the Business Transaction Events enhancements to implement this.
Thanks and regards,
Satyadev Duttahi
good
go through this program which ll help you to give greater knowledge about use of EXTENSION1 in BAPI_ACC_DOCUMENT_POST
======================================
report zbapi_factura_acreedor2 .
*REPORT acc_bapi_test_document .
selection-screen begin of block bl01 .
parameters:
check_l radiobutton group rb1,
check_a default 'X' radiobutton group rb1,
post radiobutton group rb1.
selection-screen uline.
parameters:
rev_c radiobutton group rb1,
rev_p radiobutton group rb1.
selection-screen uline.
parameters:
ref_key like bapiache01-obj_key default 'TEST000001BAPICALL',
dest like bdi_logsys-logsys default ' '.
selection-screen end of block bl01 .
data:
gd_documentheader like bapiache09,
gd_customercpd like bapiacpa09,
gd_fica_hd like bapiaccahd,
it_accountreceivable like table of bapiacar09 with header line,
it_accountgl like table of bapiacgl09 with header line,
it_accounttax like table of bapiactx09 with header line,
it_criteria like table of bapiackec9 with header line,
it_valuefield like table of bapiackev9 with header line,
it_currencyamount like table of bapiaccr09 with header line,
it_return like table of bapiret2 with header line,
it_receivers like table of bdi_logsys with header line,
it_fica_it like table of bapiaccait with header line,
it_accountpayable like table of bapiacap09 with header line,
it_paymentcard like table of bapiacpc09 with header line,
it_ext like table of bapiacextc with header line.
it_re LIKE TABLE OF bapiacre09 WITH HEADER LINE,
it_ext2 LIKE TABLE OF bapiparex WITH HEADER LINE.
perform fill_internal_tables.
if check_l = 'X'.
call function 'BAPI_ACC_DOCUMENT_CHECK'
destination dest
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of check lines:'. "#EC NOTEXT
perform show_messages.
endif.
if check_a = 'X'.
call function 'BAPI_ACC_DOCUMENT_CHECK'
destination dest
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of check all:'. "#EC NOTEXT
perform show_messages.
endif.
if post = 'X'.
data: l_type like gd_documentheader-obj_type,
l_key like gd_documentheader-obj_key,
l_sys like gd_documentheader-obj_sys.
if dest = space or
dest = gd_documentheader-obj_sys.
post synchron
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
importing
obj_type = l_type
obj_key = l_key
obj_sys = l_sys
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of post:'. "#EC NOTEXT
perform show_messages.
else.
create Idoc
it_receivers-logsys = dest.
append it_receivers.
call function 'ALE_ACC_DOCUMENT_POST'
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
paymentcard = it_paymentcard
contractitem = it_fica_it
extension2 = it_ext2
realestate = it_re
receivers = it_receivers
COMMUNICATION_DOCUMENTS =
APPLICATION_OBJECTS =
exceptions
error_creating_idocs = 1
others = 2 .
if sy-subrc = 0.
write: / 'IDoc created'. "#EC NOTEXT
else.
write: sy-msgid.
endif.
endif.
endif.
if rev_p = 'X' or rev_c = 'X'.
data: rev like bapiacrev,
rev_key like ref_key.
rev_key = ref_key.
rev_key(1) = 'R'.
rev-obj_type = gd_documentheader-obj_type.
rev-obj_key = rev_key.
rev-obj_sys = gd_documentheader-obj_sys.
rev-obj_key_r = ref_key.
if rev_c is initial.
if dest = space or
dest = gd_documentheader-obj_sys.
call function 'BAPI_ACC_DOCUMENT_REV_POST'
exporting
reversal = rev
bus_act = gd_documentheader-bus_act
tables
return = it_return.
else.
it_receivers-logsys = dest.
append it_receivers.
call function 'ALE_ACC_DOCUMENT_REV_POST'
exporting
reversal = rev
busact = gd_documentheader-bus_act
OBJ_TYPE = 'BUS6035'
SERIAL_ID = '0'
tables
receivers = it_receivers
COMMUNICATION_DOCUMENTS =
APPLICATION_OBJECTS =
exceptions
error_creating_idocs = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
write: / 'IDoc created'. "#EC NOTEXT
endif.
endif.
else.
call function 'BAPI_ACC_DOCUMENT_REV_CHECK'
exporting
reversal = rev
bus_act = gd_documentheader-bus_act
tables
return = it_return.
endif.
write: / 'Result of Reversal Posting:'. "#EC NOTEXT
perform show_messages.
endif.
commit work.
Form fill_internal_tables
form fill_internal_tables.
perform fill_header.
perform fill_accountgl.
perform fill_accountar.
perform fill_accountap.
perform fill_accounttax.
perform fill_currencyamount.
perform fill_criteria.
perform fill_valuefield.
perform fill_re.
perform fill_cpd.
perform fill_contractitem.
perform fill_contractheader.
perform fill_paymentcard.
perform fill_extension.
endform. " fill_internal_tables
Form Show_messages
form show_messages.
if it_return[] is initial.
write: / 'no messages'.
else.
skip 1.
loop at it_return.
write: / it_return-type,
(2) it_return-id,
it_return-number,
(80) it_return-message,
IT_RETURN-LOG_NO
IT_RETURN-LOG_MSG_NO
it_return-message_v1,
IT_RETURN-MESSAGE_V2
IT_RETURN-MESSAGE_V3
IT_RETURN-MESSAGE_V4
(20) it_return-parameter,
(3) it_return-row,
it_return-field.
IT_RETURN-SYSTEM
endloop.
endif.
uline.
endform. " Show_messages
FORM fill_accountgl *
form fill_accountgl.
clear it_accountgl.
it_accountgl-itemno_acc = 2.
it_accountgl-gl_account = '0021510201'.
it_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
it_accountgl-bus_area = '01'.
it_accountgl-profit_ctr = '0000010101'.
it_accountgl-comp_code = 'SLOC'.
append it_accountgl.
clear it_accountgl.
it_accountgl-itemno_acc = 3.
it_accountgl-gl_account = '0082000201'.
it_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
it_accountgl-bus_area = '01'.
it_accountgl-profit_ctr = '0000010101'.
it_accountgl-comp_code = 'SLOC'.
it_accountgl-tax_code = 'A3'.
append it_accountgl.
clear it_accountgl.
it_accountgl-itemno_acc = 5.
it_accountgl-gl_account = '0021510201'.
it_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
it_accountgl-bus_area = '01'.
it_accountgl-profit_ctr = '0000010301'.
it_accountgl-comp_code = 'SLOC'.
append it_accountgl.
clear it_accountgl.
it_accountgl-itemno_acc = 6.
it_accountgl-gl_account = '0082000201'.
it_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
it_accountgl-bus_area = '01'.
it_accountgl-profit_ctr = '0000010301'.
it_accountgl-comp_code = 'SLOC'.
it_accountgl-tax_code = 'A3'.
append it_accountgl.
clear it_accountgl.
it_accountgl-itemno_acc = 7.
it_accountgl-itemno_acc = 8.
it_accountgl-gl_account = '0021510201'.
it_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
it_accountgl-bus_area = '90'.
it_accountgl-profit_ctr = '0000900008'.
it_accountgl-comp_code = 'CORP'.
append it_accountgl.
clear it_accountgl.
it_accountgl-itemno_acc = 8.
it_accountgl-itemno_acc = 9.
it_accountgl-gl_account = '0082000201'.
it_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
it_accountgl-bus_area = '90'.
it_accountgl-profit_ctr = '0000900008'.
it_accountgl-comp_code = 'CORP'.
it_accountgl-tax_code = 'A3'.
append it_accountgl.
endform. "fill_accountgl
FORM fill_header *
form fill_header.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = gd_documentheader-obj_sys.
OBJ_TYPE has to be replaced by customers object key (Y* or Z*)
gd_documentheader-obj_type = 'IDOC'.
gd_documentheader-obj_key = ref_key.
gd_documentheader-username = sy-uname.
gd_documentheader-header_txt = 'BAPI Test'. "#EC NOTEXT
gd_documentheader-obj_key_r =
GD_DOCUMENTHEADER-reason_rev =
gd_documentheader-comp_code = 'SLOC'.
GD_DOCUMENTHEADER-AC_DOC_NO =
gd_documentheader-fisc_year = sy-datum(4).
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
GD_DOCUMENTHEADER-TRANS_DATE =
GD_DOCUMENTHEADER-VALUE_DATE =
GD_DOCUMENTHEADER-FIS_PERIOD =
gd_documentheader-doc_type = 'KR'.
gd_documentheader-ref_doc_no = 'xxxx'.
GD_DOCUMENTHEADER-COMPO_ACC =
gd_documentheader-bus_act = 'RFBU'.
endform. "fill_header
FORM fill_contractheader *
form fill_contractheader.
gd_fica_hd-doc_no =
gd_fica_hd-doc_type_ca =
gd_fica_hd-res_key =
gd_fica_hd-fikey =
gd_fica_hd-payment_form_ref =
endform. "fill_contractheader
FORM fill_cpd *
form fill_cpd.
gd_customercpd-name
gd_customercpd-name_2
gd_customercpd-name_3
gd_customercpd-name_4
gd_customercpd-postl_code
gd_customercpd-city
gd_customercpd-country
gd_customercpd-country_iso
gd_customercpd-street
gd_customercpd-po_box
gd_customercpd-pobx_pcd
gd_customercpd-pobk_curac
gd_customercpd-bank_acct
gd_customercpd-bank_no
gd_customercpd-bank_ctry
gd_customercpd-bank_ctry_iso
gd_customercpd-tax_no_1
gd_customercpd-tax_no_2
gd_customercpd-tax
gd_customercpd-equal_tax
gd_customercpd-region
gd_customercpd-ctrl_key
gd_customercpd-instr_key
gd_customercpd-dme_ind
gd_customercpd-langu_iso
endform. "fill_cpd
FORM fill_ar *
form fill_accountar.
CLEAR it_accountreceivable.
it_accountreceivable-itemno_acc =
it_accountreceivable-customer =
IT_ACCOUNTRECEIVABLE-REF_KEY_1 =
IT_ACCOUNTRECEIVABLE-REF_KEY_2 =
IT_ACCOUNTRECEIVABLE-REF_KEY_3 =
IT_ACCOUNTRECEIVABLE-PMNTTRMS =
IT_ACCOUNTRECEIVABLE-BLINE_DATE =
IT_ACCOUNTRECEIVABLE-DSCT_DAYS1 =
IT_ACCOUNTRECEIVABLE-DSCT_DAYS2 =
IT_ACCOUNTRECEIVABLE-NETTERMS =
IT_ACCOUNTRECEIVABLE-DSCT_PCT1 =
IT_ACCOUNTRECEIVABLE-DSCT_PCT2 =
IT_ACCOUNTRECEIVABLE-PYMT_METH =
IT_ACCOUNTRECEIVABLE-DUNN_KEY =
IT_ACCOUNTRECEIVABLE-DUNN_BLOCK =
IT_ACCOUNTRECEIVABLE-PMNT_BLOCK =
IT_ACCOUNTRECEIVABLE-VAT_REG_NO =
IT_ACCOUNTRECEIVABLE-ALLOC_NMBR =
it_accountreceivable-item_text =
IT_ACCOUNTRECEIVABLE-PARTNER_BK =
IT_ACCOUNTRECEIVABLE-GL_ACCOUNT =
it_accountreceivable-comp_code
it_accountreceivable-bus_area
it_accountreceivable-pmtmthsupl
it_accountreceivable-paymt_ref
it_accountreceivable-scbank_ind
it_accountreceivable-businessplace
it_accountreceivable-sectioncode
it_accountreceivable-branch
it_accountreceivable-pymt_cur
it_accountreceivable-pymt_cur_iso
it_accountreceivable-pymt_amt
it_accountreceivable-c_ctr_area
it_accountreceivable-bank_id
it_accountreceivable-supcountry
it_accountreceivable-supcountry_iso
it_accountreceivable-tax_code
it_accountreceivable-taxjurcode
it_accountreceivable-tax_date
it_accountreceivable-sp_gl_ind
it_accountreceivable-partner_guid = '1465464654'.
APPEND it_accountreceivable.
endform. "fill_accountar
FORM fill_ap *
form fill_accountap.
clear it_accountpayable.
it_accountpayable-itemno_acc = 1.
it_accountpayable-vendor_no = '0000060259'.
it_accountpayable-vendor_no = '0000060693'.
it_accountpayable-gl_account
it_accountpayable-ref_key_1
it_accountpayable-ref_key_2
it_accountpayable-ref_key_3
it_accountpayable-comp_code = 'SLOC'.
it_accountpayable-bus_area = '01'.
it_accountpayable-pmnttrms = 'A000'.
it_accountpayable-bline_date
it_accountpayable-dsct_days1
it_accountpayable-dsct_days2
it_accountpayable-netterms
it_accountpayable-dsct_pct1
it_accountpayable-dsct_pct2
it_accountpayable-pymt_meth
it_accountpayable-pmtmthsupl
it_accountpayable-pmnt_block
it_accountpayable-scbank_ind
it_accountpayable-supcountry
it_accountpayable-supcountry_iso
it_accountpayable-bllsrv_ind
it_accountpayable-alloc_nmbr
it_accountpayable-item_text = 'BAPI Test A/P line item'. "#EC NOTEXT
it_accountpayable-po_sub_no
it_accountpayable-po_checkdg
it_accountpayable-po_ref_no
it_accountpayable-w_tax_code
it_accountpayable-businessplace
it_accountpayable-sectioncode
it_accountpayable-instr1
it_accountpayable-instr2
it_accountpayable-instr3
it_accountpayable-instr4
it_accountpayable-branch
it_accountpayable-pymt_cur
it_accountpayable-pymt_amt
it_accountpayable-pymt_cur_iso
it_accountpayable-sp_gl_ind
append it_accountpayable.
endform. "fill_accountap
FORM fill_tax *
form fill_accounttax.
clear it_accounttax.
it_accounttax-itemno_acc = 4.
it_accounttax-gl_account = '0011361502'.
it_accounttax-tax_code = 'A3'.
it_accounttax-acct_key = 'VST'.
it_accounttax-cond_key = 'MWVS'.
it_accounttax-itemno_tax = 8.
append it_accounttax.
clear it_accounttax.
it_accounttax-itemno_acc = 7.
it_accounttax-gl_account = '0011361502'.
it_accounttax-tax_code = 'A3'.
it_accounttax-acct_key = 'VST'.
it_accounttax-COND_KEY = 'MWVS'.
append it_accounttax.
clear it_accounttax.
it_accounttax-itemno_acc = 10.
it_accounttax-itemno_acc = 9.
it_accounttax-gl_account = '0011361502'.
it_accounttax-tax_code = 'A3'.
it_accounttax-acct_key = 'VST'.
it_accounttax-cond_key = 'MWVS'.
it_accounttax-itemno_tax = 4.
append it_accounttax.
endform. "fill_accounttax
FORM fill_currencyamount *
form fill_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 1.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_doccur = '-7408036.2'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 2.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_doccur = '5336472.00'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 3.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_doccur = '3840.00'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 4.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_base = '5548.00'.
it_currencyamount-amt_doccur = '832.2'.
it_currencyamount-amt_doccur = '576.00'.
it_currencyamount-amt_base = '3840.00'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 5.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_doccur = '2051279.00'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 6.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_doccur = '1690.00'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 7.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_base = '1690.00'.
it_currencyamount-amt_doccur = '253.5'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 8.
it_currencyamount-itemno_acc = 7.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_doccur = '13905.00'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 9.
it_currencyamount-itemno_acc = 8.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_base = '2.70'.
it_currencyamount-amt_doccur = '18.00'.
append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc = 10.
it_currencyamount-itemno_acc = 9.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'MXN'.
it_currencyamount-amt_doccur = '2.70'.
it_currencyamount-amt_base = '18.00'.
append it_currencyamount.
endform. "fill_currencyamount
FORM fill_criteria *
form fill_criteria.
CLEAR it_criteria.
it_criteria-itemno_acc = 2.
it_criteria-fieldname = 'BZIRK'.
it_criteria-character = '000001'.
append it_criteria.
endform. "fill_criteria
FORM fill_valuefield *
form fill_valuefield.
CLEAR it_valuefield.
it_valuefield-itemno_acc = 2.
it_valuefield-fieldname = 'VV010'.
it_valuefield-curr_type
it_valuefield-currency = 'EUR'.
it_valuefield-currency_iso
it_valuefield-amt_valcom
it_valuefield-base_uom
it_valuefield-base_uom_iso
it_valuefield-qua_valcom
append it_valuefield.
endform. "fill_valuefield
FORM fill_extension *
form fill_extension.
CLEAR it_ext.
it_ext-field1
it_ext-field2
it_ext-field3
it_ext-field4
APPEND it_ext.
DATA: ls_zzz TYPE ZZZ_ACCIT.
CLEAR it_ext2.
it_ext2-structure = 'ZZZ_ACCIT'.
ls_zzz-posnr = 2.
ls_zzz-awref_reb = '123654'.
ls_zzz-aworg_reb = '654654'.
ls_zzz-grant_nbr = '0022002'.
MOVE ls_zzz TO it_ext2-valuepart1.
APPEND it_ext2.
endform. "fill_extension
FORM fill_paymentcard *
form fill_paymentcard.
CLEAR it_paymentcard.
it_paymentcard-itemno_acc = 1.
it_paymentcard-cc_glaccount
it_paymentcard-cc_type
it_paymentcard-cc_number
it_paymentcard-cc_seq_no
it_paymentcard-cc_valid_f
it_paymentcard-cc_valid_t
it_paymentcard-cc_name
it_paymentcard-dataorigin
it_paymentcard-authamount = '100'.
it_paymentcard-currency = 'EUR'.
it_paymentcard-currency_iso
it_paymentcard-cc_autth_no
it_paymentcard-auth_refno
it_paymentcard-auth_date
it_paymentcard-auth_time
it_paymentcard-merchidcl
it_paymentcard-point_of_receipt
it_paymentcard-terminal
it_paymentcard-cctyp = '1'.
APPEND it_paymentcard.
endform. "fill_paymentcard
FORM fill_contractitem *
form fill_contractitem.
CLEAR it_fica_it.
it_fica_it-itemno_acc
it_fica_it-cont_acct
it_fica_it-main_trans
it_fica_it-sub_trans
it_fica_it-func_area
it_fica_it-fm_area
it_fica_it-cmmt_item
it_fica_it-funds_ctr
it_fica_it-fund
append it_fica_it.
endform. "fill_contractitem
*& Form fill_re
form fill_re .
CLEAR it_re.
it_re-itemno_acc =
it_re-business_entity =
it_re-building =
it_re-property =
it_re-rental_object =
it_re-serv_charge_key =
it_re-settlement_unit =
it_re-contract_no =
APPEND it_re.
endform. "fill_re
thanks
mrutyun^ -
Short dump with BAPI_ACC_DOCUMENT_POST
Dear All,
When I try to use BAPI "BAPI_ACC_DOCUMENT_POST" for F-02 posting, I get the following short dump:
"Syntax error in program SAPLACC9".
"The data object GS_ACCIT does not have a component called BAPI_PARA"
Please suggest me how can this error be removed.
Regards,
KanupriyaHi Suneel,
Please look at the code below:
LOOP AT it_upload_rec.
header-bus_act = 'RFBU'.
header-doc_date = it_upload_rec-bldat.
header-pstng_date = it_upload_rec-budat. header-header_txt = 'F-02 Posting'.
header-comp_code = 'PL10'.
header-doc_type = 'SA'.
header-username = sy-uname.
APPEND header.
CLEAR header.
account_gl-itemno_acc = '1'.
account_gl-gl_account = it_upload_rec-account1.
APPEND account_gl.
CLEAR account_gl.
account_payable-itemno_acc = '2'.
account_payable-vendor_no = it_upload_rec-account2.
APPEND account_payable.
CLEAR account_payable.
currency_amount-itemno_acc = '1'.
currency_amount-currency = 'INR'.
currency_amount-amt_doccur = it_upload_rec-amount.
APPEND currency_amount.
CLEAR currency_amount.
ENDLOOP.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = header
* CUSTOMERCPD =
* CONTRACTHEADER =
IMPORTING
obj_type = gv_obj_type
obj_key = gv_obj_key
obj_sys = gv_obj_sys
TABLES
accountgl = account_gl
ACCOUNTRECEIVABLE =
accountpayable = account_payable
* ACCOUNTTAX =
currencyamount = currency_amount
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
return = it_return
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
Regards,
Kanupriya -
Need help in BAPI_ACC_DOCUMENT_POST.
Hi Friends,
Can any one help me in passing on the TAX parameters and currency parameters to
BAPI_ACC_DOCUMENT_POST.
this is the code i am using . it is posting the document and a TAX line is not created .
LOOP AT IT_ITEM WHERE HEAD_COL = IT_HEADER-FIRST_COL.
V_ITEM = V_ITEM + 1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = V_ITEM
IMPORTING
OUTPUT = V_ITEM.
* IT_ACCGL-ITEMNO_ACC = V_ITEM. "IT_ITEM-NEWBS.
*for vendor / gl accounts based on newbs
IF IT_ITEM-NEWBS = '40' OR IT_ITEM-NEWBS = '50'.
IT_ACCGL-GL_ACCOUNT = IT_ITEM-NEWKO.
IT_ACCGL-ITEMNO_ACC = V_ITEM. "IT_ITEM-NEWBS.
IT_ACCGL-ITEM_TEXT = IT_ITEM-SGTXT.
IT_ACCGL-TAX_CODE = IT_ITEM-MWSKZ.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_ITEM-AUFNR
IMPORTING
OUTPUT = IT_ACCGL-ORDERID.
IT_ACCGL-ALLOC_NMBR = IT_ITEM-ZUONR.
CONCATENATE IT_HEADER-BUDAT+0(4) IT_HEADER-BUDAT+5(2) IT_HEADER-BUDAT+8(2) INTO IT_ACCGL-PSTNG_DATE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_ITEM-KOSTL
IMPORTING
OUTPUT = IT_ACCGL-COSTCENTER.
IT_ACCGL-ITEM_TEXT = IT_ITEM-SGTXT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_ITEM-PRCTR
IMPORTING
OUTPUT = IT_ITEM-PRCTR.
IT_ACCGL-PROFIT_CTR = IT_ITEM-PRCTR.
APPEND IT_ACCGL.
*for Account tax
IT_ACCTAX-ITEMNO_ACC = V_ITEM.
IT_ACCTAX-ACCT_KEY = 'VST'.
IT_ACCTAX-GL_ACCOUNT = IT_ITEM-NEWKO.
IT_ACCTAX-TAX_CODE = IT_ITEM-MWSKZ.
IT_ACCTAX-TAX_RATE = IT_MWDAT-KBETR.
APPEND IT_ACCTAX.
**CURRENCY
*populate it_curr - BAPI currency table
IT_CURR-ITEMNO_ACC = V_ITEM. "IT_ITEM-NEWBS.
IT_CURR-CURRENCY = IT_HEADER-WAERS.
IT_CURR-AMT_DOCCUR = IT_ITEM-WRBTR.
IT_CURR-EXCH_RATE = IT_HEADER-KURSF.
CLEAR IT_BSEG.
READ TABLE IT_BSEG WITH KEY BELNR = IT_ITEM-NEWKO
MWSKZ = IT_ITEM-MWSKZ
WRBTR = IT_ITEM-WRBTR.
IT_CURR-AMT_BASE = IT_BSEG-FWBAS.
V_BUKRS = IT_HEADER-BUKRS.
V_MWSKZ = IT_ITEM-MWSKZ.
V_WAERS = IT_HEADER-WAERS.
V_WRBTR = IT_ITEM-WRBTR.
CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'
EXPORTING
I_BUKRS = V_BUKRS
I_MWSKZ = V_MWSKZ
* I_TXJCD = ' '
I_WAERS = V_WAERS
I_WRBTR = V_WRBTR
* IMPORTING
* E_FWNAV =
* E_FWNVV =
* E_FWSTE =
* E_FWAST =
TABLES
T_MWDAT = IT_MWDAT
EXCEPTIONS
BUKRS_NOT_FOUND = 1
COUNTRY_NOT_FOUND = 2
MWSKZ_NOT_DEFINED = 3
MWSKZ_NOT_VALID = 4
ACCOUNT_NOT_FOUND = 5
DIFFERENT_DISCOUNT_BASE = 6
DIFFERENT_TAX_BASE = 7
TXJCD_NOT_VALID = 8
NOT_FOUND = 9
KTOSL_NOT_FOUND = 10
KALSM_NOT_FOUND = 11
PARAMETER_ERROR = 12
KNUMH_NOT_FOUND = 13
KSCHL_NOT_FOUND = 14
UNKNOWN_ERROR = 15
OTHERS = 16
IF SY-SUBRC = 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
IT_CURR-TAX_AMT = IT_MWDAT-KBETR.
IT_CURR-AMT_BASE = IT_MWDAT-KAWRT.
ENDIF.
APPEND IT_CURR.
***Extension1
*populate it_extension1 - BAPI extension1 table
V_NEWBS = IT_ITEM-NEWBS.
IT_EXTENSION1-FIELD1(10) = V_ITEM.
IT_EXTENSION1-FIELD1+10(2) = IT_ITEM-MWSKZ.
IF NOT IT_ITEM-MWSKZ IS INITIAL.
IT_EXTENSION1-FIELD2(10) = V_ITEM.
IT_EXTENSION1-FIELD2+10(1) = 'X'.
ENDIF.
*for posting key
IT_EXTENSION1-FIELD3 = V_NEWBS.
***for posting key IN EXTENSION2
IT_EXTENSION2-STRUCTURE = 'ACCIT'.
IT_TES-POSNR = V_ITEM.
IT_TES-BSCHL = V_NEWBS.
IT_TES-KBETR = IT_MWDAT-KBETR.
** IT_TES-MWSKZ = IT_ITEM-MWSKZ.
** IT_TES-XMWST = 'X'.
IT_EXTENSION2-VALUEPART2(10) = V_ITEM.
IT_EXTENSION2-VALUEPART2 = IT_ITEM-MWSKZ.
IF NOT IT_ITEM-MWSKZ IS INITIAL.
IT_EXTENSION2-VALUEPART3(10) = V_ITEM.
IT_EXTENSION2-VALUEPART3+10(1) = 'X'.
ENDIF.
MOVE IT_TES TO IT_EXTENSION2-VALUEPART1. "#EC ENHOK
APPEND IT_EXTENSION2.
ELSEIF IT_ITEM-NEWBS = '21' OR
IT_ITEM-NEWBS = '22' OR
IT_ITEM-NEWBS = '23' OR
IT_ITEM-NEWBS = '24' OR
IT_ITEM-NEWBS = '25' OR
IT_ITEM-NEWBS = '26' OR
IT_ITEM-NEWBS = '27' OR
IT_ITEM-NEWBS = '28' OR
IT_ITEM-NEWBS = '29' OR
IT_ITEM-NEWBS = '30' OR
IT_ITEM-NEWBS = '31' OR
IT_ITEM-NEWBS = '32' OR
IT_ITEM-NEWBS = '33' OR
IT_ITEM-NEWBS = '34' OR
IT_ITEM-NEWBS = '35' OR
IT_ITEM-NEWBS = '36' OR
IT_ITEM-NEWBS = '37' OR
IT_ITEM-NEWBS = '38' OR
IT_ITEM-NEWBS = '39'.
IF IT_HEADER-BLART = 'KR' OR IT_HEADER-BLART = 'KA'.
IT_ACCREC-ITEMNO_ACC = V_ITEM.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_ITEM-NEWKO
IMPORTING
OUTPUT = IT_ITEM-NEWKO.
IT_ACCREC-VENDOR_NO = IT_ITEM-NEWKO.
*for GL account
CLEAR IT_LFB1.
READ TABLE IT_LFB1 WITH KEY LIFNR = IT_ITEM-NEWKO.
IF IT_LFB1-BUKRS = IT_HEADER-BUKRS.
IT_ACCREC-GL_ACCOUNT = IT_LFB1-AKONT.
IT_ACCREC-COMP_CODE = IT_HEADER-BUKRS.
IT_ACCREC-ITEM_TEXT = IT_ITEM-SGTXT.
IT_ACCREC-TAX_CODE = IT_ITEM-MWSKZ.
ENDIF.
APPEND IT_ACCREC.
CLEAR IT_ACCREC.
*for Account tax
IT_ACCTAX-ITEMNO_ACC = V_ITEM.
IT_ACCTAX-ACCT_KEY = 'VST'.
IT_ACCTAX-GL_ACCOUNT = IT_LFB1-AKONT.
IT_ACCTAX-TAX_CODE = IT_ITEM-MWSKZ.
IT_ACCTAX-TAX_RATE = IT_MWDAT-KBETR.
APPEND IT_ACCTAX.
**CURRENCY
*populate it_curr - BAPI currency table
IT_CURR-ITEMNO_ACC = V_ITEM. "IT_ITEM-NEWBS.
IT_CURR-CURRENCY = IT_HEADER-WAERS.
IT_CURR-AMT_DOCCUR = IT_ITEM-WRBTR * -1.
IT_CURR-EXCH_RATE = IT_HEADER-KURSF.
V_BUKRS = IT_HEADER-BUKRS.
V_MWSKZ = IT_ITEM-MWSKZ.
V_WAERS = IT_HEADER-WAERS.
V_WRBTR = IT_ITEM-WRBTR.
CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'
EXPORTING
I_BUKRS = V_BUKRS
I_MWSKZ = V_MWSKZ
I_WAERS = V_WAERS
I_WRBTR = V_WRBTR
* IMPORTING
* E_FWNAV =
* E_FWNVV =
* E_FWSTE =
* E_FWAST =
TABLES
T_MWDAT = IT_MWDAT
EXCEPTIONS
BUKRS_NOT_FOUND = 1
COUNTRY_NOT_FOUND = 2
MWSKZ_NOT_DEFINED = 3
MWSKZ_NOT_VALID = 4
ACCOUNT_NOT_FOUND = 5
DIFFERENT_DISCOUNT_BASE = 6
DIFFERENT_TAX_BASE = 7
TXJCD_NOT_VALID = 8
NOT_FOUND = 9
KTOSL_NOT_FOUND = 10
KALSM_NOT_FOUND = 11
PARAMETER_ERROR = 12
KNUMH_NOT_FOUND = 13
KSCHL_NOT_FOUND = 14
UNKNOWN_ERROR = 15
OTHERS = 16
IF SY-SUBRC = 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
IT_CURR-TAX_AMT = IT_MWDAT-KBETR.
IT_CURR-AMT_BASE = IT_MWDAT-KAWRT.
ENDIF.
APPEND IT_CURR.
***Extension1
*populate it_extension1 - BAPI extension1 table
V_NEWBS = IT_ITEM-NEWBS.
IT_EXTENSION1-FIELD1(10) = V_ITEM.
IT_EXTENSION1-FIELD1+10(2) = IT_ITEM-MWSKZ.
IF NOT IT_ITEM-MWSKZ IS INITIAL.
IT_EXTENSION1-FIELD2(10) = V_ITEM.
IT_EXTENSION1-FIELD2+10(1) = 'X'.
ENDIF.
*for posting key
IT_EXTENSION1-FIELD3 = V_NEWBS.
*for posting key IN EXTENSION2
IT_EXTENSION2-STRUCTURE = 'ACCIT'.
IT_TES-POSNR = V_ITEM.
IT_TES-BSCHL = V_NEWBS.
IT_TES-MWSKZ = IT_ITEM-MWSKZ.
* IT_TES-XMWST = 'X'.
IT_TES-KBETR = IT_MWDAT-KBETR.
MOVE IT_TES TO IT_EXTENSION2-VALUEPART1. "#EC ENHOK
IT_EXTENSION2-VALUEPART2(10) = V_ITEM.
IT_EXTENSION2-VALUEPART2 = IT_ITEM-MWSKZ.
IF NOT IT_ITEM-MWSKZ IS INITIAL.
IT_EXTENSION2-VALUEPART3(10) = V_ITEM.
IT_EXTENSION2-VALUEPART3+10(1) = 'X'.
ENDIF.
APPEND IT_EXTENSION2.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = IT_DOC
* CUSTOMERCPD =
* CONTRACTHEADER =
IMPORTING
OBJ_TYPE = V_OBJ_TYPE
OBJ_KEY = V_OBJ_KEY
OBJ_SYS = V_OBJ_SYS
TABLES
ACCOUNTGL = IT_ACCGL
* ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = IT_ACCREC
* ACCOUNTTAX = IT_ACCTAX
CURRENCYAMOUNT = IT_CURR
* CRITERIA =
* VALUEFIELD =
EXTENSION1 = IT_EXTENSION1
RETURN = IT_RETURN
* PAYMENTCARD =
* CONTRACTITEM =
EXTENSION2 = IT_EXTENSION2
* REALESTATE =
* ACCOUNTWT =
this is for Vendor account upload to F-02.
in the flat file i am getting the Tax codes J0 and J1. for J0 there is no tax. for j1 we have 17% tax.
I am not clear in passing the values. i tried to pass the values through EXTENSION1 and EXTENSION2 also.
Kindly help me n solving this.
Thanks in Advance.
Vikki.Hi All,
Still i am not able to get the required result.
Now i am passing the Values to the Tax values to ACCOUNTTAX strcture.
But the GL is not posted .
Can you give me some code snippets on how to pass on the value to ACCOUNTTAX, CURRENCY................
For each and every Line item how we need to pass on the TAX and CURRECNY details?
For the items which have TAX , a extra line for TAX item should be created/
Is it possible to do this with EXTENSION1 or EXTENSION2?
it will be very helpful to me if you can guide me in solving this.
Awaiting your replies.
Vikki. -
The typical problem with BAPI_ACC_DOCUMENT_POST
Hi all!
Just my first post in the forum.
I'm using the BAPI_ACC_DOCUMENT_POST to generate an accountable document. As I've seen with a lot of people, the bapi is succesfully executed, but no doc. is created.
Can anyone have a look on my code and try to guide me through the right way to have my doc?
--- doc_head TYPE BAPIACHE09 ---
doc_head-obj_type = 'BKPFF'.
CONCATENATE SY-SYSID 'CLNT' SY-MANDT INTO
DOC_HEAD-OBJ_SYS.
doc_head-obj_key = '$'.
doc_head-COMP_CODE = P_BUKRS.
doc_head-DOC_TYPE = 'SA'.
doc_head-PSTNG_DATE = P_BUDAT.
doc_head-FISC_YEAR = sy-datum(4). "Periodo liquidación
doc_head-FIS_PERIOD = sy-datum+4(2).
doc_head-USERNAME = SY-UNAME.
doc_head-DOC_DATE = sy-datum.
doc_head-BUS_ACT = 'RFBU'.
--- w_bseg TYPE TABLE OF BAPIACGL09 ---
--- t_cur_am TYPE TABLE OF BAPIACCR09 ---
w_bseg-ITEMNO_ACC = '0001'.
w_bseg-GL_ACCOUNT = '0006230000'.
w_bseg-ALLOC_NMBR = P_REF.
w_bseg-stat_con = 'S'.
w_bseg-COSTCENTER = P_COST_CENTER.
w_bseg-TAX_CODE = 'S0'.
APPEND w_bseg.
CLEAR w_bseg-COSTCENTER.
t_cur_am-ITEMNO_ACC = '0001'.
t_cur_am-CURRENCY = 'EUR'.
t_cur_am-AMT_DOCCUR = '100'.
APPEND t_cur_am.
w_bseg-ITEMNO_ACC = '0002'.
w_bseg-ITEM_TEXT = TEXT-001.
w_bseg-GL_ACCOUNT = '0004000900'.
w_bseg-ALLOC_NMBR = P_TEXT.
w_bseg-stat_con = 'H'.
APPEND w_bseg.
Llenar importes
t_cur_am-ITEMNO_ACC = '0002'.
t_cur_am-CURRENCY = 'EUR'.
t_cur_am-AMT_DOCCUR = '100'.
APPEND t_cur_am.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = doc_head
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE = obj_type
OBJ_KEY = obj_key
OBJ_SYS = obj_sys
TABLES
ACCOUNTGL = w_bseg
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE =
ACCOUNTTAX =
CURRENCYAMOUNT = t_cur_am
CRITERIA =
VALUEFIELD =
EXTENSION1 =
RETURN = t_ret
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
b_wait = 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = b_wait
IMPORTING
RETURN = b_ret.
I get my "Document XXXXXXXXXX was Successfully created" but no BKPF record is created on the database. Any ideas?
Thank you very much!
Message was edited by: Angel GarciaHi Angel,
1. U code must be absolutely right.
2. The problem is with this general bapi.
3. I also faced the same problem,
but there is no solution for this
on SDN.
4. After posting the bapi, (also using commit)
the message says, Docuement xXX created,
but actually there is no document
in tables.
5. Even the Number Range is incremented,
but no document.
6. Its really a mystery for me.
regards,
amit m. -
BAPI_ACC_DOCUMENT_POST in down payment
Hi!
When i create a Purchase order i have to make an automatic down payment request (F-47), i'm working with an user exit that calls the BAPI_ACC_DOCUMENT_POST bapi from the PO transaction. Anybody have a code example on how to use this bapi with this scenario?. I made a local program to test the bapi with this call:
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
DOCUMENTHEADER = WA_DOCHEAD
CUSTOMERCPD =
CONTRACTHEADER =
TABLES
ACCOUNTGL =
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = IT_VENDOR
ACCOUNTTAX =
CURRENCYAMOUNT = IT_CURRENCY
CRITERIA =
VALUEFIELD =
EXTENSION1 =
RETURN = IT_RETURN
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
The IT_RETURN itab from BAPI_ACC_DOCUMENT_CHECK returns "Document check - no errors" .
the IT_RETURN itab from BAPI_ACC_DOCUMENT_POST returns
"Document posted successfully"
But no document had been posted! i look at the BKPF itab and nothing was created.
Please help.
Thanks in advance.
John.Hi Rishi !
I am using the bapi commit. here's the test code:
*& Report YPRUEBA_BAPI_DOCUMENT_POST *
REPORT YPRUEBA_BAPI_DOCUMENT_POST .
* ************* LLENAR ESTRUCTURAS BAPI ****************************
DATA: WA_DOCHEAD TYPE BAPIACHE09,
IT_ACCOUNT TYPE TABLE OF BAPIACGL09,
WA_ACCOUNT TYPE BAPIACGL09,
IT_CURRENCY TYPE TABLE OF BAPIACCR09,
WA_CURRENCY TYPE BAPIACCR09,
IT_VENDOR TYPE TABLE OF BAPIACAP09,
WA_VENDOR TYPE BAPIACAP09,
IT_RETURN TYPE TABLE OF BAPIRET2,
WA_RETURN TYPE BAPIRET2,
WA_CRITERIA TYPE BAPIACKEC9,
WA_CURRENCY_EXT TYPE P DECIMALS 2.
DATA: KEY(19) TYPE C.
DATA: COMMIT_RET TYPE BAPIRET2.
REFRESH: IT_ACCOUNT,
IT_CURRENCY,
IT_RETURN.
CLEAR: WA_DOCHEAD,
WA_ACCOUNT,
WA_CURRENCY,
WA_RETURN,
WA_CRITERIA,
WA_CURRENCY_EXT.
* FILL KEY FIELD
KEY = '0000000000'.
KEY+11(4) = '2000'.
KEY+15(4) = '2005'.
WA_DOCHEAD-USERNAME = SY-UNAME.
WA_DOCHEAD-OBJ_TYPE = 'IDOC'.
WA_DOCHEAD-OBJ_KEY = KEY.
WA_DOCHEAD-OBJ_SYS = 'Z220'.
WA_DOCHEAD-COMP_CODE = '2000'. "SOCIEDAD
WA_DOCHEAD-DOC_DATE = SY-DATUM.
WA_DOCHEAD-PSTNG_DATE = SY-DATUM.
WA_DOCHEAD-TRANS_DATE = SY-DATUM.
WA_DOCHEAD-DOC_TYPE = 'KA'.
WA_DOCHEAD-BUS_ACT = 'RFBU'.
CONCATENATE 'Solicitud de anticipo. Fecha:' SY-DATUM
INTO WA_DOCHEAD-HEADER_TXT.
* WA_ACCOUNT-TAX_CODE = 'C3'.
* WA_ACCOUNT-ACCT_TYPE = 'K'.
* WA_ACCOUNT-ITEMNO_ACC = '0000000010'.
* WA_ACCOUNT-GL_ACCOUNT = '1121501001'.
* WA_ACCOUNT-VALUE_DATE = SY-DATUM.
* WA_ACCOUNT-CUSTOMER = '2000015'.
* WA_ACCOUNT-ITEM_TEXT = 'Posición anticipo'.
* WA_ACCOUNT-DOC_TYPE = 'KA'.
* WA_ACCOUNT-COMP_CODE = '2000'.
* WA_ACCOUNT-PSTNG_DATE = SY-DATUM.
* WA_ACCOUNT-COSTCENTER = SPACE.
* WA_ACCOUNT-ALLOC_NMBR = 'Nº asignación'.
* WA_ACCOUNT-PROFIT_CTR = SPACE.
* WA_ACCOUNT-ORDERID = SPACE.
* CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
* EXPORTING
* INPUT = WA_ACCOUNT-CUSTOMER
* IMPORTING
* OUTPUT = WA_ACCOUNT-CUSTOMER.
* CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
* EXPORTING
* INPUT = WA_ACCOUNT-GL_ACCOUNT
* IMPORTING
* OUTPUT = WA_ACCOUNT-GL_ACCOUNT.
* APPEND WA_ACCOUNT TO IT_ACCOUNT.
* CLEAR WA_ACCOUNT.
WA_CURRENCY-ITEMNO_ACC = '0000000010'.
WA_CURRENCY-CURR_TYPE = '00'.
WA_CURRENCY-CURRENCY = 'USD'.
* WA_CURRENCY-AMT_DOCCUR = '150000.00'.
WA_CURRENCY-AMT_BASE = '15000.00'.
APPEND WA_CURRENCY TO IT_CURRENCY.
CLEAR WA_CURRENCY.
WA_VENDOR-ITEMNO_ACC = '0000000010'.
WA_VENDOR-VENDOR_NO = '2000015'.
WA_VENDOR-SP_GL_IND = 'A'.
* WA_VENDOR-TAX_CODE = 'C3'.
WA_VENDOR-COMP_CODE = '2000'.
WA_VENDOR-GL_ACCOUNT = '1121501001'.
WA_VENDOR-BLINE_DATE = '20050510'.
WA_VENDOR-PYMT_AMT = '150000.00'.
WA_VENDOR-PYMT_CUR = 'VEB'.
* WA_VENDOR-PYMT_CUR_ISO = 'VEB'.
WA_VENDOR-PMNTTRMS = 'Z001'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = WA_VENDOR-GL_ACCOUNT
IMPORTING
OUTPUT = WA_VENDOR-GL_ACCOUNT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = WA_VENDOR-VENDOR_NO
IMPORTING
OUTPUT = WA_VENDOR-VENDOR_NO.
APPEND WA_VENDOR TO IT_VENDOR.
CLEAR WA_VENDOR.
* PROBAMOS LA BAPI
REFRESH IT_RETURN.
CLEAR WA_RETURN.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
DOCUMENTHEADER = WA_DOCHEAD
* CUSTOMERCPD =
* CONTRACTHEADER =
TABLES
* ACCOUNTGL =
* ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = IT_VENDOR
* ACCOUNTTAX =
CURRENCYAMOUNT = IT_CURRENCY
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
RETURN = IT_RETURN
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
* Se leen los resultados del posteo
* el mensaje S RW 614 indica que el chequeo fue exitoso
READ TABLE it_return INTO wa_return WITH KEY type = 'S'
id = 'RW'
number = '614'.
IF SY-SUBRC = 0.
REFRESH IT_RETURN.
CLEAR WA_RETURN.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = WA_DOCHEAD
* CUSTOMERCPD =
* CONTRACTHEADER =
* IMPORTING
* OBJ_TYPE =
* OBJ_KEY =
* OBJ_SYS =
TABLES
* ACCOUNTGL =
* ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = IT_VENDOR
* ACCOUNTTAX =
CURRENCYAMOUNT = IT_CURRENCY
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
RETURN = IT_RETURN
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
* Se leen los resultados del posteo
* el mensaje S RW 605 indica que el POST fue exitoso
READ TABLE it_return INTO wa_return WITH KEY type = 'S'
id = 'RW'
number = '605'.
IF SY-SUBRC = 0.
CLEAR COMMIT_RET.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = COMMIT_RET
ELSE.
MESSAGE S162(00) WITH 'Error en el Posteo'.
ENDIF.
ELSE.
MESSAGE S162(00) WITH 'Error en el chequeo'.
ENDIF.
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:24 AM -
Errors in BAPI_ACC_DOCUMENT_POST
i m calling BAPI BAPI_ACC_DOCUMENT_POST for GL posting...i have append some values which i get from the excel sheet...but the thing i m getting below errors..i m unable to sort out these...
Error in document: BKPF E000000024DM102009
Required field OBJ_SYS was not transferred in parameter DOCUMENTHEADER
Incorrect entry in field OBJ_TYPE: BKPF
Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL
G/L account is not defined in chart of accounts CADCOk. Let me give this sample coding to you. I have extensively used this BAPI including the check accounting bapi.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = DOCUMENTHEADER
CUSTOMERCPD = CUSTOMERCPD
* CONTRACTHEADER =
IMPORTING
OBJ_TYPE = DOCUMENTHEADER-OBJ_TYPE
OBJ_KEY = OBJ_KEY2
OBJ_SYS = DOCUMENTHEADER-OBJ_SYS
TABLES
ACCOUNTGL = ACCOUNTGL
ACCOUNTRECEIVABLE = ACCOUNTRECEIVABLE
ACCOUNTPAYABLE = ACCOUNTPAYABLE
* ACCOUNTTAX = ACCOUNTTAX
CURRENCYAMOUNT = CURRENCYAMOUNT
* CRITERIA =
* VALUEFIELD =
EXTENSION1 = EXTENSION1
RETURN = RETURN
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
ACCOUNTWT = ACCOUNTWT
Now the Document header
Build DOCUMENTHEADER
DOCUMENTHEADER-OBJ_TYPE = OBJ_TYPE. (OBJ_TYPE(5) VALUE 'BKPF')
DOCUMENTHEADER-OBJ_KEY = OBJ_KEY. (Concatenate itab-REF_DOC_NO itab-COMP_CODE w_year 'OR' into OBJ_KEY)
DOCUMENTHEADER-OBJ_SYS = SY-MANDT.
DOCUMENTHEADER-BUS_ACT = BUS_ACT. (BUS_ACT(4) VALUE 'RFBU')
DOCUMENTHEADER-USERNAME = SY-UNAME.
DOCUMENTHEADER-COMP_CODE = itab2-COMP_CODE.
DOCUMENTHEADER-DOC_DATE = itab2-DOC_DATE.
DOCUMENTHEADER-PSTNG_DATE = itab2-PSTNG_DATE.
DOCUMENTHEADER-TRANS_DATE = itab2-TRANS_DATE.
DOCUMENTHEADER-FISC_YEAR = w_year.
DOCUMENTHEADER-FIS_PERIOD = w_period.
DOCUMENTHEADER-DOC_TYPE = itab2-DOC_TYPE.
DOCUMENTHEADER-REF_DOC_NO = itab2-REF_DOC_NO
* Build DOCUMENTHEADER
IF ITAB2-NAME <> ''.
CUSTOMERCPD-NAME = ITAB2-NAME.
CUSTOMERCPD-NAME_2 = ITAB2-NAME_2.
CUSTOMERCPD-NAME_3 = ITAB2-NAME_3.
CUSTOMERCPD-NAME_4 = ITAB2-NAME_4.
CUSTOMERCPD-POSTL_CODE = ITAB2-POSTL_CODE.
CUSTOMERCPD-CITY = ITAB2-CITY.
CUSTOMERCPD-REGION = ITAB2-REGION.
CUSTOMERCPD-COUNTRY = ITAB2-COUNTRY.
CUSTOMERCPD-STREET = ITAB2-STREET.
CUSTOMERCPD-BANK_ACCT = ITAB2-BANK_ACCT.
CUSTOMERCPD-BANK_NO = ITAB2-BANK_NO.
CUSTOMERCPD-BANK_CTRY = ITAB2-BANK_CTRY.
CUSTOMERCPD-CTRL_KEY = ITAB2-CTRL_KEY.
ENDIF.
*Build Account G/L
itemno = itemno + 1.
ACCOUNTGL-ITEMNO_ACC = ITEMNO.
* ACCOUNTGL-GL_ACCOUNT = itab-sapcode.
ACCOUNTGL-ITEM_TEXT = itab-ITEM_TEXT_GL.
ACCOUNTGL-REF_KEY_1 = itab-REF_KEY_1_GL.
ACCOUNTGL-REF_KEY_2 = itab-REF_KEY_2_GL.
ACCOUNTGL-ACCT_TYPE = itab-ACCT_TYPE_GL.
ACCOUNTGL-BUS_AREA = itab-BUS_AREA_GL.
ACCOUNTGL-TAX_CODE = itab-TAX_CODE_GL.
ACCOUNTGL-TAXJURCODE = itab-TAXJURCODE_GL.
ACCOUNTGL-COSTCENTER = itab-COSTCENTER_GL.
ACCOUNTGL-PROFIT_CTR = itab-PROFIT_CTR_GL.
ACCOUNTGL-ORDERID = itab-ORDERID_GL.
ACCOUNTGL-ASSET_NO = itab-ASSET_NO_GL.
ACCOUNTGL-SUB_NUMBER = itab-SUB_NUMBER_GL.
ACCOUNTGL-SALES_ORD = itab-SALES_ORD_GL.
ACCOUNTGL-S_ORD_ITEM = itab-S_ORD_ITEM_GL.
ACCOUNTGL-DE_CRE_IND = itab-DE_CRE_IND_GL.
ACCOUNTGL-QUANTITY = itab-QUANTITY_GL.
ACCOUNTGL-BASE_UOM = itab-BASE_UOM_GL.
ACCOUNTGL-MATERIAL = itab-MATERIAL_GL.
ACCOUNTGL-PO_NUMBER = itab-PO_NUMBER_GL.
ACCOUNTGL-PO_ITEM = itab-PO_ITEM_GL.
Append ACCOUNTGL.
* Build accountreceivable
itemno = itemno + 1.
ACCOUNTRECEIVABLE-ITEMNO_ACC = ITEMNO.
* ACCOUNTRECEIVABLE-CUSTOMER = itab-sapcode.
ACCOUNTRECEIVABLE-BUS_AREA = itab-BUS_AREA_GL.
ACCOUNTRECEIVABLE-PMNTTRMS = itab-PMNTTRMS_AP.
ACCOUNTRECEIVABLE-BLINE_DATE = itab2-BLINE_DATE_AR.
ACCOUNTRECEIVABLE-PYMT_METH = itab-PYMT_METH_AR.
ACCOUNTRECEIVABLE-PMNT_BLOCK = itab-PMNT_BLOCK_AR.
ACCOUNTRECEIVABLE-BANK_ID = itab-BANK_ID_AR.
ACCOUNTRECEIVABLE-SP_GL_IND = itab-SP_GL_IND_AR.
ACCOUNTRECEIVABLE-ALT_PAYEE = itab-ALT_PAYEE_AR.
ACCOUNTRECEIVABLE-PROFIT_CTR = itab-PROFIT_CTR_GL.
Append ACCOUNTRECEIVABLE.
* Build Accounts payable
itemno = itemno + 1.
ACCOUNTPAYABLE-ITEMNO_ACC = ITEMNO.
* ACCOUNTPAYABLE-VENDOR_NO = itab-sapcode.
ACCOUNTPAYABLE-BUS_AREA = itab-BUS_AREA_GL.
ACCOUNTPAYABLE-PMNTTRMS = itab-PMNTTRMS_AP.
ACCOUNTPAYABLE-ALLOC_NMBR = itab-ALLOC_NMBR_GL.
ACCOUNTPAYABLE-SP_GL_IND = itab-SP_GL_IND_AR.
ACCOUNTPAYABLE-BLINE_DATE = itab-BLINE_DATE_AR.
ACCOUNTPAYABLE-PROFIT_CTR = itab-PROFIT_CTR_GL.
Append ACCOUNTPAYABLE.
* Build Currency Amount
CURRENCYAMOUNT-ITEMNO_ACC = ITEMNO.
CURRENCYAMOUNT-CURR_TYPE = CURR_TYPE1.
CURRENCYAMOUNT-CURRENCY = itab-CURRENCY_CUR.
CURRENCYAMOUNT-AMT_DOCCUR = itab-AMT_DOCCUR_DOC.
CURRENCYAMOUNT-EXCH_RATE = itab-EXCH_RATE_CUR.
Append CURRENCYAMOUNT.
if itab-CURRENCY_CUR ne w_currency.
CURRENCYAMOUNT-ITEMNO_ACC = ITEMNO.
CURRENCYAMOUNT-CURR_TYPE = CURR_TYPE2.
CURRENCYAMOUNT-CURRENCY = w_currency.
CURRENCYAMOUNT-AMT_DOCCUR = itab-AMT_DOCCUR_LOC.
CURRENCYAMOUNT-EXCH_RATE = itab-EXCH_RATE_CUR.
Append CURRENCYAMOUNT.
endif.
* Witholding Tax
if ITAB-WT_TYPE_WT <> ''.
itemno = itemno + 1 .
ACCOUNTWT-ITEMNO_ACC = ITEMNO.
ACCOUNTWT-WT_TYPE = itab-WT_TYPE_WT.
ACCOUNTWT-WT_CODE = itab-WT_CODE_WT.
Append ACCOUNTWT.
endif.
Tell me if you don't understand any part. This is working in production at my place.
Varun Mathur
Edited by: Varun Mathur on Aug 17, 2009 12:42 PM
Edited by: Varun Mathur on Aug 17, 2009 12:44 PM -
Additional Fields in BAPI_ACC_DOCUMENT_POST
Hello Experts,
I am Using bapi 'BAPI_ACC_DOCUMENT_POST' to post document for FB60. Everthing work fine, but i have two additional i.e
1. Cash Discount -> bseg-wskto
2. Disc. Base -> bseg-skfbt
which is not in this bapi parameters. I also go for extension2 parameter, but in ACCIT table of exit 'EXIT_SAPLACC4_001' doesn't contain that two field.
Is there any SAP Note for this problem. Please do suggest some solution..
Thanks in Advance...Hi Dhiraj,
Use 'BAPI_ACC_GL_POSTING_POST' to post documents in FB60. Give ur appropriate GLs and amount in separate tables.
Thanks,
Usman Malik -
Currency value in BAPI_ACC_DOCUMENT_POST
Hi All;
in order to post payments i use BAPI_ACC_DOCUMENT_POST. There are many payment lines (posting key 40) and one vendor line (posting key 31). i have filled in tables header, account_gl, accounts_payable and currency-amount accordingly. When i run the function it issues an error stating 'use another currency other than ..'. I have tried with different currencies but the error keeps coming. I pass the currency value in account payable and currency amount tables. how can i sole this problem, is it smt. with FI customising?
Thx
aliHi,
here is my code:
clear header.
header-comp_code = '1100'.
header-username = sy-uname.
header-bus_act = 'RFBU'.
header-pstng_date = budat."kyt_tarih.
header-doc_date = bldat."g_tarih.
header-doc_type = 'SA'.
append header.
clear vendor.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lifnr
IMPORTING
output = lifnr.
vendor-vendor_no = lifnr.
vendor-comp_code = '1100'.
vendor-itemno_acc = sayac.
vendor-tax_code = mwskz.
vendor-pymt_amt = 0 - toplam.
vendor-pymt_cur = waers."'TRY'.
vendor-pymt_cur_iso = waers.
append vendor.
clear tax.
tax-itemno_acc = sayac.
tax-gl_account = zco_benzin_match-hkont.
tax-tax_code = mwskz.
append tax.
clear amount.
amount-itemno_acc = sayac.
amount-currency = waers. "'TRY'.
amount-currency_iso = waers.
amount-curr_type = '00'.
amount-amt_doccur = 0 - toplam.
amount-amt_base = 0 - toplam.
append amount.
loop at itab.
sayac = sy-tabix.
clear accountgl.
clear tax.
clear amount.
clear zco_benzin_match.
if itab-kostl co numbers.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = itab-kostl
IMPORTING
output = itab-kostl.
endif.
select single * from zco_benzin_match where kostl = itab-kostl.
accountgl-itemno_acc = sayac.
accountgl-comp_code = '1100'.
accountgl-pstng_date = budat."kyt_tarih.
accountgl-doc_type = 'SA'.
accountgl-gl_account = zco_benzin_match-hkont.
accountgl-vendor_no = lifnr.
accountgl-tax_code = mwskz.
accountgl-orderid = itab-plaka.
accountgl-item_text = itab-tip.
append accountgl.
tax-itemno_acc = sayac.
tax-gl_account = zco_benzin_match-hkont.
tax-tax_code = mwskz.
append tax.
it_accounttax-acct_key = 'VST'.
clear amount.
amount-itemno_acc = sayac.
amount-currency = waers. "'TRY'.
amount-currency_iso = waers.
amount-curr_type = '00'.
amount-amt_doccur = itab-wrbtr.
amount-amt_base = itab-wrbtr.
append amount.
if not zco_benzin_match-hkont is initial.
move itab-wrbtr to tutar.
translate tutar using '.,'.
endif.
endloop.
if not test is initial.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
DOCUMENTHEADER = header
CUSTOMERCPD =
CONTRACTHEADER =
TABLES
ACCOUNTGL = accountgl
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = vendor
ACCOUNTTAX = tax
CURRENCYAMOUNT = amount
CRITERIA =
VALUEFIELD =
EXTENSION1 =
RETURN = messages
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
ACCOUNTWT =
else.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = header
CUSTOMERCPD =
CONTRACTHEADER =
TABLES
ACCOUNTGL = accountgl
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = vendor
ACCOUNTTAX = tax
CURRENCYAMOUNT = amount
CRITERIA =
VALUEFIELD =
EXTENSION1 =
RETURN = messages
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
ACCOUNTWT =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = messages.
endif.
Thx .
Ali. -
Posting Key in BAPI_ACC_DOCUMENT_POST
Hi,
I am using bapi 'BAPI_ACC_DOCUMENT_POST' to post 'Customer Document' in FB01. I was able to post the document but Posting Key in the document is not as desired. When I try to Post the document with out any Posting Key by default I am having Posting Key as '01'(Customer document) and '50'(GL account).
But I want bapi 'BAPI_ACC_DOCUMENT_POST' to post a document with Posting key '15'(Customer Document) and '40'(GL account).
In bapi I am using these tables along with header.
ACCOUNTGL- GL Account
ACCOUNTRECEIVABLE- Customer Document
I tried passing the posting key in ACCT_TYPE in table ACCOUNTGL and passing the the posting key using EXTENSION2 table but was not successful .
Can anyone let me know
How can I pass the Posting Key to the bapi 'BAPI_ACC_DOCUMENT_POST' for Customer Document and GL account?
OR
How can I use EXTENSION2 table to create an appropriate posting key?
please let me know.
Vikki,
In one of your thread you came across the same issue and you solved it. Can you please guide me how to achive appropriate posting key using EXTENSION2 table?
Thanks,
Vijay.Hi,
Just follow these steps:
1. Fill in your EXTENSION table like this
first 3 character represent item number
next 2 character represent posting key
CLEAR: gt_extension.
gt_extension(3) = sy-index(3).
gt_extension+3(2) = 'New Posting Key'.
APPEND gt_extension.
2. Create an FM similar to SAMPLE_INTERFACE_RWBAPI01 and put the following codes:
IF NOT extension IS INITIAL.
LOOP AT extension.
READ TABLE it_accit WITH KEY posnr = extension(3).
IF sy-subrc IS INITIAL.
it_accit-bschl = extension+3(2).
MODIFY it_accit INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDIF.
3.
- Go to TCode "FIBF".
- Go to Settings -> Products -> ... of a customer
- Create a new entry and check the box to activate the product
Product = <any name>
Text = <description>
RFC = blank
Check the activation box
- Go to Settings -> Process Modules -> ... of a customer
- Create a new entry by specifying the name of the function module name and product name created earlier.
Process = RWBAPI01
Ctr = blank
Appl = blank
FM = <FM created>
Product = <name of product created earlier>
Hope this helps,
Leonard Chomi. -
Problem with postingkeys in using BAPI_ACC_DOCUMENT_POST
Hi everyone,
I'm passing the postingkey, WBS element, Sales tax code into the EXTENSION1 variable of BAPI_ACC_DOCUMENT_POST. But it is populating the postingkeys with other values.
suppose, i'm passing the posting keys with values 02, 12 but when i check the posted document number in FB03 it is showing the posting keys as 01 & 11.
Could anyone help me with this.
Regards,
TomHi,
I just checked the coding of this BAPI and saw that Extension1 is used in a user exit as below, which calls a Business transaction events. So I guess you will have to implement the BTE by creating your own function module to change the posting key according to your requirement.
Have a look at the function module OPEN_FI_PERFORM_RWBAPI01_P. This is called from the subroutine below
PERFORM call_customer_function
TABLES extension1.
For further details, check the function module's (BAPI_ACC_DOCUMENT_POST) documentation and click on extension1 -- further click on BTE link provided there.
You can also achieve this using the BADI ACC_DOCUMENT, here you would have to pass your data to extension2 isntead.
KR,
Advait
Edited by: Advait Gode on Aug 7, 2009 8:28 AM -
BAPI_ACC_DOCUMENT_POST. Why tax account is replaced ?
The code as follow:
REPORT YC_BAPI_ACC_DOCUMENT_POST.
* bapi
CLEAR:BAPI_HEADER,
BAPI_ACCOUNTGL,
BAPI_ACCOUNTRECEIVABLE,
BAPI_ACCOUNTPAYABLE,
BAPI_ACCOUNTTAX,
BAPI_CURRENCYAMOUNT,
BAPI_RETURN,
BAPI_EXTENSION2,
LS_ACCOUNTGL,
LS_RECEIVABLE,
LS_ACCOUNTPAYABLE,
LS_ACCOUNTTAX,
LS_CURRENCYAMOUNT,
LS_EXTENSION,
LS_EXTENSION_BAPI.
* set header
CLEAR BAPI_HEADER.
BAPI_HEADER-DOC_TYPE = 'SA'. "u51EDu8BC1u7C7Bu578B
BAPI_HEADER-COMP_CODE = '1000'. "u516Cu53F8u4EE3u7801
BAPI_HEADER-BUS_ACT = 'RFBU'. "u4E1Au52A1u8303u56F4
BAPI_HEADER-DOC_DATE = SY-DATUM. "u51EDu8BC1u65E5u671F
BAPI_HEADER-PSTNG_DATE = SY-DATUM. "u8FC7u8D26u65E5u671F
BAPI_HEADER-HEADER_TXT = SY-DATUM. "u9879u76EEu62ACu5934u6587u672C
BAPI_HEADER-FISC_YEAR = SY-DATUM+0(4)."u5E74u5EA6
BAPI_HEADER-FIS_PERIOD = SY-DATUM+4(2). "u671Fu95F4
BAPI_HEADER-REF_DOC_NO = ''. "u53C2u8003u51EDu8BC1u7F16u53F7
BAPI_HEADER-HEADER_TXT = ''. "u51EDu8BC1u62ACu5934u6587u672C
BAPI_HEADER-USERNAME = SY-UNAME. "u8BB0u8D26u7528u6237
* set items
CLEAR LS_ACCOUNTGL.
LS_ACCOUNTGL-ITEMNO_ACC = 1."u884Cu9879u76EEu53F7
LS_ACCOUNTGL-GL_ACCOUNT = '0000154001'.
LS_ACCOUNTGL-TAX_CODE = 'V2'."u7A0Eu7801
*LS_ACCOUNTGL-ACCT_KEY = 'VST'.
*LS_ACCOUNTGL-ACCT_TYPE = 'S'.
*LS_ACCOUNTGL-COND_CATEGORY = 'D'.
APPEND LS_ACCOUNTGL TO BAPI_ACCOUNTGL.
CLEAR LS_ACCOUNTGL.
LS_ACCOUNTGL-ITEMNO_ACC = 2."u884Cu9879u76EEu53F7
LS_ACCOUNTGL-GL_ACCOUNT = '0000078200'.
APPEND LS_ACCOUNTGL TO BAPI_ACCOUNTGL.
* set currency
LS_CURRENCYAMOUNT-ITEMNO_ACC = 1. "u884Cu9879u76EEu53F7
LS_CURRENCYAMOUNT-CURRENCY = 'EUR'. "u8D27u5E01u7801
LS_CURRENCYAMOUNT-CURR_TYPE = '00'. "u91D1u989Du7C7Bu578B
*LS_CURRENCYAMOUNT-EXCH_RATE = ''. "u6C47u7387
*LS_CURRENCYAMOUNT-AMT_DOCCUR = 100. "u51EDu8BC1u8D27u5E01u91D1u989D
*LS_CURRENCYAMOUNT-AMT_BASE = 1427.
APPEND LS_CURRENCYAMOUNT TO BAPI_CURRENCYAMOUNT.
CLEAR LS_CURRENCYAMOUNT.
LS_CURRENCYAMOUNT-ITEMNO_ACC = 2. "u884Cu9879u76EEu53F7
LS_CURRENCYAMOUNT-CURRENCY = 'EUR'. "u8D27u5E01u7801
LS_CURRENCYAMOUNT-CURR_TYPE = '00'. "u91D1u989Du7C7Bu578B
*LS_CURRENCYAMOUNT-EXCH_RATE = ''. "u6C47u7387
LS_CURRENCYAMOUNT-AMT_DOCCUR = -100. "u51EDu8BC1u8D27u5E01u91D1u989D
APPEND LS_CURRENCYAMOUNT TO BAPI_CURRENCYAMOUNT.
* tax items currence
CLEAR LS_ACCOUNTTAX.
LS_ACCOUNTTAX-ITEMNO_ACC = 3. "u884Cu9879u76EEu53F7
*LS_ACCOUNTTAX-GL_ACCOUNT = '0000154001'.
LS_ACCOUNTTAX-TAX_CODE = 'V2'."u9500u552Eu7A0Eu4EE3u7801
*LS_ACCOUNTTAX-TAX_RATE = LV_FWSTE. "u9500u552Eu7A0Eu7387
*LS_ACCOUNTTAX-DIRECT_TAX = 'X'.
*LS_ACCOUNTTAX-ITEMNO_TAX = 1. "u7A0Eu76F8u5173u884Cu9879u76EE
*LS_ACCOUNTTAX-ACCT_KEY = 'VST'.
*LS_ACCOUNTTAX-COND_KEY = 'MWS'.
APPEND LS_ACCOUNTTAX TO BAPI_ACCOUNTTAX.
CLEAR LS_CURRENCYAMOUNT.
LS_CURRENCYAMOUNT-ITEMNO_ACC = 3. "u884Cu9879u76EEu53F7
LS_CURRENCYAMOUNT-CURRENCY = 'EUR'."u8D27u5E01u7801
*LS_CURRENCYAMOUNT-EXCH_RATE = LS_ZCNTPDM01-KURSF."u6C47u7387u7801
LS_CURRENCYAMOUNT-AMT_DOCCUR = 100."u7A0Eu91D1
LS_CURRENCYAMOUNT-AMT_BASE = '1427.1'."u7A0Eu57FA
*LS_CURRENCYAMOUNT-TAX_AMT = 100.
APPEND LS_CURRENCYAMOUNT TO BAPI_CURRENCYAMOUNT.
* extend the reason code
CLEAR LS_EXTENSION.
LS_EXTENSION-POSNR = 1. "u884Cu9879u76EEu53F7
LS_EXTENSION-BSCHL = '40'. "u8BB0u8D26u7801
LS_EXTENSION_BAPI-STRUCTURE = 'ZEXCEL'."u81EAu5B9Au4E49u6269u5C55u7ED3u6784
LS_EXTENSION_BAPI-VALUEPART1 = LS_EXTENSION. "u6269u5C55u7ED3u6784
APPEND LS_EXTENSION_BAPI TO BAPI_EXTENSION2.
CLEAR LS_EXTENSION.
LS_EXTENSION-POSNR = 2. "u884Cu9879u76EEu53F7
LS_EXTENSION-BSCHL = '50'. "u8BB0u8D26u7801
LS_EXTENSION_BAPI-STRUCTURE = 'ZEXCEL'."u81EAu5B9Au4E49u6269u5C55u7ED3u6784
LS_EXTENSION_BAPI-VALUEPART1 = LS_EXTENSION. "u6269u5C55u7ED3u6784
APPEND LS_EXTENSION_BAPI TO BAPI_EXTENSION2.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = BAPI_HEADER
TABLES
ACCOUNTGL = BAPI_ACCOUNTGL
ACCOUNTRECEIVABLE = BAPI_ACCOUNTRECEIVABLE
ACCOUNTPAYABLE = BAPI_ACCOUNTPAYABLE
ACCOUNTTAX = BAPI_ACCOUNTTAX
CURRENCYAMOUNT = BAPI_CURRENCYAMOUNT
RETURN = BAPI_RETURN
EXTENSION2 = BAPI_EXTENSION2.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT BAPI_RETURN INTO LS_RETURN.
WRITE:/ LS_RETURN-MESSAGE.
ENDLOOP.
In FB03, The generated document as follow:
1000 1 50 78200 Transfer of reserves 100.00- EUR
1000 2 40 154000 Input tax 100.00 EUR V2
=========================================================
If i create a document in FB01 with the above data, the generated document as follow:
1000 1 50 78200 Transfer of reserves 100.00- EUR
1000 2 40 154001 Input tax 100.00 EUR V2
So, what i should do if i want '154001' in generated document by BAPI.
Please help me.
Thanks.
Edited by: y_ch_19 on Sep 28, 2011 11:09 AM
Edited by: Thomas Zloch on Sep 28, 2011 11:22 AMHi Vijaymadhur,
Thank you very much.
I check the reason is not enhancement or exit.
In t-code: FTXP, i see the tax code 'V2' corresponding the tax account '154000',
when execute the BAPI, the system determine the tax account by the tax code,
but i have no idear how to set the parameters in BAPI with no tax account replaced.
CLEAR LS_ACCOUNTTAX.
LS_ACCOUNTTAX-ITEMNO_ACC = 3. "u884Cu9879u76EEu53F7
*LS_ACCOUNTTAX-GL_ACCOUNT = '0000154001'.
LS_ACCOUNTTAX-TAX_CODE = 'V2'."u9500u552Eu7A0Eu4EE3u7801
*LS_ACCOUNTTAX-TAX_RATE = LV_FWSTE. "u9500u552Eu7A0Eu7387
*LS_ACCOUNTTAX-DIRECT_TAX = 'X'.
*LS_ACCOUNTTAX-ITEMNO_TAX = 1. "u7A0Eu76F8u5173u884Cu9879u76EE
*LS_ACCOUNTTAX-ACCT_KEY = 'VST'.
*LS_ACCOUNTTAX-COND_KEY = 'MWS'.
APPEND LS_ACCOUNTTAX TO BAPI_ACCOUNTTAX.
Maybe you are looking for
-
Update a maintenance view.
Hi , I want to update a maintenance view. Data is coming from a text file which i am uplaoding. Which function module should I use to update the maintenence view. Thanks, Ram.
-
5.1 surround wav export not working
I'm trying to export 5.1 surround sound in wav (lossless) but Premiere Pro CS6 isn't letting me. The audio file I have is 5.1. On some projects the 5.1 wav export works fine and others I can't export. I'm getting this error: Adobe Media Encoder: "Err
-
How do I check in a TFS solution to VSO?
I'm trying to move a solution from TFS to VSO. We're not migrating it on the server, I'm just trying to check it in new under VSO. I went into the .sln & .csproj files and removed all the SCC sections. I then opened the solution and tried to change t
-
Hello, When i run this routine in Transformation, its going to short dump with message : ASSERTION_FAILED data : Result1 type c. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING INPUT = SOURCE_FIELDS-MATNR IMPORTING OUTPUT = RESULT1. SELECT SIN
-
Hi, I'm trying to following Kohsuke Kawaguchi advise from here [http://weblogs.java.net/blog/kohsuke/archive/2007/01/mapping_the_sam.html] and implement my own AnnotationReader, in order to map the same POJOs to different XML representations in JAXB.