data: gwa_doc_header like bapiache09 occurs 0 with header line,
gt_curr like bapiaccr09 occurs 0 with header line,
gt_accgl like bapiacgl09 occurs 0 with header line,
gt_accountreceiva like bapiacar09 occurs 0 with header line,
g_obj_type like bapiache09-obj_type,
g_obj_key like bapiache09-obj_key,
g_obj_sys like bapiache09-obj_sys,
gt_accountpayable like bapiacap09 occurs 0 with header line,
gt_acc_taxes like bapiactx09 occurs 0 with header line,
gt_return like bapiret2 occurs 0 with header line.
gt_curr like bapiaccr09 occurs 0 with header line,
gt_accgl like bapiacgl09 occurs 0 with header line,
gt_accountreceiva like bapiacar09 occurs 0 with header line,
g_obj_type like bapiache09-obj_type,
g_obj_key like bapiache09-obj_key,
g_obj_sys like bapiache09-obj_sys,
gt_accountpayable like bapiacap09 occurs 0 with header line,
gt_acc_taxes like bapiactx09 occurs 0 with header line,
gt_return like bapiret2 occurs 0 with header line.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = gwa_doc_header “Datos de cabecera
importing
obj_type = g_obj_type
obj_key = g_obj_key “Chequea que se rellene
obj_sys = g_obj_sys
tables
accountgl = gt_accgl “Datos de cuentas de mayor
accountreceivable = gt_accountreceiva “Datos de cliente
accountpayable = gt_accountpayable “Datos de acreedor
accounttax = gt_acc_taxes “Datos de IVA
currencyamount = gt_curr “Importes (obligatorio)
return = lt_return.
read table lt_return
with key type = 'E'.
if sy-subrc <> 0.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = c_ok.
p_subrc = sy-subrc.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
p_subrc = 4.
endif.
exporting
documentheader = gwa_doc_header “Datos de cabecera
importing
obj_type = g_obj_type
obj_key = g_obj_key “Chequea que se rellene
obj_sys = g_obj_sys
tables
accountgl = gt_accgl “Datos de cuentas de mayor
accountreceivable = gt_accountreceiva “Datos de cliente
accountpayable = gt_accountpayable “Datos de acreedor
accounttax = gt_acc_taxes “Datos de IVA
currencyamount = gt_curr “Importes (obligatorio)
return = lt_return.
read table lt_return
with key type = 'E'.
if sy-subrc <> 0.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = c_ok.
p_subrc = sy-subrc.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
p_subrc = 4.
endif.
No hay comentarios:
Publicar un comentario