How to Confirm multiple Transfer Orders immediately using L_TO_CONFIRM
Currently Transfer Orders(TO) are getting confirmed immediately but only one by one. when i pick multiple line items to create the transfer orders using the transaction LT03 all TO's are created but only one by one created TO is passing from the standard code in to my code where Function Module L_TO_CONFIRM is there and only the first line item TO is getting confirmed and remaining line item TO's are not confimed .
May i kindly know what might be the reason for only the first TO getting confirmed and not the remaining TO's ? although each and every created TO is passing the Function Module L_TO_CONFIRM
Edited by: Prem Kumar Kothapalle on Sep 10, 2008 12:54 PM
Edited by: Prem Kumar on Sep 12, 2008 10:26 AM
Please see the documentation for function module below. The update can be made synchronous and COMMIT WORK must be passed via parameters i_update_task, i_commit_work.
If I_UPDATE_TASK is set, the data is updated asynchronously via the update task, otherwise directly online.
Parameters I_UPDATE_TASK and I_COMMIT_WORK are closely related.
I_COMMIT_WORK controls whether or not a COMMIT WORK should be carried out within the function module.
I_UPDATE_TASK controls whether an asynchronous or synchronous update is to be carried out. The synchronous update occurs via SET UPDATE TASK LOCAL, meaning that the database update is only triggered if the ABAP command COMMIT WORK is given. If the COMMIT should first be carried out in the current programm, you cannot access the result of the function module in the database before the COMMIT is submitted.
A COMMIT WORK should always occur between two SAPLL03B function module calls if an I_COMMIT_WORK does not already produce this result. Otherwise, you run the risk of two consecutive TOs using the same stock, for example.
So if you set I_UPDATE_TASK = ' ' and I_COMMIT_WORK 'X'.
I think your problem will be solved.
You can see the sample code below from an SAP standard program.
move it_alv-tanum to it_ltap_conf-tanum.
move it_alv-tapos to it_ltap_conf-tapos.
move con_x to it_ltap_conf-squit.
clear it_ltap_conf_hu. "v_n_924196
if it_alv-vlenr = it_alv-nlenr and
it_alv-ndifa is initial and
not it_alv-vnest is initial and
it_alv-pvqui is initial.
move it_alv-tanum to it_ltap_conf_hu-tanum.
move it_alv-tapos to it_ltap_conf_hu-tapos.
move it_alv-vlenr to it_ltap_conf_hu-vonhu.
move it_alv-nlenr to it_ltap_conf_hu-nachu.
move con_x to it_ltap_conf_hu-huent.
move it_alv-altme to it_ltap_conf_hu-altme.
move it_alv-nsola to it_ltap_conf_hu-menga.
call function 'L_TO_CONFIRM'
i_lgnum = it_alv-lgnum
i_tanum = it_alv-tanum
i_quknz = p_quknz
i_update_task = ' '
i_commit_work = ' '
i_subst = 'X'
t_ltap_conf = it_ltap_conf
t_ltap_conf_hu = it_ltap_conf_hu "n_924196
to_confirmed = 1
to_doesnt_exist = 2
item_confirmed = 3
foreign_lock = 4
nothing_to_do = 5
error_message = 6
others = 7.