cancel
Showing results for 
Search instead for 
Did you mean: 

Function module to determine next empty storage bin

giancarla_aguilar
Participant
0 Kudos

Hello.

I have a program that creates transfer order with multiple items for putaway using FM L_TO_CREATE_MULTIPLE.

The program needs to transfer the stocks to one storage bin per TO, therefore I need to determine the next empty bin for a given storage type before the call to L_TO_CREATE_MULTIPLE.  Do you have a suggestion on what function module to use?  If there is no function, any table or logic you can recommend to look for the  next empty bin for a given storage type?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

mihailo_sundic
Active Contributor
0 Kudos

Finding an empty bin in a storage tye is easy to implement by a few queries.

1. step, select entries from table LAGP into intrnal table IT_LAPG, where LGTYP is your storage type.
2. sort internal table IT_LAGP by storage bin ascending
3. loop at IT_LAGP into WA_LAGP

4. select single from LQUA where LGPLA eq WA_LAGP-LGPLA

5. if sy-subrc NE 0 => you found your bin, it's WA_LAGP-LGPLA
Make sure you exit the loop after finding the bin so you don't waste CPU time.

That's it.

giancarla_aguilar
Participant
0 Kudos

Thanks for your reply, Mihailo.

May I add that in the selection from LAGP you have to add WHERE LAGP-KZLER = 'X' to get the empty bins.

I wanted a function module so that it will replicate how the system selects the next empty bin, because I might miss out a strategy defined in the system or how about the blocking indicators, etc.

Anyhow, only if there is an existing function module.  Otherwise, I have to stick to this selection from LAGP.

former_member198721
Participant
0 Kudos

Hi Giancaria,

I have similar requirement, We are enhancing Putaway task and I want a standard FM which determines next empty bin.

I could have queries /SCWM/LAGP  but I think there should be some way to do it. How system sort I am not sure.

So do you get answer of your question, can you tell me how you achieved it?

Thanks in advance

Regards ,

Khushbu

giancarla_aguilar
Participant
0 Kudos

Hello Khushbu.

We used FM L_TO_PREPARE_ITEM_INT and derived the returned storage type and bin from export parameter structure E_LTAP.  The import parameters were from the material master, customizing and transfer requirement (since our solution eventually is in reference of a TR). Here is an example call:

former_member198721
Participant
0 Kudos

Thankyou very much, I will surely try this.

Answers (1)

Answers (1)

MANIS
Active Contributor
0 Kudos

I am not very much clear on your requirement however as an alternate of L_TO_CREATE_MULTIPLE you can useL_TO_CREATE_Single

giancarla_aguilar
Participant
0 Kudos

Thank you for your reply.

But I need to create 1 TO for mutiple items/SUs that is why I used L_TO_CREATE_MULTIPLE.

Using these function modules, the system will assign the destination storage bin automatically.

My requirement is how to determine the next empty storage bin for putaway, before creating the TO, so that that derived storage bin will be used as the destination bin for all of the items in the TO to be created.  please note the storage type is given.

JL23
Active Contributor
0 Kudos

SAP uses the customized putaway strategy,

Why is it important to know the next empty bin milliseconds earlier?

There shouldn't be any difference between what a function module (if any) would determine if it is called right before L_TO_CREATE_MULTIPLE, than this FM does by itself.


Can it be that you want to do something different than you do in manual transactions? That you want overrule your customizing?

giancarla_aguilar
Participant
0 Kudos

Hello Juergen.

Right now in our system, leaving the L_TO_CREATE_MUTIPLE by itself to determine the destination bin automatically will assign different destination bins per SU, when we want all items to be transferred to just one bin, for a selected storage type.

JL23
Active Contributor
0 Kudos

I think I already understand what you want.

Just to be certain:

if you create the TO manually is it then the same bin for all items, or is it just equal to the FM behavior?

What happens if you overwrite the determined bin of the second item with the bin that is used in the first item? does SAP then issue a warning or error?

What is actually your putaway strategy and how is the storage type defined,  is it just next empty bin? is addition to existing stock allowed? what indicator is used for mixed storage?

giancarla_aguilar
Participant
0 Kudos

If I create the TO through LT06 and assign the same destination bin to all items, it saves it perfectly and no warning (except for "Check you entries") or error is displayed.  For your 3rd question, I really can't say because I am not a WM functional and I am not familiar with the settings they did.  As far as I know, the storage type is determined by the storage type indicator from the material master and I just need the next empty bin of this S. type.