Difference between revisions of "SAP FI BAPI"
From SapWiki
Line 204: | Line 204: | ||
==Notas BAPI FI== | ==Notas BAPI FI== | ||
− | *SAP Note 487722 - Using EXTENSION1 for accounting BAPIs: Implementing CMOD/SMOD exit ACBAPI01 with enhancement structure EXTENSION1, exit EXIT_SAPLACC4_001 | + | *SAP Note 487722 - Using EXTENSION1 for accounting BAPIs: Implementing CMOD/SMOD exit ACBAPI01 with enhancement structure EXTENSION1, exit EXIT_SAPLACC4_001, include ZXACCU15 |
Revision as of 13:35, 4 April 2020
BAPI_ACC_DOCUMENT_POST
- Ejemplo con extensión
FORM document_post USING p_pernr p_begda p_endda p_monto p_modo CHANGING p_subrc p_return TYPE bapiret2. DATA: ls_documentheader LIKE bapiache09, l_customercpd LIKE bapiacpa09, l_fica_hd LIKE bapiaccahd, it_accountreceivable LIKE TABLE OF bapiacar09 WITH HEADER LINE, it_accountgl LIKE TABLE OF bapiacgl09 WITH HEADER LINE, it_accounttax LIKE TABLE OF bapiactx09 WITH HEADER LINE, it_criteria LIKE TABLE OF bapiackec9 WITH HEADER LINE, it_valuefield LIKE TABLE OF bapiackev9 WITH HEADER LINE, it_currencyamount LIKE TABLE OF bapiaccr09 WITH HEADER LINE, it_return LIKE TABLE OF bapiret2 WITH HEADER LINE, it_receivers LIKE TABLE OF bdi_logsys WITH HEADER LINE, it_fica_it LIKE TABLE OF bapiaccait WITH HEADER LINE, it_accountpayable LIKE TABLE OF bapiacap09 WITH HEADER LINE, it_paymentcard LIKE TABLE OF bapiacpc09 WITH HEADER LINE, it_ext LIKE TABLE OF bapiacextc WITH HEADER LINE, it_re LIKE TABLE OF bapiacre09 WITH HEADER LINE, it_ext2 LIKE TABLE OF bapiparex WITH HEADER LINE. DATA: lt_p0001 TYPE TABLE OF p0001 WITH HEADER LINE, lt_p0185 TYPE TABLE OF p0185 WITH HEADER LINE. DATA: l_type LIKE ls_documentheader-obj_type, l_key LIKE ls_documentheader-obj_key, l_sys LIKE ls_documentheader-obj_sys. DATA l_pos TYPE posnr_acc. DATA l_amount TYPE bapicurr-bapicurr. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = p_pernr infty = '0001' * IMPORTING * SUBRC = TABLES infty_tab = lt_p0001 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. LOOP AT lt_p0001 WHERE begda <= p_endda AND endda >= p_begda. ENDLOOP. * CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET' * IMPORTING * own_logical_system = ls_documentheader-obj_sys. * ls_documentheader-obj_type = 'BKPFF'. * ls_documentheader-obj_key = '$'. ls_documentheader-bus_act = 'RFBU'. * ls_documentheader-obj_key = ls_documentheader-username = sy-uname. ls_documentheader-header_txt = 'Bonificación'. "#EC NOTEXT * gd_documentheader-obj_key_r = * GD_DOCUMENTHEADER-reason_rev = ls_documentheader-comp_code = lt_p0001-bukrs. * GD_DOCUMENTHEADER-AC_DOC_NO = ls_documentheader-fisc_year = sy-datum(4). ls_documentheader-doc_date = sy-datum. ls_documentheader-doc_type = 'SA'. ls_documentheader-pstng_date = sy-datum. * GD_DOCUMENTHEADER-TRANS_DATE = * GD_DOCUMENTHEADER-VALUE_DATE = ls_documentheader-fis_period = sy-datum+4(2). * GD_DOCUMENTHEADER-DOC_TYPE = * GD_DOCUMENTHEADER-REF_DOC_NO = * GD_DOCUMENTHEADER-COMPO_ACC = ls_documentheader-bus_act = 'RFBU'. * l_documentheader-ref_doc_no = '1'. DATA l_valor(100). l_pos = l_pos + 1. CLEAR: it_accountgl. l_valor = '11111'. "cuenta it_accountgl-itemno_acc = l_pos. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = l_valor IMPORTING output = it_accountgl-gl_account. CONCATENATE 'Bonificación Empleado' p_pernr INTO it_accountgl-item_text SEPARATED BY space. it_accountgl-value_date = sy-datum. APPEND it_accountgl. * 2da pos CLEAR it_accountgl. l_pos = l_pos + 1. l_valor = '22222000'. "N° cuenta it_accountgl-itemno_acc = l_pos. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = l_valor IMPORTING output = it_accountgl-gl_account. CONCATENATE 'Bonificación Empleado' p_pernr INTO it_accountgl-item_text. APPEND it_accountgl. * ver SAP Note 487722 - Using EXTENSION1 for accounting BAPIs * Implementing CMOD/SMOD exit ACBAPI01 with enhancement structure EXTENSION1: * extension 1 CLEAR it_ext. it_ext-field1 = it_accountgl-itemno_acc. it_ext-field2 = 'PERNR'. MOVE p_pernr TO it_ext-field3. APPEND it_ext. * montos l_amount = p_monto. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING currency = 'CLP' amount_internal = l_amount IMPORTING amount_external = l_amount. CLEAR it_currencyamount. it_currencyamount-itemno_acc = 1. * it_currencyamount-curr_type = '00'. it_currencyamount-currency = 'CLP'. * IT_CURRENCYAMOUNT-CURRENCY_ISO = it_currencyamount-amt_doccur = l_amount. * IT_CURRENCYAMOUNT-EXCH_RATE = . * it_currencyamount-amt_base = * IT_CURRENCYAMOUNT-DISC_BASE = * it_currencyamount-exch_rate_v = * it_currencyamount-disc_amt = APPEND it_currencyamount. CLEAR it_currencyamount. it_currencyamount-itemno_acc = 2. *it_currencyamount-curr_type = '00'. it_currencyamount-currency = 'CLP'. * IT_CURRENCYAMOUNT-CURRENCY_ISO = it_currencyamount-amt_doccur = l_amount * -1. * IT_CURRENCYAMOUNT-EXCH_RATE = * it_currencyamount-amt_base = * IT_CURRENCYAMOUNT-DISC_BASE = * it_currencyamount-exch_rate_v = * it_currencyamount-disc_amt = APPEND it_currencyamount. CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST' EXPORTING documentheader = ls_documentheader * customercpd = ls_customercpd * contractheader = ls_fica_hd IMPORTING obj_type = l_type obj_key = l_key obj_sys = l_sys TABLES accountgl = it_accountgl * accountreceivable = it_accountreceivable accountpayable = it_accountpayable * accounttax = it_accounttax currencyamount = it_currencyamount * criteria = it_criteria * valuefield = it_valuefield extension1 = it_ext return = it_return * paymentcard = it_paymentcard * contractitem = it_fica_it * extension2 = it_ext2 * realestate = it_re . LOOP AT it_return INTO p_return WHERE type = 'E'. ENDLOOP. IF sy-subrc NE 0. p_subrc = 0. ELSE. p_subrc = 1. MESSAGE ID p_return-id TYPE 'I' NUMBER p_return-number WITH p_return-message_v1 p_return-message_v2 p_return-message_v3 p_return-message_v4 DISPLAY LIKE 'E'. ENDIF. ENDFORM. " PAGO_ANTICIPADO
Notas BAPI FI
- SAP Note 487722 - Using EXTENSION1 for accounting BAPIs: Implementing CMOD/SMOD exit ACBAPI01 with enhancement structure EXTENSION1, exit EXIT_SAPLACC4_001, include ZXACCU15