‎2006 Jan 26 5:15 PM
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 Garcia
‎2006 Jan 26 7:18 PM
Hi,
Welcome to SDN!
I have encountered this problem before.
You should not pass anything for obj_type, obj_sys, and obj_key. Then SAP will assume that it has to generate a new document number.
Hope this helps,
Bhanu
‎2006 Jan 26 7:18 PM
Hi,
Welcome to SDN!
I have encountered this problem before.
You should not pass anything for obj_type, obj_sys, and obj_key. Then SAP will assume that it has to generate a new document number.
Hope this helps,
Bhanu
‎2006 Jan 27 12:16 AM
Thanks for your reply, Bhanumurthy, but I've tried that solution, and the BAPI is telling me to fill those fields. Have I missed any additional field?
Regards!
Angel.
‎2006 Jan 27 7:38 AM
Hi 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.
‎2006 Jan 27 7:49 AM
Hi,
Check this link.It is explaining the BAPI with sample code.Kindly reward points by clicking the star on the left of reply,if it helps.
‎2006 Apr 21 6:10 AM
Hello Jayanthi Jayaraman,
I am also facing BAP_ACC_DOCUMENT_POST problem ,sometimes document posted message ,but there is no document.I am unable to access your link.please can you provide me the solution.my mail id is sridhar_88@yahoo.com or srinsap@gmail.com
http://funciones.sapabap.cc/DocuFuncion.asp?Id=515
Regards
Sridhar
‎2006 Jun 14 4:28 PM