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: 

Function Modules to Unassign HU from a Outbound delivery from Vl02N Transaction WM system

Former Member
0 Kudos
4,113

Hi All,


I want to UNASSIGN (not delete) a handling unit from an outbound delivery. Is there any Function module or BAPI?  Please help.


I am Trying the following FM's, in this order:

1.  HU_PACKING_REFRESH - initialize internal HU data

2.  HU_GET_HUS - get HU numbers and initialize internal data

3.  V51P_DELETE_RELATIONSHIP - delete assingnment from delivery. Fill parameter it_hus with it_venum from previous FM

4.  HU_POST

Its removing the HU ( in all existing HU Table control ) but material and Quantity is not Reflecting (In Material to be Packed control )

Please let me know the function module if anybody has idea to un assign HU from delivery.


Thanks ,

Nagendra

2 REPLIES 2

Former Member
0 Kudos
999

Try calling WS_DELIVERY_UPDATE, Pass HU number to be unassigned in IT_REPACK (pass same HU number to both SOURCEHU and DESTHU) with PACK_QTY = 0.

former_member41806
Discoverer
0 Kudos
999

Hi, I had the same problem and this is the way I resolved.

Call this function module sequence.


CALL FUNCTION 'HU_GET_HUS'.


This function module load in memory some internal tables that are used in the next function.


CALL FUNCTION 'HU_GET_HUS'

       EXPORTING

         it_hus   = lt_hus

         it_venum = lt_ven.

     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.



**********************************************************************************

CALL FUNCTION 'V51P_DELETE_RELATIONSHIP'.


This function is the one that unassign the HU,it just need the VENUM.


CALL FUNCTION 'V51P_DELETE_RELATIONSHIP'

       EXPORTING

         if_control  = 'X'

         it_hus      = it_hus

       EXCEPTIONS

         fatal_error = 1

         OTHERS      = 2.

     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.



**********************************************************************************

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


Save the changes.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         wait = 'X'.



**********************************************************************************

CALL FUNCTION 'WS_DELIVERY_UPDATE'.


This function just need the  VBKOK_WA and DELIVERY.


CALL FUNCTION 'WS_DELIVERY_UPDATE'

       EXPORTING

         vbkok_wa                    = vbkok_wa

         synchron                    = 'X'

         commit                      = ' '

         delivery                    = wa_2100-vbeln

         nicht_sperren               = ' '

       IMPORTING

         ef_error_any_0              = ef_error_1

         ef_error_in_item_deletion_0 = ef_error_2

         ef_error_in_pod_update_0    = ef_error_3

         ef_error_in_interface_0     = ef_error_4

         ef_error_in_goods_issue_0   = ef_error_5

         ef_error_in_final_check_0   = ef_error_6

         ef_error_partner_update     = ef_error_7

         ef_error_sernr_update       = ef_error_8

       EXCEPTIONS

         error_message               = 1

         OTHERS                      = 2.



**********************************************************************************

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


Save the changes.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         wait = 'X'.


Remember before to do all this sequence you have to check if really the HU is empty.


I hope it works for you.