Bapi co11n
Hola aqui dejo como a traves de una función lo he hecho al final. iban por ahi los tiros.
*"----------------------------------------------------------------------
*"*"Interfase local
*" IMPORTING
*" REFERENCE(I_AUFNR) TYPE AUFNR
*" REFERENCE(I_VORNR) TYPE VORNR
*" REFERENCE(I_PSMNG) TYPE CO_PSMNG
*" TABLES
*" TI_MESTAB STRUCTURE BDCMSGCOLL
*"----------------------------------------------------------------------
data: wal_propose type bapi_pp_conf_prop.
data: wal_return type bapiret1.
data: tl_tickets type standard table of bapi_pp_timeticket,
tl_details type standard table of bapi_coru_return.
data: tl_mestab type type_mestab.
field-symbols: <fk> type bapi_pp_timeticket,
<fr> type bapi_coru_return.
clear: wal_propose, wal_return.
refresh: tl_tickets.
append initial line to tl_tickets assigning <fk>.
<fk>-orderid = i_aufnr.
<fk>-yield = i_psmng.
<fk>-operation = i_vornr.
wal_propose-activity = 'X'.
call function 'BAPI_PRODORDCONF_GET_TT_PROP'
exporting
propose = wal_propose
importing
return = wal_return
tables
timetickets = tl_tickets
detail_return = tl_details.
read table tl_tickets index 1 assigning <fk>.
if sy-subrc eq 0.
<fk>-fin_conf = '1'.
call function 'BAPI_PRODORDCONF_CREATE_TT'
exporting
post_wrong_entries = '2'
* TESTRUN = TESTRUN
importing
return = wal_return
tables
timetickets = tl_tickets
detail_return = tl_details
.
loop at tl_details assigning <fr>.
perform agregar_mensajes using <fr>-id
<fr>-type
<fr>-message_v1
<fr>-message_v2
<fr>-message_v3
<fr>-message_v4
<fr>-number
changing tl_mestab.
endloop.
append lines of tl_mestab to ti_mestab.
read table tl_mestab with key msgtyp = c_typ_err transporting no fields.
if ( sy-subrc <> 0 ).
call function 'BAPI_TRANSACTION_COMMIT'
exporting wait = 'X'.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
endif.
endif.
endfunction.
|