‎2008 Mar 13 4:46 PM
When test the attached program, and Use 'BAPI_ACC_DOCUMENT_POST' function module the result table show ''Document are posted, without document number".
The field it_hdr-obj_type = 'BKPFB', exist in a TTYP table.
REPORT zpba_pc MESSAGE-ID m3.
***
DATA: obj_type LIKE bapiache09-obj_type,
obj_key LIKE bapiache09-obj_key,
obj_sys LIKE bapiache09-obj_sys.
DATA: it_hdr LIKE bapiache09,
it_gl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,
it_curr LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,
it_criteria LIKE bapiackec9 OCCURS 0 WITH HEADER LINE,
it_extension LIKE bapiacextc OCCURS 0 WITH HEADER LINE,
t_result LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: ls_zzz TYPE STANDARD TABLE OF yyy_accit WITH HEADER LINE.
DATA: it_ext2 LIKE bapiparex OCCURS 0 WITH HEADER LINE.
PARAMETER: hkont_1(10) DEFAULT '1440131001',
hkont_2(10) DEFAULT '1440131001',
ceco_1(10),
ceco_2(10),
cebe_1(10) DEFAULT 'VE9002',
cebe_2(10).
Header Data
it_hdr-obj_type = 'BKPFB'.
it_hdr-obj_key = '$'.
SELECT SINGLE logsys INTO it_hdr-obj_sys FROM t000 WHERE mandt EQ sy-mandt.
it_hdr-bus_act = 'RFBU'.
it_hdr-comp_code = 'VEVS'.
it_hdr-fisc_year = '2008'.
it_hdr-fis_period = '02'.
it_hdr-doc_date = '20080228'.
it_hdr-pstng_date = '20080228'.
it_hdr-doc_type = 'SA'.
it_hdr-header_txt = 'TEXTO CAB'.
it_hdr-username = 'VEJMACIAS'.
it_hdr-compo_acc = 'FI'.
it_hdr-ref_doc_no_long = 'REFERENCIA'.
First Item
Account number
it_gl-itemno_acc = '1'.
it_gl-gl_account = hkont_1.
it_gl-item_text = 'PRUEBA TEXTO 1'.
it_gl-costcenter = ceco_1.
it_gl-profit_ctr = cebe_1.
APPEND it_gl. CLEAR it_gl.
Second Item
Account number
it_gl-itemno_acc = '2'.
it_gl-gl_account = hkont_2.
it_gl-item_text = 'PRUEBA TEXTO 2'.
it_gl-profit_ctr = cebe_2.
APPEND it_gl.
Set amount
it_curr-itemno_acc = '1'.
it_curr-currency = 'VEF'.
it_curr-amt_doccur = '100'.
APPEND it_curr.
it_curr-itemno_acc = '2'.
it_curr-currency = 'VEF'.
it_curr-amt_doccur = '-100'.
APPEND it_curr.
BREAK-POINT.
check posting
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = it_hdr
TABLES
accountgl = it_gl
currencyamount = it_curr.
return = t_result.
LOOP AT t_result WHERE ( type = 'E' OR type = 'A' ).
EXIT.
ENDLOOP.
REFRESH t_result.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = it_hdr
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = it_gl
currencyamount = it_curr
criteria = it_criteria
extension2 = it_ext2
return = t_result.
*
BREAK-POINT.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
COMMIT WORK AND WAIT.
WRITE: obj_key.
What are we do, to solve the problem?.
Regards.
Piero Cimule.
‎2008 Mar 13 9:30 PM
Hello:
Do not fill this fields because the system it generates them
it_hdr-obj_type = 'BKPFB'.
it_hdr-obj_key = '$'.
SELECT SINGLE logsys INTO it_hdr-obj_sys FROM t000 WHERE mandt EQ sy-mandt
and Try again.
Regards
Roberto
‎2008 Mar 14 12:50 PM
Hello Roberto:
When I blank the fields:
it_hdr-obj_type.
it_hdr-obj_key.
it_hdr-obj_sys.
And it_hdr-compo_acc = 'FI', The document 0100000016 are created. When I check FB03 ->accounting documents, doesn't exist.
When I change hdr-compo_acc = 'GL', this message appear:
"Combination of company code VEVS transaction RFBU not assigned to a ledger".
Do you have other idea?.
Regards,
Piero Cimule.
Edited by: Piero Cimule on Mar 14, 2008 9:52 PM