cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

create new Transfer order during confirmation of one Transfer Order

k_sood
Active Participant
1,368

Hi All,

I have to implement a Requirement to create a new Transfer order while confirming one Transfer order (For some specific nltyp and vltyp)

I am using the Function module L_TR_CREATE_SINGLE and L_TR_CREATE_MULTIPLE at the end of the function Module L_TA_QUITTIEREN (by implementing an Enhancement point

An error related to the base unit of measure is coming. Calling the function modules single or Multiple directly using the same input no error is coming.

According to some threads, this is an old problem of these Function Modules and the proposed solution is to call the TO create function modules in a new Task. I cant use a new task because the creation should occur only after the confirmation is successful. starting a new task will make it an independent task. Is there any other solution to this problem ?

Best Regards

Ketan

Accepted Solutions (0)

Answers (2)

Answers (2)

Dominik_Tylczynski
SAP Champion
SAP Champion

Hi k_sood

Ad 1. You really don't need to use any enhancement spots. The user exit will work just fine - trust me have implemented automation like that several times. VORGA field in T_LTAB_VB tables gives the information on the processing status of a TO item. I don't recall all the possible values. You can Google them up or put a break point in the user exit and examine the values.

Ad 2. Understood.

Ad 3. User-exit EXIT_SAPLL03T_002 after all the checks on TO confirmation are done. As far as I remember it's called in update task. So you don't need to worry. If the user exit is called, TO is confirmed. Just be aware, that cancellation counts here as kind of confirmation. Therefore you need to check VORGA value. The approach I've described in my first answer with

CALL FUNCTION <my RFC function>
   IN BACKGROUND TASK
   AS SEPARATE UNIT

works for me every time.

Best regards

Dominik Tylczynski

Dominik_Tylczynski
SAP Champion
SAP Champion

Hello k_sood

You don't need to use any enhancement point to implement your requirement. Just use standard WM user-exit MWMTO002 / EXIT_SAPLL03T_002, that is called at the end of TO confirmation. Be aware that the same exit is called during TO confirmation and TO cancellation as cancellation is a sort of confirmation. You can distinguish these two by VORGA field in T_LTAP_VB table. VORGA = ST means cancellation if I'm not mistaken.

You should use L_TO_CREATE_SINGLE or L_TO_CREATE_MULTIPLE function to create TOs, not L_TR_* functions.

When EXIT_SAPLL03T_002 is called during TO confirmation, TO and WM quants are still locked. Therefore if you call TO creation directly, you'll get locking conflicts. So you need create TOs in a separate LUW. To do that, I usually create a new RFC-enabled function module and call L_TO_CREATE_SINGLE from that function. Then I call my new function from EXIT_SAPLL03T_002 with IN BACKGROUND TASK AS SEPARATE UNIT e.g.

CALL FUNCTION <my RFC function>
   IN BACKGROUND TASK
   AS SEPARATE UNIT
   EXPORTING
     ...

TO creation will be performed as RFC call in a separate LUW, so you need to handle errors. The good practice here is to use the same mechanisms that SAP uses in immediate TO creation, i.e. mail control settings. Take a look at L_COMMUNICATION_TO_CREATE function, procedure MAIL_VERSCHICKEN to see how it's done. Alternatively you can just throw E message and do error handling from RFC monitor. I'd discourage that however as RFC calls monitoring is too technical for warehouse management users.

Been there, done that several times - exactly this proven way

Best regards

Dominik Tylczynski

k_sood
Active Participant
0 Likes

Hi 3a9e4ce873a94034b33dc62b0ce600ee ,

Thanks for your Inputs.

1. The enhancement spot , that I used is just after the call to this user exit. so I Don't think, there is any difference because of that. Moreover , my requirement is to create the New Transfer order only at the second Confirmation and I did not find any field in the structure which is indicating which Confirmation it is. (may be there is any but I don't know.)

2. I am already using L_TO* function Modules, mistakenly written TR.

3. the reason I can't call in background task is that, the new transfer order should be created only if the confirmation is successful, if I call it as a background task it will be independent of the confirmation process. For me the only option is to call it in Update task. I did not try calling the function module in ''update task as separate unit'' . could that work ?

Best Regards

Ketan