2013 Jun 27 3:01 PM
In my program I have a requirement to delete assignment which is done through VL02n
Following are the steps followed:
1. Enter the outbound delivery no. in VL02n
2. Click on Pack button
3. In Pack Material tab, select all Handling Units and click Delete assignment button.
I want this functionality to be written in my program. I debugged and found the FM V51P_DELETE_RELATIONSHIP.
Following is my code:
CALL FUNCTION 'V51P_DELETE_RELATIONSHIP'
EXPORTING
if_control = 'X'
it_hus = lt_venum "table which contains all the Internal HU number associated with the delivery
IMPORTING
et_new_hus = lt_hus
et_messages = lt_messages
EXCEPTIONS
fatal_error = 1
OTHERS = 2.
But this doesn't help. Is there any other steps that are supposed to be followed after this or should I use a different FM?
Please give inputs on this...
2013 Jun 27 3:08 PM
2013 Jun 27 3:44 PM
Thanks for the quick reply. BAPI_HU_DELETE_FROM_DEL will delete the Handling Units, but to my requirement Handling units need to be only deassigned from the delivery.
2013 Jun 27 6:32 PM
Hi Rajan,
CALL FUNCTION 'V51P_DELETE_RELATIONSHIP'
EXPORTING
if_control = 'X'
it_hus = lt_venum "table which contains all the Internal HU number associated with the delivery
IMPORTING
et_new_hus = lt_hus
et_messages = lt_messages
EXCEPTIONS
fatal_error = 1
OTHERS = 2.
Is the above code giving some error? If not then maybe changes would be happening but not getting written to DB, so try calling BAPI_TRANSACTION_COMMIT after this FM.
BR.
2013 Jul 01 11:34 AM
The code populates lt_messages with message "Handling unit is packed - only entire HUs can be reassigned" for all the HUs (but sy-subrc = 0).The same error I get while doing manually through VL02n also, but I can still go back and save the changes which results in all the handling units getting deassigned from the delivery.
I have BAPI_TRANSACTION_COMMIT too after this, but no effect.
2013 Jul 01 6:19 PM
Hi Raja,
I am afraid that you cannot achieve this requirement with BAPI because BAPIs simulate the transaction behavior and if you cannot do directly via transaction then BAPIs would also fail to do so. May be you need to check some configuration which might be preventing you deassigning. This is just a guess.
BR.
2013 Jul 03 8:43 AM
Thanks Ankit for the suggestion. Let me check the configuration and see if that is the issue.
2014 Nov 14 4:22 PM
Hi Raja,
Did you ever solve this issue?
I have the same requirement and have the same error: Handling unit &1 is packed - only entire HUs can be reassigned in FM.
This is the same error that comes in VL02N but in the standard it shows the error and then REMOVES the assignments.
Please share your solution!
Regards,
Fernanda
2015 Dec 03 2:50 PM
2015 Dec 03 5:16 PM
Hi RajaRajan,
Did you try to use 'BAPI_HU_CHANGE_HEADER'? I used this function module to assign HU to delivery, so I'm pretty sure that it should work for unassignment as well (try to clear PACK_MAT_OBJ and PACK_MAT_OBJ_KEY in HUCHANGED structure).
Cheers,
Kirill