2015 Mar 03 3:15 PM
Hi Gurus!
I’m trying to use BAPI_ACC_DOCUMENT_POST to post Vendor invoices (document type KR) and vendor credit memos (document type KG).
I’m passing the following parameters to the bapi for KG postings:
HEADER
BUS_ACT: RFBU
USRNAME: XXXXXXX
COMP_CODE: 1012
DOC_DATE: 31.12.2014
PSTNG_DATE: 31.12.2014
FISC_YEAR: 2014
FISC_PERIOD: 12
DOC_TYPE: KG
REF_DOC_NO: TEST
ACCOUNTGL
ITEMNO_ACC: 0000000002
GL_ACCOUNT: 4240000000
ACCT_TYPE: A
DOC_TYPE: KG
COMP_CODE: 1012
FIS_PERIOD: 12
FISC_YEAR: 2014
PSTNG_DATE: 31.12.2014
ASSET_NO: 1000006421
SUB_NUMBER
CS_TRANS_T:105
RES_DOC: 1751403327
RES_ITEM:001
ACCOUNTPAYABLE
ITEMNO_ACC: 0000000001
VENDOR_NO: 1000008095
COMP_CODE: 1012
PMNTTRMS: Z000
BLINE_DATE: 31.12.2014
SP_GL_IND: G
CURRENCYAMOUNT
ITEMNO_ACC: 0000000001
CURRENCY: EUR
AMT_DOCCUR: 1
ITEMNO_ACC: 0000000002
CURRENCY: EUR
AMT_DOCCUR: 1-
As a result, I get both these errors:
AAPO-161 Accounting transaction category RFBURFBU000000000000 is not defined
AA-326 Enter a transaction type
I went to tables TABWD and TABWD_VID, created the entry for this category with movement type 105.
After submitting the BAPI again, I got these errors:
AAPO-176 Transaction type 105 cannot be used for activity ‘Entrar nota de crédito no exercício da fatura'
AA-326 Enter a transaction type
I’m doing this so I can post FI documents regarding Asset.
As anyone gone through this?
Am I missing some table entry?
Thanks
2015 Mar 03 4:16 PM
Hi,
I used the same BAPI for posting a document.
Below is the code I used. Please go through it.
I feel some parameters still need to be passed in your code.
Please compare the code.
| FORM map_bapi_data USING | p_s_main_table | TYPE ty_main_table |
| p_t_org_rec | TYPE ty_t_org_rec | |
| CHANGING c_s_bapi_header | TYPE bapiache09 | |
| c_t_acc_gl | TYPE ty_t_acc_gl | |
| c_t_currency | TYPE ty_t_currency | |
| c_t_error_table | TYPE ty_t_flat_file | |
| c_item | TYPE i. |
"Local Variabl Declaraion
| DATA:ls_account_gl | TYPE bapiacgl09, | |
| ls_curr | TYPE bapiaccr09, | |
| ls_main_table_copy | TYPE string, | |
| ls_org_rec | TYPE ty_org_rec. |
DATA:lv_glacc TYPE bapiacgl09-gl_account.
"Incrementing the Index and Item no.
c_item = c_item + 1.
"Assigning values picked from flat file to the BAPI Structure bapiache09
c_s_bapi_header-username = sy-uname.
c_s_bapi_header-comp_code = p_s_main_table-bukrs.
c_s_bapi_header-doc_type = p_s_main_table-blart.
c_s_bapi_header-doc_date = p_s_main_table-bldat.
c_s_bapi_header-pstng_date = p_s_main_table-budat.
c_s_bapi_header-ref_doc_no = p_s_main_table-xblnr.
c_s_bapi_header-header_txt = p_s_main_table-bktxt.
"Converting HKONT for internal format
lv_glacc = p_s_main_table-hkont.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
| EXPORTING | |
| input = lv_glacc | |
| IMPORTING | |
| output = lv_glacc. |
"Assigning values picked from flat file to the BAPI Structure bapiacgl09
ls_account_gl-gl_account = lv_glacc.
ls_account_gl-itemno_acc = c_item.
ls_account_gl-item_text = p_s_main_table-sgtxt.
ls_account_gl-bus_area = p_s_main_table-gsber.
ls_account_gl-costcenter = p_s_main_table-kostl.
APPEND ls_account_gl TO c_t_acc_gl.
"Assigning values picked from flat file to the BAPI Structure bapiacgl09
ls_curr-itemno_acc = c_item.
ls_curr-currency = p_s_main_table-waers.
ls_curr-amt_doccur = p_s_main_table-wrbtr.
APPEND ls_curr TO c_t_currency.
"Adding records to Error Internal Table
READ TABLE p_t_org_rec INTO ls_org_rec INDEX c_item. "Read the internal table with original valid records as uploaded with flag set 'X'
IF sy-subrc = 0 AND ls_org_rec-flag <> c_abap_true. "Check if the flag = 'X'
| ls_main_table_copy = ls_org_rec-record. | |
| APPEND ls_main_table_copy TO c_t_error_table. "Appending the records to the Error Internal Table |
ENDIF.
CLEAR :ls_account_gl,ls_curr,ls_main_table_copy.
| ENDFORM. | " MAP_BAPI_DATA |
Regards,
Rafi
2015 Mar 03 4:16 PM
Hi,
I used the same BAPI for posting a document.
Below is the code I used. Please go through it.
I feel some parameters still need to be passed in your code.
Please compare the code.
| FORM map_bapi_data USING | p_s_main_table | TYPE ty_main_table |
| p_t_org_rec | TYPE ty_t_org_rec | |
| CHANGING c_s_bapi_header | TYPE bapiache09 | |
| c_t_acc_gl | TYPE ty_t_acc_gl | |
| c_t_currency | TYPE ty_t_currency | |
| c_t_error_table | TYPE ty_t_flat_file | |
| c_item | TYPE i. |
"Local Variabl Declaraion
| DATA:ls_account_gl | TYPE bapiacgl09, | |
| ls_curr | TYPE bapiaccr09, | |
| ls_main_table_copy | TYPE string, | |
| ls_org_rec | TYPE ty_org_rec. |
DATA:lv_glacc TYPE bapiacgl09-gl_account.
"Incrementing the Index and Item no.
c_item = c_item + 1.
"Assigning values picked from flat file to the BAPI Structure bapiache09
c_s_bapi_header-username = sy-uname.
c_s_bapi_header-comp_code = p_s_main_table-bukrs.
c_s_bapi_header-doc_type = p_s_main_table-blart.
c_s_bapi_header-doc_date = p_s_main_table-bldat.
c_s_bapi_header-pstng_date = p_s_main_table-budat.
c_s_bapi_header-ref_doc_no = p_s_main_table-xblnr.
c_s_bapi_header-header_txt = p_s_main_table-bktxt.
"Converting HKONT for internal format
lv_glacc = p_s_main_table-hkont.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
| EXPORTING | |
| input = lv_glacc | |
| IMPORTING | |
| output = lv_glacc. |
"Assigning values picked from flat file to the BAPI Structure bapiacgl09
ls_account_gl-gl_account = lv_glacc.
ls_account_gl-itemno_acc = c_item.
ls_account_gl-item_text = p_s_main_table-sgtxt.
ls_account_gl-bus_area = p_s_main_table-gsber.
ls_account_gl-costcenter = p_s_main_table-kostl.
APPEND ls_account_gl TO c_t_acc_gl.
"Assigning values picked from flat file to the BAPI Structure bapiacgl09
ls_curr-itemno_acc = c_item.
ls_curr-currency = p_s_main_table-waers.
ls_curr-amt_doccur = p_s_main_table-wrbtr.
APPEND ls_curr TO c_t_currency.
"Adding records to Error Internal Table
READ TABLE p_t_org_rec INTO ls_org_rec INDEX c_item. "Read the internal table with original valid records as uploaded with flag set 'X'
IF sy-subrc = 0 AND ls_org_rec-flag <> c_abap_true. "Check if the flag = 'X'
| ls_main_table_copy = ls_org_rec-record. | |
| APPEND ls_main_table_copy TO c_t_error_table. "Appending the records to the Error Internal Table |
ENDIF.
CLEAR :ls_account_gl,ls_curr,ls_main_table_copy.
| ENDFORM. | " MAP_BAPI_DATA |
Regards,
Rafi
2015 Mar 03 4:28 PM
Hi Rafi,
Thanks for your quick reply.
What I am trying to do, is posting FI document regarding Asset acquisitions/credits, most in the manner of what we can do in FB01, using ACCT_TYPE: A and Asset number.
I'm afraid your code does not suport assets.
The thing is, I'm passing BUS_ACT: RFBU (for FI documents) but that prevents me for passing any movement type (in my example CS_TRANS_T:105).
If you have any idea how to do this, please let me know.
Thanks
2015 Apr 10 12:34 PM
Hi Ozzy
I am also facing the same problem. Please assist on how you solved the issue.
I am trying to post Asset documents and I have gone through the forums and have tried all the suggestions but I still get the same error.
Kind Regards,
Dineo
2015 Apr 14 11:54 AM
Hi Dineo,
I am still to solve this issue.
We are considering using a call transaction to FB01 so we can post FI documents regarding assets.
We are working with SAP also, in order to figure something out.
If we get any sort of solution from SAP i'll post here.
2015 Apr 14 9:30 PM
Hi,
i can suggest you that you can do this with BDC recording,I think it's good way to this.
It will solve your problem easily.
Regards
Prakash
2016 Jan 05 12:12 AM
Hi Dan,
Were you able to solve this issue? I am facing the same issue and your solution might help me
Thanks,
Elan
2016 Jan 05 4:02 PM
Hi!
We manage to work around the issue with a call transation of the FB01 t-code. We did not use the bapi to post fi documents related to assets.
2016 Jan 06 5:23 AM
2015 May 31 6:53 PM
Have you tried passing the relevant document type object type etc to the header?
2015 Oct 27 10:26 AM
Hi Oozy,
Just wondering if you have gotten any solution for this. We have the similar requirement to post the assets. "Fixed assets posting using an upload file". It would be great if you could provide any information on this. Thank you.
Thanks,
Jyothi D.