Que tal, compañeros.
Estoy viendo en el MODULO de FI el tema de INCOBRABLES.
tengo un archivo de carga y necesito contabilizar en el FB01, estoy tratando de implemetar la bapi BAPI_ACC_DOCUMENT_POST, estoy siguiendo los ejemplos pero casi no encuentro ejemplos de cuando se utiliza la tabla ACCOUNTTAX(BAPIACTX09), me manda el error 702, "Saldo en la moneda de transacción".
les muestro el codigo esperando que me puedan ayudar.
LOOP AT t_itab.
PERFORM llena_header.
READ TABLE t_zctasing WITH KEY XBLNR = t_itab-tarifa
BUKRS = t_itab-sociedad
ZDIVISION = t_itab-division.
IF sy-subrc EQ 0.
PERFORM llena_accountgl.
PERFORM llena_accounttax.
ENDIF.
* PERFORM llena_accountgl.
PERFORM llena_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = t_header
* customercpd = gd_customercpd
* contractheader = gd_fica_hd
* importing
* obj_type = l_type
* obj_key = l_key
* obj_sys = l_sys
tables
accountgl = t_accountgl
accounttax = t_accounttax
currencyamount = t_currencyamount
return = t_return.
* IF sy-subrc = 0.
* CLEAR commit_ret.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT = 'X'
* IMPORTING
* RETURN = commit_ret.
* ENDIF.
CLEAR : t_header,
t_accountgl[],
t_accounttax[],
t_currencyamount[],
t_return[].
ENDLOOP.
FORM llena_header .
t_header-username = sy-uname.
t_header-header_txt = t_itab-descripcion.
t_header-comp_code = t_itab-sociedad.
t_header-doc_date = sy-datum.
t_header-pstng_date = sy-datum.
t_header-fis_period = sy-datum+2(2).
t_header-doc_type = t_itab-clase_docto.
t_header-ref_doc_no = t_itab-tarifa.
t_header-bus_act = 'RFBU'.
ENDFORM. " llena_header
*&---------------------------------------------------------------------*
*& Form llena_accountgl
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM llena_accountgl .
CLEAR t_accountgl.
IF t_zctasing-ziep EQ 'X'.
IF t_itab-iva EQ '10'.
t_accountgl-tax_code = 'A1'.
ELSEIF t_itab-iva EQ '15'.
t_accountgl-tax_code = 'A2'.
ELSEIF t_itab-iva EQ '16'.
t_accountgl-tax_code = 'A3'.
ELSEIF t_itab-iva EQ '11'.
t_accountgl-tax_code = 'A4'.
ENDIF.
ELSEIF t_itab-iva EQ '11'.
t_accountgl-tax_code = 'S2'.
ELSEIF t_itab-iva EQ '16'.
t_accountgl-tax_code = 'S1'.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = t_zctasing-zcta
IMPORTING
OUTPUT = t_zctasing-zcta.
clear t_accountgl.
t_accountgl-itemno_acc = 1.
t_accountgl-gl_account = t_zctasing-zcta.
t_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
t_accountgl-comp_code = t_itab-sociedad.
t_accountgl-bus_area = t_itab-division.
append t_accountgl.
ENDFORM. " llena_accountgl
*&---------------------------------------------------------------------*
*& Form llena_accounttax
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM llena_accounttax .
SELECT SINGLE *
FROM T030K
WHERE ktopl EQ 'MM01' AND
ktosl EQ 'MWS' AND
mwsKz EQ t_accountgl-tax_code.
clear t_accounttax.
t_accounttax-itemno_acc = 2.
t_accounttax-gl_account = t030k-konts.
t_accounttax-tax_code = t_accountgl-tax_code.
t_accounttax-acct_key = 'MWS'.
t_accounttax-cond_key = 'MWAS'.
* t_accounttax-itemno_tax = 2.
append t_accounttax.
ENDFORM. " llena_accounttax
*&---------------------------------------------------------------------*
*& Form llena_currencyamount
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM llena_currencyamount .
DATA : v_importe_iva TYPE bapiaccr09-amt_doccur,
v_importe TYPE bapiaccr09-amt_doccur.
v_importe_iva = t_itab-importe * t_itab-iva.
v_importe_iva = v_importe_iva / 100.
v_importe = t_itab-importe - v_importe_iva.
clear t_currencyamount.
t_currencyamount-itemno_acc = 1.
* t_currencyamount-curr_type = '10'.
t_currencyamount-currency = 'MXN'.
t_currencyamount-amt_doccur = t_itab-importe.
append t_currencyamount.
clear t_currencyamount.
t_currencyamount-itemno_acc = 2.
* t_currencyamount-curr_type = '10'.
t_currencyamount-currency = 'MXN'.
t_currencyamount-amt_base = t_itab-importe.
t_currencyamount-amt_doccur = v_importe_iva.
append t_currencyamount.
* clear t_currencyamount.
* t_currencyamount-itemno_acc = 3.
** t_currencyamount-curr_type = '10'.
* t_currencyamount-currency = 'MXN'.
** t_currencyamount-amt_doccur = '3840.00'.
* append t_currencyamount.
ayuda porfavor!!!!
Gracias.
Estoy viendo en el MODULO de FI el tema de INCOBRABLES.
tengo un archivo de carga y necesito contabilizar en el FB01, estoy tratando de implemetar la bapi BAPI_ACC_DOCUMENT_POST, estoy siguiendo los ejemplos pero casi no encuentro ejemplos de cuando se utiliza la tabla ACCOUNTTAX(BAPIACTX09), me manda el error 702, "Saldo en la moneda de transacción".
les muestro el codigo esperando que me puedan ayudar.
LOOP AT t_itab.
PERFORM llena_header.
READ TABLE t_zctasing WITH KEY XBLNR = t_itab-tarifa
BUKRS = t_itab-sociedad
ZDIVISION = t_itab-division.
IF sy-subrc EQ 0.
PERFORM llena_accountgl.
PERFORM llena_accounttax.
ENDIF.
* PERFORM llena_accountgl.
PERFORM llena_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = t_header
* customercpd = gd_customercpd
* contractheader = gd_fica_hd
* importing
* obj_type = l_type
* obj_key = l_key
* obj_sys = l_sys
tables
accountgl = t_accountgl
accounttax = t_accounttax
currencyamount = t_currencyamount
return = t_return.
* IF sy-subrc = 0.
* CLEAR commit_ret.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT = 'X'
* IMPORTING
* RETURN = commit_ret.
* ENDIF.
CLEAR : t_header,
t_accountgl[],
t_accounttax[],
t_currencyamount[],
t_return[].
ENDLOOP.
FORM llena_header .
t_header-username = sy-uname.
t_header-header_txt = t_itab-descripcion.
t_header-comp_code = t_itab-sociedad.
t_header-doc_date = sy-datum.
t_header-pstng_date = sy-datum.
t_header-fis_period = sy-datum+2(2).
t_header-doc_type = t_itab-clase_docto.
t_header-ref_doc_no = t_itab-tarifa.
t_header-bus_act = 'RFBU'.
ENDFORM. " llena_header
*&---------------------------------------------------------------------*
*& Form llena_accountgl
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM llena_accountgl .
CLEAR t_accountgl.
IF t_zctasing-ziep EQ 'X'.
IF t_itab-iva EQ '10'.
t_accountgl-tax_code = 'A1'.
ELSEIF t_itab-iva EQ '15'.
t_accountgl-tax_code = 'A2'.
ELSEIF t_itab-iva EQ '16'.
t_accountgl-tax_code = 'A3'.
ELSEIF t_itab-iva EQ '11'.
t_accountgl-tax_code = 'A4'.
ENDIF.
ELSEIF t_itab-iva EQ '11'.
t_accountgl-tax_code = 'S2'.
ELSEIF t_itab-iva EQ '16'.
t_accountgl-tax_code = 'S1'.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = t_zctasing-zcta
IMPORTING
OUTPUT = t_zctasing-zcta.
clear t_accountgl.
t_accountgl-itemno_acc = 1.
t_accountgl-gl_account = t_zctasing-zcta.
t_accountgl-item_text = 'BAPI Test G/L line item'. "#EC NOTEXT
t_accountgl-comp_code = t_itab-sociedad.
t_accountgl-bus_area = t_itab-division.
append t_accountgl.
ENDFORM. " llena_accountgl
*&---------------------------------------------------------------------*
*& Form llena_accounttax
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM llena_accounttax .
SELECT SINGLE *
FROM T030K
WHERE ktopl EQ 'MM01' AND
ktosl EQ 'MWS' AND
mwsKz EQ t_accountgl-tax_code.
clear t_accounttax.
t_accounttax-itemno_acc = 2.
t_accounttax-gl_account = t030k-konts.
t_accounttax-tax_code = t_accountgl-tax_code.
t_accounttax-acct_key = 'MWS'.
t_accounttax-cond_key = 'MWAS'.
* t_accounttax-itemno_tax = 2.
append t_accounttax.
ENDFORM. " llena_accounttax
*&---------------------------------------------------------------------*
*& Form llena_currencyamount
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM llena_currencyamount .
DATA : v_importe_iva TYPE bapiaccr09-amt_doccur,
v_importe TYPE bapiaccr09-amt_doccur.
v_importe_iva = t_itab-importe * t_itab-iva.
v_importe_iva = v_importe_iva / 100.
v_importe = t_itab-importe - v_importe_iva.
clear t_currencyamount.
t_currencyamount-itemno_acc = 1.
* t_currencyamount-curr_type = '10'.
t_currencyamount-currency = 'MXN'.
t_currencyamount-amt_doccur = t_itab-importe.
append t_currencyamount.
clear t_currencyamount.
t_currencyamount-itemno_acc = 2.
* t_currencyamount-curr_type = '10'.
t_currencyamount-currency = 'MXN'.
t_currencyamount-amt_base = t_itab-importe.
t_currencyamount-amt_doccur = v_importe_iva.
append t_currencyamount.
* clear t_currencyamount.
* t_currencyamount-itemno_acc = 3.
** t_currencyamount-curr_type = '10'.
* t_currencyamount-currency = 'MXN'.
** t_currencyamount-amt_doccur = '3840.00'.
* append t_currencyamount.
ayuda porfavor!!!!
Gracias.
Comentario