2023 Aug 03 8:34 PM
FollowRSS Feed
Hey everyone,
I was trying to use the function BAPI_ACC_DOCUMENT_POST. When I run the function by manually enter the value in the table, It returns a error message. Message number 609, and the text is "Error in document: BKPFF $ DEVCLNT102".
Anyone have any idea why this is happening? Please help. And thank you in advance
This is my code:
data: gs_documentheader LIKE bapiache09,
gs_accountgl TYPE bapiacgl09,
gs_accountreceivable TYPE bapiacar09,
gs_currencyamount TYPE bapiaccr09,
gs_customercpd TYPE bapiacpa09,
gv_obj_type LIKE bapiache09-obj_type,
gv_obj_key LIKE bapiache09-obj_key,
gv_obj_sys LIKE bapiache09-obj_sys,
gt_accountgl TYPE STANDARD TABLE OF bapiacgl09 WITH HEADER LINE,
gt_accountreceivable TYPE STANDARD TABLE OF bapiacar09 WITH HEADER LINE,
gt_currencyamount TYPE STANDARD TABLE OF bapiaccr09 WITH HEADER LINE,
it_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
it_zxmlp TYPE zxmlp OCCURS 0 WITH HEADER LINE,
wa_return TYPE bapiret2,
extension1 LIKE STANDARD TABLE OF bapiacextc WITH HEADER LINE,
extension2 LIKE STANDARD TABLE OF bapiparex WITH HEADER LINE.
APPEND it_xmlp to it_zxmlp.
LOOP AT it_zxmlp.
gs_documentheader-bus_act = 'RFBU'.
gs_documentheader-username = sy-uname.
gs_documentheader-header_txt = it_zxmlp-comentario.
gs_documentheader-comp_code = it_zxmlp-org_ventas.
gs_documentheader-doc_date = it_zxmlp-f_realizacion.
gs_documentheader-pstng_date = it_zxmlp-f_captura.
gs_documentheader-fisc_year = it_zxmlp-fisc_year.
gs_documentheader-fis_period = '11'.
gs_documentheader-doc_type = 'DZ'.
gs_documentheader-ref_doc_no = it_zxmlp-referencia.
gs_documentheader-ref_doc_no_long = it_zxmlp-referencia.
call FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_zxmlp-num_solicitante
IMPORTING
output = it_zxmlp-num_solicitante.
call FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_zxmlp-cnta_banco_pag
IMPORTING
output = it_zxmlp-cnta_banco_pag.
gs_accountgl-itemno_acc = '1'.
gs_accountgl-gl_account = it_zxmlp-cnta_banco_pag.
gs_accountgl-item_text = it_zxmlp-texto_posicion.
gs_accountgl-comp_code = it_zxmlp-org_ventas.
gs_accountgl-alloc_nmbr = it_zxmlp-asignacion.
gs_accountgl-costcenter = it_zxmlp-centro_cost.
APPEND gs_accountgl TO gt_accountgl.
gs_accountreceivable-itemno_acc = '2'.
gs_accountreceivable-customer = it_zxmlp-NUM_SOLICITANTE.
gs_accountreceivable-bline_date = it_zxmlp-f_realizacion.
gs_accountreceivable-item_text = it_zxmlp-texto_posicion. "TEXT_POS_PAGO
gs_accountreceivable-comp_code = it_zxmlp-org_ventas.
gs_accountreceivable-pymt_meth = it_zxmlp-via_pago.
gs_accountreceivable-alloc_nmbr = it_zxmlp-asignacion. "ASIGN_DOC_P
APPEND gs_accountreceivable TO gt_accountreceivable.
gs_currencyamount-itemno_acc = '1'.
gs_currencyamount-curr_type = '00'.
gs_currencyamount-currency = it_zxmlp-clave_m.
gs_currencyamount-amt_doccur = it_zxmlp-importe_un. "IMP_MON_DOC
gs_currencyamount-exch_rate = it_zxmlp-tipo_cambio.
APPEND gs_currencyamount TO gt_currencyamount.
gs_currencyamount-itemno_acc = '2'.
gs_currencyamount-curr_type = '00'.
gs_currencyamount-currency = it_zxmlp-clave_m.
gs_currencyamount-amt_doccur = it_zxmlp-importe_un * -1.
gs_currencyamount-exch_rate = it_zxmlp-tipo_cambio.
APPEND gs_currencyamount TO gt_currencyamount.
CLEAR extension2.
MOVE it_zxmlp-CVE_PROD_SAT TO extension2-valuepart1.
APPEND extension2.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gs_documentheader
customercpd = gs_customercpd
IMPORTING
obj_type = gv_obj_type
obj_key = gv_obj_key
obj_sys = gv_obj_sys
TABLES
accountgl = gt_accountgl
accountreceivable = gt_accountreceivable
currencyamount = gt_currencyamount
extension1 = extension1
return = it_return
extension2 = extension2.
LOOP AT it_return INTO wa_return.
IF wa_return-type = 'E'.
UPDATE zxmlp
SET pedido = 'ERROR'
entrega = 'ERROR'
pagos = 'ERROR' "MISN11MAY22
error = wa_return-message
WHERE consecutivo = it_zxmlp-consecutivo.
COMMIT WORK.
ELSE.
UPDATE zxmlp
SET pedido = wa_return-message_v2
entrega = wa_return-message_v2
pagos = wa_return-message_v2 "MISN11MAY22
factura_come = 'NA'
factura_fin = 'NA'
error = ''
bandera = 'X'
WHERE consecutivo = it_zxmlp-consecutivo.
COMMIT WORK.
ENDIF.
ENDLOOP.
ENDLOOP.
2023 Aug 03 8:47 PM
Hello,
RW609 is pretty generic, what else do you have in it_return?
Regards,
Eduardo.
2023 Aug 07 4:39 PM
2024 May 14 4:34 AM