cancel
Showing results for 
Search instead for 
Did you mean: 

Transportation Unit - Check In and Check Out

julian_wiesmann
Explorer
0 Kudos

Hi all,

we created a new function for outbound delivery orders in warehouse management monitor.

The user can select outbound deliveries and execute a check in and a check out for the assigned transportation units.

I created a class with the code below. The check in and check out works. But after that the transportation has the red status "Assigned object was changed".

Did I miss something in my code?

Thank you in advance.

Best regards

Julian

DATA(lt_tudlv) = me->get_assigned_tus( it_data ).

<br>LOOP AT lt_tudlv ASSIGNING FIELD-SYMBOL(<ls_tudlv>).

<br>me->check_in_out(<br>i_tu_num = <ls_tudlv>-tu_num<br>i_act_num = <ls_tudlv>-tu_sr_act_num<br>i_act = wmesr_act_check_in<br>i_chkpt = l_check_pnt<br>).

<br>me->check_in_out(<br>i_tu_num = <ls_tudlv>-tu_num<br>i_act_num = <ls_tudlv>-tu_sr_act_num<br>i_act = wmesr_act_check_out<br>i_chkpt = l_check_pnt<br>).

<br>ENDLOOP.

METHOD check_in_out.<br>DATA: lo_bom TYPE REF TO /scwm/cl_sr_bom,<br>lo_bom_tu TYPE REF TO /scwm/cl_sr_bo_tu,<br>ls_tu_data  TYPE        /scwm/s_bo_tu_data.

<br>lo_bom = /scwm/cl_sr_bom=>get_instance( ).<br>lo_bom->refresh( ).<br>lo_bom_tu = lo_bom->get_bo_tu_by_key( EXPORTING is_tu_sr_act_num = VALUE #( tu_num = i_tu_num tu_sr_act_num = i_act_num ) ).<br>lo_bom_tu->get_data( IMPORTING es_bo_tu_data = ls_tu_data ).

<br>/scwm/cl_sr_tm=>tm( ).

<br>lo_bom_tu->cico(<br>iv_lgnum = me->mv_lgnum<br>iv_chkpt = i_chkpt<br>iv_act = i_act<br>).

<br>lo_bom->save( ).<br>/scwm/cl_sr_tm=>tm( ).

<br>COMMIT WORK AND WAIT.

<br>ENDMETHOD.

Accepted Solutions (0)

Answers (3)

Answers (3)

Daniil
Active Contributor

Hi Julian,

check if PPF in the transportation unit is not executed, it should perform synchronisation I guess.

julian_wiesmann
Explorer
0 Kudos

Hi Daniil,

if I perform the check in and check out manually, there is no PPF action. It seems like the PPF action is not necessary. The status of the transportation unit is okay ("Assigned object was not changed").

When I execute our custom function for check in and check out, a PPF action is created but leads to the the error "Action is not permitted for object and state". I don´t know why the PPF action is created in this case but not for the manual check in and check out.

Do you maybe have another idea?

Thank you.

Best regards

Julian

julian_wiesmann
Explorer
0 Kudos

Hi Daniil,

thanks for the feedback.

I changed the code according to your suggestion but unfortunately this didn´t solve the problem.

Best regards,

Julian

Daniil
Active Contributor
0 Kudos

Hi Julian, maybe it is a still something like a delivery synchronisation or something like this.

Could you maybe add "wait up to 10 seconds." between check in and check out of the TU, just to test it?

I guess it is because PPF is planned and it is not able to do synchronisation. But it is just a guess 🙂

Or you can try maybe execute one part, and check if it works well. and after restart tcode and execute other part. just to see if one step works.

and I just rechecked maybe you can return back /scwm/cl_sr_tm=>tm( ). I just found that it is used together with

Here one more version as in standard:

METHOD check_in_out.
	DATA: lo_bom TYPE REF TO /scwm/cl_sr_bom,
	lo_bom_tu TYPE REF TO /scwm/cl_sr_bo_tu,
	ls_tu_data  TYPE        /scwm/s_bo_tu_data.

	lo_bom = /scwm/cl_sr_bom=>get_instance( ).
	lo_bom->refresh( ).
	lo_bom_tu = lo_bom->get_bo_tu_by_key( EXPORTING is_tu_sr_act_num = VALUE #( tu_num = i_tu_num tu_sr_act_num = i_act_num ) ).
	lo_bom_tu->get_data( IMPORTING es_bo_tu_data = ls_tu_data ).
	
	/scwm/cl_sr_tm=>tm( ).

	lo_bom_tu->cico(
	iv_lgnum = me->mv_lgnum
	iv_chkpt = i_chkpt
	iv_act = i_act
	).

	 /scwm/cl_sr_tm=>tm( ). " called in standard before SAVE, even would be called in SAVE as well

	lo_bom->save( ).

	COMMIT WORK AND WAIT.
	/scwm/cl_tm=>cleanup( iv_lgnum = me->mv_lgnum ).

ENDMETHOD.
julian_wiesmann
Explorer
0 Kudos

Hi Daniil,

thank you for the ideas.

But unfortunately it still doesn´t work.

What I don´t understand is why the PPF is performed when I execute our Z code, but not when I perform check in and check out manually via transportation unit.

Best regards

Julian

Daniil
Active Contributor
0 Kudos

Hi Julian,

try to replace /scwm/cl_sr_tm=>tm( ) with /scwm/cl_tm=>cleanup( iv_lgnum = me->mv_lgnum )

METHOD check_in_out.
	DATA: lo_bom TYPE REF TO /scwm/cl_sr_bom,
	lo_bom_tu TYPE REF TO /scwm/cl_sr_bo_tu,
	ls_tu_data  TYPE        /scwm/s_bo_tu_data.

	lo_bom = /scwm/cl_sr_bom=>get_instance( ).
	lo_bom->refresh( ).
	lo_bom_tu = lo_bom->get_bo_tu_by_key( EXPORTING is_tu_sr_act_num = VALUE #( tu_num = i_tu_num tu_sr_act_num = i_act_num ) ).
	lo_bom_tu->get_data( IMPORTING es_bo_tu_data = ls_tu_data ).

	/scwm/cl_tm=>cleanup( iv_lgnum = me->mv_lgnum ). " not sure here but you can do it
*	/scwm/cl_sr_tm=>tm( ).

	lo_bom_tu->cico(
	iv_lgnum = me->mv_lgnum
	iv_chkpt = i_chkpt
	iv_act = i_act
	).


	lo_bom->save( ).
*	/scwm/cl_sr_tm=>tm( ). " No needed from my PoV

	COMMIT WORK AND WAIT.
	/scwm/cl_tm=>cleanup( iv_lgnum = me->mv_lgnum ).

ENDMETHOD.

BR,

Daniil