Ejemplo BAPI Simula FB01

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

data:

gd_documentheader like bapiache09,


it_currencyamount like table of bapiaccr09 with header line,
it_return like table of bapiret2 with header line,
it_accounttax like table of bapiactx09 with header line.

gd_documentheader-bus_act = 'RFBU'.
gd_documentheader-username = 'JRIVERA'.
gd_documentheader-header_txt = 'BAPI EJEMPLO'.
gd_documentheader-comp_code = '1001'.
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
gd_documentheader-fisc_year = '2014'.
gd_documentheader-fis_period = '10'.
gd_documentheader-doc_type = 'AB'.
clear it_accounttax.
it_accounttax-ITEMNO_ACC = '0000000001'.
it_accounttax-GL_ACCOUNT = '4011100001'.
it_accounttax-COND_KEY = 'MWVS'.
it_accounttax-ACCT_KEY = 'VST'.
it_accounttax-TAX_CODE = 'C0'.
append it_accounttax.
clear it_accounttax.
it_accounttax-ITEMNO_ACC = '0000000002'.
it_accounttax-GL_ACCOUNT = '4011100001'.
it_accounttax-COND_KEY = 'MWVS'.
it_accounttax-ACCT_KEY = 'VST'.
it_accounttax-TAX_CODE = 'C0'.
append it_accounttax.

clear it_currencyamount.
it_currencyamount-itemno_acc = '0000000001'.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'PEN'.
it_currencyamount-amt_doccur = '-1800.0000'.
it_currencyamount-amt_base = '-1000.0000'.
it_currencyamount-disc_base = '-180.0000'.
append it_currencyamount.

clear it_currencyamount.
it_currencyamount-itemno_acc = '0000000002'.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'PEN'.
it_currencyamount-amt_doccur = '1800.0000'.
it_currencyamount-amt_base = '1000.0000'.
it_currencyamount-disc_base = '180.0000'.
append it_currencyamount.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'


EXPORTING
DOCUMENTHEADER = gd_documentheader
* CUSTOMERCPD =
* CONTRACTHEADER =
* IMPORTING
* OBJ_TYPE =
* OBJ_KEY =
* OBJ_SYS =
TABLES
* ACCOUNTGL =
* ACCOUNTRECEIVABLE =
* ACCOUNTPAYABLE = it_accountpayable
ACCOUNTTAX = it_accounttax
CURRENCYAMOUNT = it_currencyamount
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
RETURN = it_return
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
* ACCOUNTWT =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
WRITE: 'Documento', it_return-message_v2+0(10).
skip.
WRITE: 'Sociedad', it_return-message_v2+10(4).
skip.
WRITE: 'Ejercicio', it_return-message_v2+14(4).

You might also like