BAPI: L_TO_CONFIRM
事务码: LT12 - 对未确认的TO转储单进行确认
代码样例:
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" VALUE(I_LGNUM) TYPE LGNUM
*" VALUE(I_TANUM) TYPE TANUM
*" VALUE(I_TAPOS) TYPE TAPOS
*" EXPORTING
*" VALUE(E_MSGTYP) TYPE STRING
*" VALUE(E_MESSAGE) TYPE STRING
*"----------------------------------------------------------------------
DATA:lt_ltap_conf LIKE ltap_conf OCCURS 0 WITH HEADER LINE.
lt_ltap_conf-tanum = i_tanum.
lt_ltap_conf-tapos = i_tapos.
lt_ltap_conf-squit = abap_true.
APPEND lt_ltap_conf. CLEAR lt_ltap_conf.
CALL FUNCTION 'L_TO_CONFIRM'
EXPORTING
i_lgnum = i_lgnum
i_tanum = i_tanum
i_commit_work = abap_true
TABLES
t_ltap_conf = lt_ltap_conf
EXCEPTIONS
to_confirmed = 1
to_doesnt_exist = 2
item_confirmed = 3
item_subsystem = 4
item_doesnt_exist = 5
item_without_zero_stock_check = 6
item_with_zero_stock_check = 7
one_item_with_zero_stock_check = 8
item_su_bulk_storage = 9
item_no_su_bulk_storage = 10
one_item_su_bulk_storage = 11
foreign_lock = 12
squit_or_quantities = 13
vquit_or_quantities = 14
bquit_or_quantities = 15
quantity_wrong = 16
double_lines = 17
kzdif_wrong = 18
no_difference = 19
no_negative_quantities = 20
wrong_zero_stock_check = 21
su_not_found = 22
no_stock_on_su = 23
su_wrong = 24
too_many_su = 25
nothing_to_do = 26
no_unit_of_measure = 27
xfeld_wrong = 28
update_without_commit = 29
no_authority = 30
lqnum_missing = 31
charg_missing = 32
no_sobkz = 33
no_charg = 34
nlpla_wrong = 35
two_step_confirmation_required = 36
two_step_conf_not_allowed = 37
pick_confirmation_missing = 38
quknz_wrong = 39
hu_data_wrong = 40
no_hu_data_required = 41
hu_data_missing = 42
hu_not_found = 43
picking_of_hu_not_possible = 44
not_enough_stock_in_hu = 45
serial_number_data_wrong = 46
serial_numbers_not_required = 47
no_differences_allowed = 48
serial_number_not_available = 49
serial_number_data_missing = 50
to_item_split_not_allowed = 51
input_wrong = 52
OTHERS = 53.
e_msgtyp = sy-msgty.
IF e_msgtyp EQ 'S' AND sy-msgid IS INITIAL.
e_message = '确认成功'.
ELSEIF e_msgtyp EQ 'E' AND
sy-msgid EQ 'L3' AND
sy-msgno EQ '055'.
e_msgtyp = 'W'.
e_message = i_lgnum && '/' && i_tanum && '/' && i_tapos && 'SAP已确认过'.
ELSEIF sy-msgid IS INITIAL AND e_msgtyp IS INITIAL.
DO 30 TIMES.
SELECT SINGLE tanum INTO lt_ltap_conf-tanum FROM ltap
WHERE lgnum EQ i_lgnum AND
tanum EQ i_tanum AND
tapos EQ i_tapos AND
pquit EQ abap_true.
IF sy-subrc EQ 0.
e_msgtyp = 'S'.
e_message = '确认成功'.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
IF e_msgtyp IS INITIAL.
e_msgtyp = 'E'.
e_message = '系统延迟,稍后再试'.
ENDIF.
ELSE.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = sy-msgid
msgnr = sy-msgno
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
IMPORTING
message_text_output = e_message.
ENDIF.