Question on BAPI_ACC_DOCUMENT_POST
Hi
What should be passed for the OBJ_TYPE in DOCUMENTHEADER (one of the Import Parameters) when you call the BAPI - BAPI_ACC_DOCUMENT_POST.
I tried BKPFF, RFBU.. both did not work..
Thanks
Geetha
Hi Geeta,
from my experience those three fields should be blank.when the bapi is executed successfully those fields will get populated.
the error message u r getting is because of some other mistake.u may not be passing the field properly.
thanks and regards
Arjun
Similar Messages
-
Hi all:
I've got a problem when I use bapi BAPI_ACC_DOCUMENT_POST.
The vendor accounts with general leader accounts associated are implemented in the position of table ACCOUNTPAYABLE and the general leader accounts go to table GLACCOUNT.
Refering to positions with vendor number I introduce the Special G/L Indicator and after this i execute bapi.
It is said I have to put the TAX_CODE in tabla TAXACCOUNT and the field AMT_BASE in table CURRENCYAMOUNT.
But when I use transaction FB01 to cread fi documents in vendor positions I don't
have obligation to introduce the TAX_CODE and afterwards I look for the document in table bseg. I can watch the field MWSKZ is blank.
Another question : I think I can find the amt_base in currency amount with the function: CALCULATE_TAX_FROM_NET_AMOUNT
Thanks a lot. Points in advance.I've resolved the question.
It depends of the special gl indicator. If it is 8 or H it doesn't need to be introduced the table taxaccount. -
BAPI_ACC_DOCUMENT_POST Question
Currently as part of the standard SAP delivery, this BAPI accepts Material Number in the line item (Table ACCOUNTGL). However when I try to post to a revenue account, our configuration requires that the profitability segment contain both Material Number AND Country Code. I've never extended a BAPI, but I am sure I can do enough research to find out how to do that on my own.
The question is, If I extend this BAPI to accept country code will it be smart enough to pass Country in the profitability segment for revenue accounts?Hi Geeta,
from my experience those three fields should be blank.when the bapi is executed successfully those fields will get populated.
the error message u r getting is because of some other mistake.u may not be passing the field properly.
thanks and regards
Arjun -
How to send Sales Document Number and Item to BAPI_ACC_DOCUMENT_POST?
Hello SAPients,
We are using BAPI_ACC_DOCUMENT_POST to create an accounting document similar to what FB01 does, in FB01 you can type the number and position of a Sales Document even if you are using an Account Receivable account number. But in the BAPI, the ACCOUNTRECEIVABLE table doesn't have a field to include those numbers. How should I pass the sales order number and item to the BAPI? I have tried several things but every time I receive more complicated error messages.
Thank you in advance for your kind help.Let me know if you have any questions:
Loop through your records and fill in the appropriate structure based on record type (GL, Vendor or Customer)
IF NOT pcard_post_rec-zlsapac IS INITIAL.
gt_gl_item-itemno_acc = ls_posnr.
gt_gl_item-gl_account = pcard_post_rec-zlsapac.
gt_gl_item-comp_code = pcard_post_rec-zlsapco.
"gt_gl_item-pstng_date = pcard_post_rec-zlgpsdt.
gt_gl_item-pstng_date = gv_posting_date.
gt_gl_item-doc_type = doctype.
gt_gl_item-alloc_nmbr = ls_assignment.
gt_gl_item-ref_key_3 = pcard_post_rec-zlgvend.
IF pcard_post_rec-zlsapac < 500000.
gt_gl_item-item_text = ''.
ELSE.
gt_gl_item-item_text = pcard_post_rec-zlguser.
ENDIF.
gt_gl_item-costcenter = pcard_post_rec-zlsapcc.
gt_gl_item-orderid = lv_ordnum.
APPEND gt_gl_item.
ELSEIF NOT pcard_post_rec-zlsapven IS INITIAL.
gt_ap_item-itemno_acc = ls_posnr.
gt_ap_item-vendor_no = pcard_post_rec-zlsapven.
gt_ap_item-comp_code = pcard_post_rec-zlsapco.
gt_ap_item-alloc_nmbr = ls_assignment.
gt_ap_item-ref_key_3 = pcard_post_rec-zlgvend.
IF pcard_post_rec-zlsapac < 500000.
gt_ap_item-item_text = ''.
ELSE.
gt_ap_item-item_text = pcard_post_rec-zlguser.
ENDIF.
APPEND gt_ap_item.
ELSEIF NOT pcard_post_rec-zlsapcus IS INITIAL.
gt_ar_item-itemno_acc = ls_posnr.
gt_ar_item-customer = pcard_post_rec-zlsapcus.
gt_ar_item-comp_code = pcard_post_rec-zlsapco.
gt_ar_item-alloc_nmbr = ls_assignment.
gt_ar_item-ref_key_3 = pcard_post_rec-zlgvend.
IF pcard_post_rec-zlsapac < 500000.
gt_ar_item-item_text = ''.
ELSE.
gt_ar_item-item_text = pcard_post_rec-zlguser.
ENDIF.
APPEND gt_ar_item.
ENDIF. -
How to populate COPA fields for GL posting using BAPI_ACC_DOCUMENT_POST
Hi All,
I am posting documents in FB50 using BAPI_ACC_DOCUMENT_POST. I have a requirement to post the documents with profitability segment parameters as well. Should I use EXTENSION1 table to pass COPA updates and implement BTE to achieve it? Can anyone please guide me with the procedure to populate the COPA fields for GL posting using BAPI_ACC_DOCUMENT_POST?
Also please let me know how/where to check if COPA is enabled for a GL account.
Thanks,
SubathraModerator Message: This forum is for questions directly related to Web Dynpro ABAP only. It should not be used for general questions. I am moving this thread to the ABAP General forum.
-
How to Use 'BAPI_ACC_DOCUMENT_POST' in an Inbound IDOC?
Hi,
One of the standard IDOC for posting accounts is Message type(ACC_DOCUMENT), and an FM IDOC_INPUT_ACC_DOCUMENT "NOT released' uses same
functionality to achieve.
I created a custom one as standard one is not released yet, My question is how to handle records if number of records in flat file coming from legacy contains more data.
Example. If number of records exceeds 999.
Thanks and Regards
MohinderHi,
BAPI_ACC_DOCUMENT_POST can post 999 line items only.
More than 999 records:
If the count is 999 don't take the flat file values, take a dummy GL account and assign it as 999 record.
the amount should be balance amount of 998 records, it may credit or debit.
Regards,
Sri -
BAPI_ACC_DOCUMENT_POST - How to generate tax items
Hi,
I am trying to implement the posting of accounting documents via BAPI_ACC_DOCUMENT_POST, and struggling to get the tax postings to work properly.
The process requires me to produce the same outcome as a user manually posting the document via FB01 where tax items are automatically generated. So I need to confirm how to calculate and post the tax items.
I need more information on how to retrieve the data to pass to the ACCOUNTTAX parameter of the bapi and the mapping of the data to the ACCOUNTAX fields. And also the corresponding CURRENCYAMOUNT parameter, I am interested to know if I have to populate the base amount fields as well as the document amount field.Murray,
I have solved your problem in your other question.
Please, try to ask question only in one forum. For this type of question, the ABAP forum is the right one. This is becuase ABAP coding is involved.
See: BAPI_ACC_DOCUMENT_POST How to fill ACCOUNTTAX
Best regards, Johan -
Post document with BAPI_ACC_DOCUMENT_POST with withholding taxes
Hi everyone!
I have to post some documents that I got from an Excel file. At first, they were G/L documents, so I only filled the table parameter ACCOUNTL of BAPI_ACC_DOCUMENT_POST to set the "account data" (without using ACCOUNTRECEIVABLE, ACCOUNTPAYABLE, ACCOUNTTAX or ACCOUNTWT).
After a few, another Posting Keys were allowed in the lines of the documents obtained from the excel file, so the documents can be G/L documents, receipts, etc.But, I still put every account data in ACCOUNTGL, and the created documents were right (at least nobody complained about them :P ).
No, 3 fields have been added in the excel file:
- QSSHB: Withholding Tax Base Amount
- QSFBT: Withholding Tax-Exempt Amount (in Document Currency)
- QSSKZ: Withholding Tax Code
As I understood, this BAPI is ready to allow withholding taxes, and I suppose I should have to fill this fields that I receive into some tables that are used as parameters in the BAPI. For example,
ACCOUNTWT-WT_CODE = Withholding Tax Code
ACCOUNTWT-BAS_AMT_LC = Withholding Tax Base Amount (Local Currency)
I think I should use this table (I don't know where I could "put" the other one). My question is, can I do that without using tables ACCOUNTRECEIVABLE and ACCOUNTPAYABLE? My feeling is that is not completely right not to use these tables if the documents are vendor or customer documents... If that's possible.. is it right to put the 2 fields that I have used in the last example (*) to fill that? Where I should put the third field??
I hope I have explained myself clearly, thanks in advance,
VictorDear Sreeraj,
The situations would be multiple, but to be precise I'll provide you one scenario where this BAPI would be failing to do the posting. The scenario is like this:
1. If you consider GL posting using F-02 by changing any of the reference fields XREF1, or XREF2, the BAPI has to consider the varying screens of each of the line items which internally depends on Transaction Variants of different screens of the Document, which the BAPI will fail to do so.
2. Also, if there is a Taxation to be done for each Item, still it should consider the above scenario and fill the WITH tables accordingly.
Hope this helps,
Regards,
-Wahid Hussain. -
I wrote a program code to post a document for F-43 transaction using a BAPI.
Unfortunately, the BAPI comes back with an error message
1 E RW 609 Error in document: BKPF 1900022387208 2010 SYS01 1900022387208 2010
2 E RW 628 Incorrect entry in field OBJ_TYPE: BKPF DOCUMENTHEADER 1 OBJ_TYPE
Any help would be appreciated.
REPORT z_test_f44 NO STANDARD PAGE HEADING LINE-COUNT 65 LINE-SIZE 132
MESSAGE-ID zfi.
TABLES: bsik, t003.
TYPES:
BEGIN OF tp_tab_bsik,
bukrs TYPE bukrs,
lifnr TYPE lifnr,
gjahr TYPE gjahr,
budat TYPE budat,
bldat TYPE bldat,
blart TYPE blart,
bschl TYPE bschl,
END OF tp_tab_bsik.
SELECTION-SCREEN:BEGIN OF BLOCK blck01 WITH FRAME TITLE text-001.
PARAMETERS:
p_per(2) TYPE c DEFAULT sy-datum+4(2),
p_dt LIKE sy-datum DEFAULT sy-datum,
p_hkont TYPE hkont DEFAULT '105010',
p_waers LIKE bkpf-waers DEFAULT 'USD',
p_blart LIKE bkpf-blart DEFAULT 'KR',
p_xblnr LIKE bkpf-xblnr DEFAULT 'V01',
p_xblnr1 LIKE bkpf-xblnr DEFAULT 'A01',
p_amt LIKE bseg-wrbtr DEFAULT '10.00',
p_bukrs LIKE bkpf-bukrs DEFAULT '208',
p_lifnr LIKE lfa1-lifnr DEFAULT '1000165'.
SELECTION-SCREEN:END OF BLOCK blck01.
*----------------end of selection parameters-----------------------*
*------------------START OF SELECTION----------------------------------*
START-OF-SELECTION.
PERFORM process_data. "Posting using F-44(Bapi)
*& Form process_data
* text
FORM process_data.
DATA:
l_documentheader LIKE bapiache09,
l_accountgl LIKE bapiacgl09 OCCURS 2 WITH HEADER LINE,
l_vendoritem LIKE bapiacap09 OCCURS 2 WITH HEADER LINE,
l_currencyamount LIKE bapiaccr09 OCCURS 2 WITH HEADER LINE,
l_currencytype LIKE bapiaccr09-currency_iso,
l_return LIKE bapiret2 OCCURS 5 WITH HEADER LINE,
l_obj_type LIKE bapiache02-obj_type,
l_obj_key LIKE bapiache02-obj_key,
l_obj_sys LIKE bapiache02-obj_sys,
l_obj_sys_1 LIKE tbdls-logsys,
ls_t003 TYPE t003,
l_belnr TYPE bkpf-belnr,
l_awtyp LIKE acchd-awtyp, " Anwendungsreferenz
l_awref LIKE acchd-awref, "
l_aworg LIKE acchd-aworg, "
l_awsys LIKE acchd-awsys, "
l_awkey LIKE bkpf-awkey. "
BREAK-POINT.
CLEAR:
l_documentheader, l_vendoritem, l_accountgl,
l_currencyamount, l_return.
REFRESH:l_vendoritem, l_currencyamount, l_return.
* Get Your Logical System
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = l_obj_sys_1
EXCEPTIONS
own_logical_system_not_defined = 1
OTHERS = 2.
* Number Range Information
SELECT SINGLE *
FROM t003
INTO CORRESPONDING FIELDS OF t003
WHERE blart = p_blart.
* Get the additional Number Range Details.
CALL FUNCTION 'FAGL_GET_NUMBER_RANGE_FOR_PN'
EXPORTING
i_rldnr = '0L' "Ledger
i_blart = p_blart
IMPORTING
es_t003 = ls_t003
EXCEPTIONS
error_message = 1.
* Get the next BELNR
t003-numkr = ls_t003-numkr.
CALL FUNCTION 'RF_GET_DOCUMENT_NUMBER'
EXPORTING
company = p_bukrs
range = t003-numkr
year = sy-datum+0(4)
IMPORTING
document_number = l_belnr.
* Create Reference Keys
CALL FUNCTION 'FI_REFERENCE_CREATE'
EXPORTING
i_awtyp = 'BKPF '
i_bukrs = p_bukrs
i_gjahr = sy-datum+0(4)
i_belnr = l_belnr
IMPORTING
e_awtyp = l_awtyp
e_awref = l_awref
e_aworg = l_aworg
e_awkey = l_awkey
e_awsys = l_awsys
EXCEPTIONS
object_type = 1
missing_parameter = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Build Document Header
l_documentheader-obj_type = l_awtyp. "'BKPF'.
l_documentheader-obj_key = l_awkey.
l_documentheader-obj_sys = l_obj_sys_1.
l_documentheader-bus_act = 'RFBU'.
l_documentheader-ac_doc_no = l_belnr.
l_documentheader-username = sy-uname.
l_documentheader-comp_code = p_bukrs.
l_documentheader-fis_period = p_per.
l_documentheader-doc_date = p_dt.
l_documentheader-pstng_date = sy-datum.
l_documentheader-fisc_year = sy-datum+0(4).
l_documentheader-doc_type = p_blart.
l_documentheader-ref_doc_no = p_xblnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_hkont
IMPORTING
output = p_hkont.
* G/L Item
l_accountgl-itemno_acc = '000000001'.
* l_accountgl-acct_key = 'RFBU'.
l_accountgl-gl_account = p_hkont.
l_accountgl-comp_code = p_bukrs.
l_accountgl-pstng_date = sy-datum.
l_accountgl-doc_type = p_blart.
APPEND l_accountgl. CLEAR l_accountgl.
* G/L Item $$$s
* Posting Key 50
l_currencyamount-itemno_acc = '000000001'.
l_currencyamount-currency_iso = p_waers.
l_currencyamount-currency = p_waers.
l_currencyamount-amt_doccur = p_amt.
APPEND l_currencyamount. CLEAR l_currencyamount.
* Vendor Item
l_vendoritem-itemno_acc = '000000002'.
* l_accountgl-acct_key = 'RFBU'.
l_vendoritem-vendor_no = p_lifnr.
l_vendoritem-comp_code = p_bukrs.
APPEND l_vendoritem. CLEAR l_vendoritem.
* Vendor Item $$$s
* Posting Key 31
l_currencyamount-itemno_acc = '000000002'.
l_currencyamount-currency_iso = p_waers.
l_currencyamount-currency = p_waers.
l_currencyamount-amt_doccur = p_amt.
l_currencyamount-amt_doccur = l_currencyamount-amt_doccur * -1.
APPEND l_currencyamount. CLEAR l_currencyamount.
BREAK-POINT.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = l_documentheader
TABLES
accountgl = l_accountgl
accountpayable = l_vendoritem
currencyamount = l_currencyamount
return = l_return.
* CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
* EXPORTING
* documentheader = l_documentheader
* IMPORTING
* obj_key = l_obj_key
* TABLES
* accountgl = l_accountgl
* accountpayable = l_vendoritem
* currencyamount = l_currencyamount
* return = l_return.
BREAK-POINT.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDFORM. "process_dataActually I am using Standard SAP Function modules to generate the OBJ_TYP.
Unfortunately the "Code" tag is not working for me in this browser to align the program code correctly.
But yes, to answer your question obj_typ is correctly done.
* Create Reference Keys
call function 'FI_REFERENCE_CREATE'
exporting
i_awtyp = 'BKPF '
i_bukrs = p_bukrs
i_gjahr = sy-datum+0(4)
i_belnr = l_belnr
importing
e_awtyp = l_awtyp
e_awref = l_awref
e_aworg = l_aworg
e_awkey = l_awkey
e_awsys = l_awsys
exceptions
object_type = 1
missing_parameter = 2
others = 3. -
Hi gurus,
I am posting this problem of mine for the third time, but I have got any reply to my previous postings, I don't know wheter the my problem is too difficult or its not an appropriate one to ask. Can someone pleaase reply this time to my problem so that I can proceed into my development, I will really appreciate your efforts.
I am working on an interface where I need to post an accounting document using
f-43 and for this I have identified this bapi 'BAPI_ACC_DOCUMENT_POST', and I have written the following code. everything is working properly but the only problem is, the posting keys I am using are 31 and 40 but when I run my program and look into the document created, it shows me the posting keys as 40 and 50 instead of 31 and 40, can you please tell me how to get rid of this thing .
v_semfile = p_ifname.
refresh it_input_file.
call function 'WS_UPLOAD'
EXPORTING
filename = v_semfile
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.
move:
'RFBU' to documentheader-bus_act,
it_input-doc_date2 to documentheader-doc_date,
it_input-pos_date2 to documentheader-pstng_date,
it_inputdoc_type to documentheader-doc_type,
it_inputbukrs to documentheader-comp_code,
it_input-pos_per to documentheader-fis_period,
it_input-fis_year to documentheader-fisc_year,
it_input-reference to documentheader-ref_doc_no,
it_input-h_text to documentheader-header_txt,
syst-uname to documentheader-username.
if it_input_file-pos_key eq 31.
move:
v_count to glaccount-ITEMNO_ACC,
it_input-glaccount to glaccount-gl_account,
it_input-kostl to glaccount-COSTCENTER,
it_input-prctr to glaccount-PROFIT_CTR,
it_input-bus_area to glaccount-bus_area,
it_input-item_text to glaccount-ITEM_TEXT,
it_input-assignment to glaccount-ALLOC_NMBR.
append glaccount.
move:
v_count to currencyamount-ITEMNO_ACC,
it_input-currency to currencyamount-CURRENCY,
it_input-amount to currencyamount-AMT_DOCCUR .
append currencyamount.
clear: glaccount, currencyamount.
else.
move: v_count to glaccount-ITEMNO_ACC,
it_input-glaccount to glaccount-gl_account,
it_input-kostl to glaccount-COSTCENTER,
it_input-prctr to glaccount-PROFIT_CTR,
it_input-bus_area to glaccount-bus_area,
it_input-item_text to glaccount-ITEM_TEXT,
it_input-assignment to glaccount-ALLOC_NMBR.
append glaccount.
move:
v_count to currencyamount-ITEMNO_ACC,
it_input-currency to currencyamount-CURRENCY.
currencyamount-AMT_DOCCUR = it_input-amount * -1.
append currencyamount.
clear: glaccount, currencyamount.
endif.
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.
read table return with key type = 'S'.
if syst-subrc eq 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = return2.
Thanks
Rajeev....Rajeev,
for the vendor line you have to add a vendor number and not a G/L account number (SAP will know the G/L behind the vendor and will take care about that). If posting key 31 was specified that is a vendor posting and you need a vendor number for that, so you should go back to functional guys and ask them what kind of posting they want in fact.
Some info about posting keys:
01-09 and 11-19 : customer
21-29 and 31-39 : vendor
40 and 50 : G/L
Come back if you still have questions!
ec -
F-48, Special GL Indicator, and BAPI_ACC_DOCUMENT_POST
In a thread a few days ago over in the ABAP General forum, Eric Cartman indicated that it might be possible to use BAPI_ACC_DOCUMENT_POST to do an F-48.
I met with the functionals today and we took an F-48 recording to see how their input field requirements line up with this BAPI.
Everything looks "vanilla" except for the Special GL Indicator - they made this "N" in the recording.
But when I looked for Special GL Indicator in the BAPI structures, I didn't see a place for it.
So, two questions:
a) did I "miss" Special GL Indicator in the BAPI structures - is there actually a place to put it?
b) if not, is this a "gotcha" - does it mean that you can't use the BAPI for the kind of F-48 they want to do?
Any help would be appreciated.
Thanks
djhhi David,
I am afraid you overlooked...
BAPI Tables parameters:
ACCOUNTRECEIVABLE ==> structure BAPIACAR09
ACCOUNTPAYABLE ==> structure BAPIACAP09 (F-48 is for vendors, so you need this one)
in both cases the field for special G/L is SP_GL_IND (somewhere at the end)
hope this helps
ec -
BAPI_ACC_DOCUMENT_POST used to post as in F-22
Hi all,
I am trying to use BAPI , BAPI_ACC_DOCUMENT_POST to simulate posting via F-22 . Is it possible?
If yes, where can i specify transaction name F-22 ? Please let me know.
Thanks in advance!
Regards,
KumailMurray,
I have solved your problem in your other question.
Please, try to ask question only in one forum. For this type of question, the ABAP forum is the right one. This is becuase ABAP coding is involved.
See: BAPI_ACC_DOCUMENT_POST How to fill ACCOUNTTAX
Best regards, Johan -
BAPI_ACC_DOCUMENT_POST & generated document number
Hi,
I am using BAPI function BAPI_ACC_DOCUMENT_POST to post financial documents in the system. My question is, how properly retrieve generated document number (BKPF-BELNR). We are using internal document number generation so the function generates document number. But, function itself, does not return generated document number. Currently, after commit I try to locate a record of generated document using reference key ... Isn't there any better way how to get generated document number?
Tkank you.Yes, I found this code ... as I wrote, there is not problem if I set curtp = '10'. BUT, there is another problem, with different currencies. Then, when I try to post document in different currency that the currency of company code is, function raises error "Inconsistent currency information" ...
here is an example, how I fill tax information, as requested:
DATA: docHeader TYPE BAPIACHE09,
accGL LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
accReceivable LIKE BAPIACAR09 OCCURS 0 WITH HEADER LINE,
accAmnt LIKE BAPIACCR09 OCCURS 0 WITH HEADER LINE,
accTax LIKE BAPIACTX09 OCCURS 0 WITH HEADER LINE,
extension LIKE BAPIACEXTC OCCURS 0 WITH HEADER LINE,
tax_account TYPE STRING,
tax_code TYPE STRING,
tax_trans TYPE STRING,
tax_spec LIKE ZIFPRMS-VALUE,
itemno TYPE N LENGTH 10.
* initialize document header
docHeader-bus_act = 'RFBU'.
docHeader-username = sy-uname.
docHeader-header_txt = fin_data-text.
docHeader-comp_code = header-company_code.
docHeader-doc_date = header-document_date.
docHeader-pstng_date = fin_data-posting_date.
docHeader-ref_doc_no = header-id_sale.
docHeader-doc_type = params-doc_type.
* process document items, in loop
LOOP AT fin_items INTO fin_item.
* initialize AR (line 1)
accReceivable-itemno_acc = itemno.
accReceivable-customer = cus_data-id_contact.
accReceivable-comp_code = header-company_code.
CONCATENATE fin_item-text ' (receivable)' INTO accReceivable-item_text.
accReceivable-pmnttrms = params-payment_term.
accReceivable-pmnt_block = params-payment_block.
IF doc_type = 'APR'.
accReceivable-sp_gl_ind = 'F'.
ENDIF.
APPEND accReceivable.
* initialize receivable amount
accAmnt-itemno_acc = itemno.
accAmnt-currency = fin_data-currency.
accAmnt-curr_type = '10'.
accAmnt-amt_doccur = fin_item-vat_base + fin_item-vat.
IF doc_type(2) = 'CR'.
accAmnt-amt_doccur = accAmnt-amt_doccur * ( -1 ).
ENDIF.
APPEND accAmnt.
itemno = itemno + 1.
* do not continue when posting a down payment request
CHECK doc_type < > 'APR'.
* initialize GL account line item
accGL-itemno_acc = itemno.
accGL-gl_account = params-doc_gl_account.
CONCATENATE fin_item-text ' (revenue)' INTO accGL-item_text.
accGL-pstng_date = fin_data-posting_date.
accGL-tax_code = tax_code.
accGL-doc_type = params-doc_type.
accGL-costcenter = fin_item-cost_centre.
APPEND accGL.
* initialize GL amount
accAmnt-itemno_acc = itemno.
accAmnt-currency = fin_data-currency.
accAmnt-curr_type = '10'.
accAmnt-amt_doccur = - ( fin_item-vat_base ).
IF doc_type(2) = 'CR'.
accAmnt-amt_doccur = accAmnt-amt_doccur * ( -1 ).
ENDIF.
APPEND accAmnt.
itemno = itemno + 1.
* initialize TAX account line item
IF STRLEN( tax_code ) > 0.
accTax-itemno_acc = itemno.
accTax-gl_account = tax_account.
accTax-tax_code = tax_code.
accTax-cond_key = 'MWAS'.
APPEND accTax.
* initialize tax amount
accAmnt-itemno_acc = itemno.
accAmnt-currency = fin_data-currency.
accAmnt-curr_type = '10'.
accAmnt-amt_doccur = - ( fin_item-vat ).
accAmnt-amt_base = - ( fin_item-vat_base ).
IF doc_type(2) = 'CR'.
accAmnt-amt_doccur = accAmnt-amt_doccur * ( -1 ).
accAmnt-amt_base = accAmnt-amt_base * ( -1 ).
ENDIF.
APPEND accAmnt.
itemno = itemno + 1.
ENDIF.
ENDLOOP.
* translate customer field to BAPI format
CALL FUNCTION 'MAP2E_BAPICOBL_CI_TO_BAPIEXTC'
TABLES INTERNAL_CI_COBL = cust_ext
EXTENSION_CODINGBLOCK = extension.
* call BAPI function to create customer invoice
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING DOCUMENTHEADER = docHeader
IMPORTING OBJ_TYPE = obj_type
OBJ_KEY = obj_key
OBJ_SYS = obj_sys
TABLES ACCOUNTGL = accGL
ACCOUNTRECEIVABLE = accReceivable
ACCOUNTTAX = accTax
CURRENCYAMOUNT = accAmnt
EXTENSION1 = extension
RETURN = returnTab.
Edited by: Rastislav Mojzis on Jul 9, 2008 7:18 AM -
Help with fm BAPI_ACC_DOCUMENT_POST
Hello!
Would like to request for some help with BAPI's, since it is my first time to use them. The programming requirement is to create an uploading utility to post the beginning balances of vendor and customer. I was recommended to use the fm BAPI_ACC_DOCUMENT_POST since it's easier than coding it in batch input, but I'm not quite sure which goes where. My questions are:
1. If the posting requires credit vendor/debit clearing account, would this mean the vendor item will be in the ACCOUNTPAYABLE/BAPIACAP09 table and the GL clearing account in the ACCOUNTGL/BAPIACGL09 table?
2. All amounts are placed in the CURRENCYAMOUNT/BAPIACCR09 table?
3. The fm automatically determines the posting key to be used?
Thank you in advance for any replies. Sample codes would also be greatly appreciated.Hi,
Check this link: https://forums.sdn.sap.com/click.jspa?searchID=850430&messageID=493291
There is one more BAPI_ACC_DOCUMENT_CHECK, this will check if the parameter values which enter is feasible to create a document or not.
First use this FM and if sy-subrc = 0, then you can call the BAPI_ACC_DOCUMENT_POST and also call BAPI_TRANSACTION_COMMIT to save the changes.
Refer to the Function Module Documentation [ a push button on the toolbar ] for more detailed information.
Regards
Subramanian -
How to get the tax spliting functionality using BAPI_ACC_DOCUMENT_POST
Hi Experts,
In FB01 tcode when we post the invoice separate tax line item is getting created automatically.
But we are posting invoice with BAPI_ACC_DOCUMENT_POST here it is not happening.
Before posting this question here found a thread https://scn.sap.com/docs/DOC-43262.
Here from the thread info we implemented the BADI and enabled the tax calc flag and implemented the exit.
Still the separate tax line item is not getting created.
Can any one please clarify how we can acheive that functionality.
Thanks in advance.
kind regards,
ShivaHello Shivram,
Your requirement is post FI document with tax line item's automatically with using above BAPI ( FI Posting) ! Suppose you want to post vendor invoice as mentioned below.
Expenses account.......Dr.....100
Input tax account.........Dr.......10
To Vendor account..............Cr....110
Your upload format should be as mentioned below to post above document in SAP.
Item No
Company code
Pos.date
Doc.date
Currency
Ref
Header text
PK
Account
Amount
Tax code
Assignment
Text
00001
1234
28.05.2014
28.05.2014
USD
TEST
TEST
40
E1234
5600
XA
TST
TEST
00002
1234
28.05.2014
28.05.2014
USD
TEST
TEST
31
1001
6160
Tax code line item of above '00001 pass in to Calculate tax BAPI which was mentioned above with all required fileds & you can get one retrun table over there > those line items ,you have to pass as additional line item in FI document. ( Through coding). Check with technical consultant.
Read note : 1873588 - Filling tax information for BAPIs
626235 - Tax postings with accounting BAPIs
Above notes only information purpose
Regards
Mani Kumar
Maybe you are looking for
-
Problem with backing file in weblogic portal
Hi friends, Hope all are good. How to call the backing file methods,before begin method of jpf portlet of weblogic. Thanks, Ramanuja kolla.
-
Changing web server refresh to less than one second
I just set up another PC on our network to display our engine test VI. Is there any way to increase the refresh rate to less than one second. I tried entering .5 sec on the config screen, but it changed back to one second. I'm using LabVIEW 8.5.1.
-
Can I use a compaq drv hd 4.3 gb in a 4/8 channel H.264 DVR system?
Can I use a compaq drv hd, 4.3 GB in a 4/8 channel H.264 DVR system ? Instead of a sata HDD 2T?
-
I have an Ipad2. I have updated both the OS and software for numbers to the latest versions. Many of the issues with numbers have been fixed finally since the OS upgrade. However now my forms will not let me input duration times. It keeps chan
-
Definition Flash.util could not be found
Refers to line: import flash.util.*; also get error: Access of possibly undefined property call through areference with static type mx.rpc.events:ResultEvent in reference to: model.loginVO = LoginVO( event.call.loginVO Thanks for any help