Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Confirm multiple Transfer Orders immediately using L_TO_CONFIRM

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Prem,

Add 'COMMIT WORK.' statement after calling the Function module L_TO_CONFIRM.

Regards,

Jyothi

8 REPLIES 8

Former Member
0 Kudos

Hello,

The function module L_TO_CONFIRM is used to create a single TO. When you create it for first item and its trying to process second item, It might end in error as first item is still under processing . It needs some time gap to unlock.

So add 'wait up tp 5 seconds.' statement within the loop - endloop.

example..

loop at it_to.

call function L_TO_CONFIRM

exporting...

wait up to 5 seconds.

endloop.

this might solve your problem.

Regards,

Jyothi

Former Member
0 Kudos

Hello Prem,

Add 'COMMIT WORK.' statement after calling the Function module L_TO_CONFIRM.

Regards,

Jyothi

0 Kudos

Hello Jyothi,

First of all I thank you for your initiative on reply to my query,

but what ever the suggestion you have given to me like 'wait up to 5 seconds' and 'commit work' i have already done this but yet only first TO is getting confirmed and remaining TO's left unconfirmed. and in your previous answer you have kept 'loop at it_to' the loop for each TO is being processed from standard code function module 'L_TA_HINZUFUEGEN' to my code function module 'L_TO_CONFIRM' .

After investigating i have 2 queries

1. How to know that all TO's are processed , i mean how to know the last TO being processed, by knowing this i can append all TO's in to the tables : ' t_ltap_conf ' and ' t_ltap_conf_hu ' which we need to pass these tables thru Function Module 'L_TO_CONFIRM'

2. Now currently for each TO it is doing 'Commit Work' what i believe is that for the first TO it is doing commit work and and for the rest its not as the function module 'L_TO_CONFIRM' is calling on update task and updating asynchronously and so i feel after doing commit work for the first TO, its processing for the rest might be ignored and hence not commiting.. how to do 'commit work' for all processed TO's at once..

Thank you..

Kind Regards,

Prem Kumar

0 Kudos

Hi Prem,

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.

clear it_ltap_conf.

refresh it_ltap_conf.

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.

append it_ltap_conf.

clear it_ltap_conf_hu. "v_n_924196

refresh it_ltap_conf_hu.

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.

append it_ltap_conf_hu.

endif. "^_n_924196

call function 'L_TO_CONFIRM'

exporting

i_lgnum = it_alv-lgnum

i_tanum = it_alv-tanum

i_quknz = p_quknz

i_update_task = ' '

i_commit_work = ' '

i_subst = 'X'

tables

t_ltap_conf = it_ltap_conf

t_ltap_conf_hu = it_ltap_conf_hu "n_924196

exceptions

to_confirmed = 1

to_doesnt_exist = 2

item_confirmed = 3

foreign_lock = 4

nothing_to_do = 5

error_message = 6

others = 7.

Regards,

Jyothi

0 Kudos

I really appreciate for your reply now its working even for the multiple line items TO confirmation immediately,

Jyothi, i have one small query, as per my requirement the confirmation should happen for a particular storage type 040-916, but now its happening for other storage types also, how to restrict this plz..

0 Kudos

Hi Jyothi,

this is inregard with above posted message 'storage types',

when we flag 'Confirm putaway' 'Confirm removal' and 'CompleteRemoval' from the tables T331 for the storage types, immediate TO confirmation should not happen, but its happening, what might be the reason for this ?

immediate TO confirmation should only happen if flags are not set for 'Confirm putaway' 'Confirm removal' and 'CompleteRemoval' .

Former Member
0 Kudos

Hi,

this is inregard with above posted message 'storage types',

when we flag 'Confirm putaway' 'Confirm removal' and 'CompleteRemoval' from the tables T331 for the storage types, immediate TO confirmation should not happen, but its happening, what might be the reason for this ?

immediate TO confirmation should only happen if flags are not set for 'Confirm putaway' 'Confirm removal' and 'CompleteRemoval' .

0 Kudos

Hi Prem,

You can not directly pass the storage types to the Function Module and restrict.

But you can restrict the storage types as follows.

To find the storage type:

Use Transfer Order Number TANUM and get TBNUM ( Transfer Requirement Number) from

table LTAK (Transfer Order Header).

Using TBNUM, get the LGTYP ( Storage type) from LQUA (Quants) table.

If storage type is not between 010-916, do not confirm the transfer order for that record.

"immediate TO confirmation should only happen if flags are not set for

'Confirm putaway' 'Confirm removal' and 'CompleteRemoval' . "

i think this is something related to customizing. so contact your Functional Consultant.

Note: If you dont want a TR to be confirmed, just create a TO and leave it.

You can use one of the function modules starting with 'L_TO_CREATE*' based on your requirement.

Regards,

Jyothi