BAPI FB01
Hi gurus,
I am trying to run a BAPI 'BAPI_ACC_DOCUMENT_POST' for transacion FB01, although the program is not giving any errror but somehow no document is creating.
Can you please help me out.
Thanks
Rajeev Gupta
data: begin of it_input occurs 0,
doc_date(10),
pos_date(10),
doc_type(2),
pos_per(2),
c_code(4),
currency(3),
pos_key(2),
glaccount(10),
amount(16),
cctr(10),
prctr(10),
assignment(18),
end of it_input.
data: documentheader type BAPIACHE09,
obj_type type BAPIACHE09-OBJ_TYPE,
obj_key type BAPIACHE09-OBJ_KEY,
obj_sys type BAPIACHE09-OBJ_SYS,
glaccount like BAPIACGL09 occurs 0 with header line,
ap like BAPIACAP09 occurs 0 with header line,
currencyamount like BAPIACCR09 occurs 0 with header line,
return like BAPIRET2 occurs 0 with header line,
return2 type BAPIRET2.
perform get_data.
perform call_bapi.
*& Form get_data
text
--> p1 text
<-- p2 text
FORM get_data .
call function 'WS_UPLOAD'
EXPORTING
filename = 'C:\Documents and Settings\rajeevgupta\Desktop\fb01.txt'
filetype = 'DAT'
TABLES
data_tab = it_input
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.
ENDFORM. " get_data
*& Form call_bapi
text
--> p1 text
<-- p2 text
FORM call_bapi .
move:
it_input-doc_date to documentheader-doc_date,
it_input-pos_date to documentheader-pstng_date,
it_input-doc_type to documentheader-doc_type,
it_input-c_code to documentheader-comp_code,
it_input-pos_per to documentheader-fis_period.
move:
it_input-glaccount to glaccount-gl_account,
it_input-cctr to glaccount-costcenter,
it_input-prctr to glaccount-profit_ctr,
it_input-assignment to glaccount-alloc_numbr.
append glaccount.
move:
it_input-currency to currencyamount-currency,
it_input-amount to currencyamount-amt_doccur.
append currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = documentheader
IMPORTING
OBJ_TYPE = obj_type
OBJ_KEY = obj_key
OBJ_SYS = obj_sys
TABLES
ACCOUNTGL = glaccount
ACCOUNTPAYABLE = ap
CURRENCYAMOUNT = currencyamount
RETURN = return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = return2.
ENDFORM. " call_bapi
Hi,
Here is the example program
*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
Regards
Sudheer
Similar Messages
-
Help needed in BAPI for uploading data in FB01 - Urgent!!!
Hi,
i need to post a document in FB01.
i am getting the following details from the user in a .CSV file.
Vendor no, vendor name, amount, document date, posting datem reference vendor line item text and Gl account line item text.
i am using BAPI BAPI_ACC_DOCUMENT_POST to post the document.
Now my req is if the amount is in negative then
use posting key 31 against the vendor and 40 for GL account
if its positive amounts
use posting key of 24 against vendor and 50 against the GL account.
Now by default, when the amount is negative the function is working fine.
but when its is positive its posting 21 against vendor and 50 against GL account. but i need 24 against vendor
can any one tel me, where should i pass these value in the BAPI?
or is there any other way of doing it?
Regards,
NiyazHi,
the posting keys 31/21 (01/11 and 40/50) are hard coded and cannot be populated from the interface. This is because a different posting key could have a different posting logic from what is implemented in the BAPI.
So unless you want to do some modifications here, you have to use the fixed PKs. Pls. let me know if you are interested in where exactly the PKs are defined (hardcoded). I have this noticed for myself earlier but my notices are on another PC
Hope that helps, points welcome
Csaba -
Bapi for the transaction FBRA, FB08, FB01 anf FD02
hi,
can any one please help me with BAPI for the following transaction?
FBRA - reset cleared items
FB08 - reversal of the documents
FB01 - post documents
FD02 - change customer.
regards kritiHi
Copy the below program in se38 and execute the program and along with the transaction code you need to specify the program name to obtain the program name all you have to do is execute the t-code and go to system--> status and copy the program name from the screen and paste it in the above program.
tables : tstc,
tadir,
modsapt,
modact,
trdir,
tfdir,
enlfdir,
sxs_attrt ,
tstct.
data :
jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
parameters : p_tcode like tstc-tcode,
p_pgmna like tstc-pgmna .
data wa_tadir type tadir.
start-of-selection.
if not p_tcode is initial.
select single * from tstc where tcode eq p_tcode.
elseif not p_pgmna is initial.
tstc-pgmna = p_pgmna.
endif.
if sy-subrc eq 0.
select single * from tadir
where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir
where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir
where pname = tstc-pgmna.
select single * from enlfdir
where funcname = tfdir-funcname.
select single * from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
select * from tadir into table jtab
where pgmid = 'R3TR'
and object in ('SMOD', 'SXSD')
and devclass = v_devclass.
select single * from tstct
where sprsl eq sy-langu
and tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(105) sy-uline.
format color col_heading intensified on.
* sorting the internal table
sort jtab by object.
data : wf_txt(60) type c,
wf_smod type i ,
wf_badi type i ,
wf_object2(30) type c.
clear : wf_smod, wf_badi , wf_object2.
* get the total smod.
loop at jtab into wa_tadir.
at first.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Enhancement/ Business Add-in',
41 sy-vline ,
42 'Description',
105 sy-vline.
write:/(105) sy-uline.
endat.
clear wf_txt.
at new object.
if wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
elseif wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.
endif.
format color col_group intensified on.
write:/1 sy-vline,
2 wf_object2,
105 sy-vline.
endat.
case wa_tadir-object.
when 'SMOD'.
wf_smod = wf_smod + 1.
select single modtext into wf_txt
from modsapt
where sprsl = sy-langu
and name = wa_tadir-obj_name.
format color col_normal intensified off.
when 'SXSD'.
* for badis
wf_badi = wf_badi + 1 .
select single text into wf_txt
from sxs_attrt
where sprsl = sy-langu
and exit_name = wa_tadir-obj_name.
format color col_normal intensified on.
endcase.
write:/1 sy-vline,
2 wa_tadir-obj_name hotspot on,
41 sy-vline ,
42 wf_txt,
105 sy-vline.
at end of object.
write : /(105) sy-uline.
endat.
endloop.
write:/(105) sy-uline.
skip.
format color col_total intensified on.
write:/ 'No.of Exits:' , wf_smod.
write:/ 'No.of BADis:' , wf_badi.
else.
format color col_negative intensified on.
write:/(105) 'No userexits or BADis exist'.
endif.
else.
format color col_negative intensified on.
write:/(105) 'Transaction does not exist'.
endif.
at line-selection.
data : wf_object type tadir-object.
clear wf_object.
get cursor field field1.
check field1(8) eq 'WA_TADIR'.
read table jtab with key obj_name = sy-lisel+1(20).
move jtab-object to wf_object.
case wf_object.
when 'SMOD'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen.
when 'SXSD'.
set parameter id 'EXN' field sy-lisel+1(20).
call transaction 'SE18' and skip first screen.
endcase.
Regards
Pavan -
BAPI for transaction FB01 with account posting key
Hi,
I have to use a BAPI for registering Invoices into the FI module through the FB01 transaction.
I am trying to use the standard BAPI: BAPI_ACC_DOCUMENT_POST
The problem is that this BAPI does not manage the account posting key (field BSCHL).
Could anyone provide help?
Thank you very much in advance.It is happening here in the BAPI
CALL FUNCTION 'FI_GET_POSTING_KEY'
EXPORTING
i_ktosl = gs_accit-ktosl
IMPORTING
e_bschs = ld_bschs
e_bschh = ld_bschh
e_umskz = ld_umskz
EXCEPTIONS
error_message = 1.
As max pointed out, it is dependent on the transaction key(KTOSL).
Srinivas -
Dear all,
I am facing one problem for upload the data from excel to FB01 T-code..
here my excel sheet is like this
Doc Date Posting date Doc type Posting key GL account Amount Posting key GL account Amount
03.04.2010 03.04.2010 40 60011 8391 50 & GL & TAX again repeate....
04.04.2010 04.04.2010 40 60011 5496 40 60012 2198 50 & GL & TAX
05.04.2010 05.04.2010 40 60011 7887 40 60012 0 50 & GL & TAX
How should i do the program.....
plz give me any bapi program or bdc program for this type excel sheet....
plz help me..
Regards
marganiPosting FI documents is one of the more frequently discussed topics here, please search before posting. Do not expect complete solutions for requirements, always work yourself first.
Thread locked.
Thomas -
BAPI as interface to post document in FB01
Hi all
We are transferring data from Biztalk(middleware) to SAP in xml format through the BAPI Z_BAPI_ACC_DOCUMENT_POST to post document in FB01. Biztalk is able to send the data to sap. But when the document fails it is not returning the Return table to Biztalk. It is sending export parameters as
<OBJ_KEY>$</OBJ_KEY>
<OBJ_SYS>DV1</OBJ_SYS>
<OBJ_TYPE>BKPFF</OBJ_TYPE>
Now when the bapi fails where can i see the log for that if it is called from BIzatalk. I mean when the RFC fails hw vl i knw the reasons for the failure.....
If i do the same scenario in sap it is workin fine..... the problem comes only when it is called from middleware.....
We copied the standard BAPI BAPI_ACC_DOCUMENT_POST to a ZBAPI....
n used BAPI_TRANSACTION_COMMIT in my ZBAPI....
Can anyone please help me on this......Wild guess, though I doubt it will be of much help: In the olden days when you called RFC Function modules via external RFC clients, SAP did not return any TABLES function module parameters that were not specified. I.e. instead of not passing the parameter at all, you had to specify an empty table for any TABLES that were returned by the RFC call. I wonder if something similar happens in your case with the RETURN table (though I have no clue how if you're calling RFC via SOAP or RFC protocol).
-
What is the BAPI name for FB01
Hi all,
Currently i got requirement on Transactional data uploding to FB01 transaction thru BAPI.
I found the BAPI ' BAPI_ACC_GL_POSTING_POST'. But in this iam unable to find the Posting key(BSCHL) at line item level. If it is the exact BAPI tell me how to get the posting key for it. Please tell me the solution its urgent.
Thanks all,
Chinnamurthy.There are many
ACC4 FI/CO: BAPIs for UPDATE
BAPI_ACC_BILLING_POST Accounting: Post Billing Document (OAG: LOAD RECEIVABLE)
BAPI_ACC_EMPLOYEE_EXP_POST Accounting: Post G/L Acct Assignment for HR Posting (OAG: POST JOURNAL
BAPI_ACC_EMPLOYEE_PAY_POST Accounting: Post Vendor Acct Assignment for HR Posting (OAG: LOAD PAYA
BAPI_ACC_EMPLOYEE_REC_POST Accounting: Post Cust. Acct Assigt for HR Posting (OAG: LOAD RECEIVABL
BAPI_ACC_GL_POSTING_POST Accounting: General G/L Account Posting
BAPI_ACC_GOODS_MOVEMENT_POST Accounting: Post Goods Movement (OAG: POST JOURNAL)
BAPI_ACC_INVOICE_RECEIPT_POST Accounting: Post Invoice Receipt (OAG: LOAD PAYABLE)
BAPI_ACC_PURCHASE_ORDER_POST Accounting: Post Purchase Order
BAPI_ACC_PURCHASE_REQUI_POST Accounting: Post Purchase Requisition
BAPI_ACC_SALES_ORDER_POST Accounting: Post Sales Order
BAPI_ACC_SALES_QUOTA_POST Accounting: Post Customer Quotation
BAPI_ACC_TRAVEL_POST Accounting: Post Trip
The Function Module BAPI_ACC_GL_POSTING_POST is for General G/L account, you don't have to provide the posting key, but an amount positive or negative (Credit);
Regards -
Hi Gurus,
Do you know some BAPI that can be use to update XREF3 field or the Reference Key 3 in FB01 using (inbound) IDOC?
Thanks!Hi,
Thank you for your replies.
My requirement is that i should pass the tax amount from segment E2EDP04-MWSBT to XREF3 (reference field 3) in FB01. Im using FM: MRM_INVOICE_POST in posting.
Is there any BAPI which can be use to update XREF3? or is there a user-exit that can be use to access ACCIT which have the XREF3 field?
Thank you.
Edited by: saixis on Jul 27, 2011 2:32 PM -
Hi,
I am using bapi BAPI_ACC_DOCUMENT_POST.. for FB01 but i am not getting Two fields
PstKy (Posting Key for the Next Line Item) and SGL Ind (Special G/L Indicator for the Next Line Item)
is any other bapi avilabel for this...
or please give me sample bapi for FB01 or BAPI_ACC_DOCUMENT_POST.
Point is assureduse report RFBIBL00
A. -
Do we have any bdc or bapi for fb01 transaction ?(it should caluculate tax also)
Hi,
Try FM POSTING_INTERFACE_DOCUMENT
try these:
BAPI_ACC_GL_POSTING_POST
BAPI_ACC_BILLING_POST
BAPI_ACC_INVOICE_RECEIPT_POST
<b>Reward points</b>
Regards -
What is exact BAPI for FB01 transaction......
Hi,
Currently i got requirement to upload transactional data into FB01 using BAPI. I used BAPI_acc_gl_posting_post but it applicable only for GLs, but i want to upload Vendors, Customers, assets, Materials.. Please tell me apropriate BAPI for the requirement. Its urgent.
Thanks in advance...........
Regards,
Chinna.Thanks Atish....
I have written code using BAPI_ACC_DOCUMENT_POST. But it is not posting and it is not generating Object Key...
Please go thru the code and tell the solutions....
Thanks in Advance......
REPORT zk_fi_fb01 .
Data: v_objkey(20) type c.
Data: Docheader type BAPIACHE09.
Data: ACCOUNTGL LIKE BAPIACGL09 occurs 0 with header line,
ACCOUNTRECEIVABLE like BAPIACAR09,
ACCOUNTPAYABLE like BAPIACAP09 occurs 0 with header line,
CURRENCYAMOUNT like BAPIACCR09 occurs 0 with header line,
RETURN like BAPIRET2 occurs 0.
Data: obj_typ like BAPIACHE09-OBJ_TYPE,
OBJ_KEY like BAPIACHE09-OBJ_KEY,
OBJ_SYS like BAPIACHE09-OBJ_SYS.
Data: gv_belnr type belnr_d.
Data:file_Na type String.
Data: lsys like TBDLS-LOGSYS.
*START OF SELECTION
START-OF-SELECTION.
*CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '19'
object = 'RF_BELEG' "'FIAA-BELNR'
QUANTITY = '1'
SUBOBJECT = '7777'
TOYEAR = '2007'
IGNORE_BUFFER = ' '
IMPORTING
NUMBER = gv_belnr
QUANTITY =
RETURNCODE =
*CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
OWN_LOGICAL_SYSTEM = lsys
EXCEPTIONS
OWN_LOGICAL_SYSTEM_NOT_DEFINED = 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.
*ENDIF.
*concatenate gv_belnr '7777' '2007' into v_objkey.
*Filling Document Header Details
*Docheader-OBJ_TYPE = 'BEBD'.
*Docheader-OBJ_key = V_objkey.
*Docheader-OBJ_SYS = lsys.
*docheader-BUS_ACT = 'RFBU'.
Docheader-USERNAME = sy-uname.
Docheader-COMP_CODE = '7777'.
Docheader-DOC_DATE = '20070725'.
Docheader-PSTNG_DATE = '20070725'.
Docheader-FISC_YEAR = '2007'.
*DOCHEADER-OBJ_KEY_R = 'X'.
Docheader-DOC_TYPE = 'KR'.
*Item data for ACCOUNTGL
ACCOUNTGL-ITEMNO_ACC = '0000000001'.
ACCOUNTGL-GL_ACCOUNT = '0000000102'. "99900
ACCOUNTGL-DOC_TYPE = 'KR'.
ACCOUNTGL-COMP_CODE = '7777'.
ACCOUNTGL-FISC_YEAR = '2007'.
ACCOUNTGL-PSTNG_DATE = '20070725'.
ACCOUNTGL-DE_CRE_IND = 'S'.
append ACCOUNTGL.
ACCOUNTGL-ITEMNO_ACC = '0000000002'.
ACCOUNTGL-GL_ACCOUNT = '0000400002'. "99900
ACCOUNTGL-DOC_TYPE = 'KR'.
ACCOUNTGL-COMP_CODE = '7777'.
ACCOUNTGL-FISC_YEAR = '2007'.
ACCOUNTGL-PSTNG_DATE = '20070725'.
ACCOUNTGL-DE_CRE_IND = 'H'.
append ACCOUNTGL.
*Account payable
ACCOUNTPAYABLE-ITEMNO_ACC = '0000000001'.
ACCOUNTPAYABLE-GL_ACCOUNT = '0000000102'.
ACCOUNTPAYABLE-COMP_CODE = '7777'.
append ACCOUNTPAYABLE.
ACCOUNTPAYABLE-ITEMNO_ACC = '0000000002'.
ACCOUNTPAYABLE-GL_ACCOUNT = '0000400002'.
ACCOUNTPAYABLE-COMP_CODE = '7777'.
append ACCOUNTPAYABLE.
*Currency Amount
CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.
CURRENCYAMOUNT-CURRENCY_ISO = 'INR'.
MOVE 1000 TO CURRENCYAMOUNT-AMT_DOCCUR.
Append CURRENCYAMOUNT.
CURRENCYAMOUNT-ITEMNO_ACC = '0000000002'.
CURRENCYAMOUNT-CURRENCY_ISO = 'INR'.
MOVE '1000-' to CURRENCYAMOUNT-AMT_DOCCUR.
Append CURRENCYAMOUNT.
clear CURRENCYAMOUNT.
clear ACCOUNTGL.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = Docheader
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE = obj_typ
OBJ_KEY = obj_key
OBJ_SYS = obj_sys
tables
ACCOUNTGL = ACCOUNTGL
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = ACCOUNTPAYABLE
ACCOUNTTAX =
currencyamount = CURRENCYAMOUNT
CRITERIA =
VALUEFIELD =
EXTENSION1 =
return = return.
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = ' '.
endif.
if sy-subrc = 0.
WRITE: / OBJ_KEY,
OBJ_TYP,
OBJ_SYS.
endif. -
BAPI or Batch Input Program for FB01
Hi all!
I am trying to post invoice through transaction code FB01, i need a standard BAPI program or Batch Input Program for FB01 (except recording).
thanks.Hello,
In the 'Specify Files' step,
1. give some short file name (about 20 Characters )
2. In the File option for 'Converted Data' option check the Logical path / logical file entries. Normally it is LSMW ( Logical Path ) and the same File name for logical file. If you do not have a Logical path 'LSMW' create one in Tx. FILE'.
3. Please note that you need authority to save the file on application server ( You can see the files on Appl. Server in Tx. AL11 ).
Let me know how it goes on!
Regds, Murugesh AS
Message was edited by: Murugesh Arcot
Message was edited by: Murugesh Arcot -
Bapi error for fb01 transaction
hai friends
iam using *bapi_acc_document_post *
for posting amount inplace fb01 .
this bapi is called in module program .
is it write bapi for this
or
else can i use any other bapi for this
if it right bapi
how can pass the parameeters to this
what are the maditary fields in this bapi
hoe can i pass this values to this bapi.
pls tell me friends
thanks
with regards
srikanth vipparlahai friend
its ok
but iam not fiending the documentation for this function module
so pls helpme the maditari parameters in this function module .
and iam using 4.6b .
or just post me the documentation pls .
thanks
ssrikanth vipparla -
Hi,
I am using bapi BAPI_ACC_DOCUMENT_POST.. for FB01 but i am not getting Two fields
PstKy (Posting Key for the Next Line Item) and SGL Ind (Special G/L Indicator for the Next Line Item)
is any other bapi avilabel for this...
or please give me sample bapi for FB01 or BAPI_ACC_DOCUMENT_POST.
<removed by moderator>
Thanks.
Edited by: Mike Pokraka on Aug 4, 2008 2:40 PMHi
The posting keys are setted by the BAPI in according to the item type (customer, vendor and G/L) and the sign of amount.
The BAPI usually uses the standard posting key: 01/11; 40/50, 21/31.
If it needs a different posting keys it needs to assign them to a certain operation key (field KOTSL): u can do it in the table T030B.
Anyway u should consider u can use the BTE RWBAPI01 in order to set own data into FI interfaces.
Max
Edited by: max bianchi on Jun 20, 2008 11:16 AM -
Hi,
which is BAPI for FB01 which will help me to update following fields. like
1) Doc Date
2) Doc Type
3) company Code
4)Currency Key
5)Referen
6)Posting Key
7) G/L account
8) Speical G/L indicatior
9)Profit Center
10)Sales Doc. with sample code.
thanks.Hi,
it may help u.
BAPI for FB01
Thanks,
Sree.
Maybe you are looking for
-
I wanted to install my creative cloud in order to access indesign. Although when I click download, it tells me to update the programme. So I do. And then it starts loading, but ends shortly after, telling me to check my internetconnection. The connec
-
macbook pro - iPhoto keep prompting to update after Yosemite update. Error message when trying to update -This update is not available for this Apple ID either because it was bought by a different user or the item was refunded or cancelled.
-
Illustrator objects missing when placed in InDesign
I created an Illustrator file that has text converted to outlines. Some of it is white and some of it is other colors. When I save the file as eps, pdf or export as jpg and then place the files in InDesign, the white outlined text doesn't show up. Ad
-
Hi, I can see that it is the internal webtools OrderID that is displayed to the customer during confirmation and within order history. I have added the SynchID as well as the OrderID in order history to at least provide some point of reference. To av
-
Error updating User Table (ODBC - 2035)
Hello all. Im having a problem when I try to update an user table @tbldoc and @tbldetail. "This entry already exist in the following tables 'table' (@tbldoc)" First time I have this issue was using my UI addon, my form is auto managed... then I try t