Skip to Content
0
Former Member
Feb 17, 2009 at 01:07 PM

BAPI_ACC_DOCUMENT_POST for Assets

2711 Views

Hello,

We are trying to implement the posting of a Document for an asset using the BAPI: BAPI_ACC_DOCUMENT_POST (and BAPI_TRANSACTION_COMMIT) but although we get the succee message, no document is post.

I do not know if we are not introducing correctly the information... Could someone help me??

The code is:

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

IMPORTING

OWN_LOGICAL_SYSTEM = et_documentheader-obj_sys

EXCEPTIONS

OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1

OTHERS = 2

.

et_documentheader-obj_type = 'IDOC'.

et_documentheader-obj_key = lv_docnum.

et_documentheader-bus_act = 'RFBU'.

et_documentheader-username = sy-uname."Usuario

et_documentheader-header_txt = i_entrada-conc_doc_cont."Texto de cabecera de documento

et_documentheader-comp_code = i_entrada-sociedad."Sociedad

et_documentheader-doc_date = i_entrada-fecha_doc."Fecha Documento

et_documentheader-pstng_date = i_entrada-fecha_cont."Fecha Contabilización

et_documentheader-doc_type = i_entrada-clase_doc."Clase de Documento

et_documentheader-fisc_year = i_entrada-fecha_cont(4)."Ejercicio

et_documentheader-fis_period = i_entrada-fecha_cont+4(2)."Mes Contable

et_documentheader-ref_doc_no = i_entrada-referencia.

it_accountgl-itemno_acc = '0000000001'.

it_accountgl-gl_account = lv_cuenta."cuenta

it_accountgl-item_text = i_entrada-texto.

it_accountgl-stat_con = 'H'.

it_accountgl-acct_type = 'S'.

it_accountgl-comp_code = i_entrada-sociedad.

it_accountgl-alloc_nmbr = i_entrada-asignacion.

it_accountgl-tax_code = i_entrada-ind_iva.

APPEND it_accountgl.

CLEAR it_accountgl.

it_accountgl-itemno_acc = '0000000002'.

it_accountgl-item_text = i_entrada-texto.

it_accountgl-stat_con = 'S'.

it_accountgl-acct_type = 'A'.

it_accountgl-alloc_nmbr = i_entrada-asignacion.

it_accountgl-tax_code = i_entrada-ind_iva.

it_accountgl-cs_trans_t = '100'. "i_entrada-clase_mov.

it_accountgl-asset_no = i_entrada-num_activo."Numero Activo Fijo

it_accountgl-sub_number = i_entrada-subnum_activo."Subnumero de Activo Fijo

APPEND it_accountgl.

CLEAR it_accountgl.

it_currencyamount-itemno_acc = '0000000001'.

it_currencyamount-currency_iso = 'EUR'.

it_currencyamount-amt_doccur = i_entrada-importe.

APPEND it_currencyamount.

CLEAR it_currencyamount.

it_currencyamount-itemno_acc = '0000000002'.

it_currencyamount-currency_iso = 'EUR'.

it_currencyamount-amt_doccur = i_entrada-importe.

APPEND it_currencyamount.

CLEAR it_currencyamount.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = et_documentheader

TABLES

accountgl = it_accountgl

currencyamount = it_currencyamount

return = it_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

.

Thanksss!!

Araitz.-