12-16-2014 9:33 AM
Hi all,
I need to Pack Deliveries. So I am using BAPI_HU_CREATE to create Handling Units with my own External Handling Unit Identification number(HU_EXID). It is generating an Internal number(HU_ID) but not updating in VEKP table. so I used commit after that but still not woking. Please give me your suggestions.
My code is :
wa_header-PACK_MAT = 'XXXX'.
CALL FUNCTION 'BAPI_HU_CREATE'
EXPORTING
HEADERPROPOSAL = WA_HEADER
IMPORTING
HUHEADER = WA_HUHEADER
HUKEY = WA_HUKEY
TABLES
RETURN = LT_RETURN.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = C_X.
Thanks in advance.
Regards,
Raghu
12-16-2014 9:44 AM
Check the help for that bapi, you are missing INIT_STATUS
Example 1:
Creating a non-assigned handling unit with packaging material PALLET with a "Planned HU" physical status:
HEADERPROPOSAL: pack_mat = 'PALETTE'
hu_status_init = 'A'.
Example 2:
Following access of the above method (example 1), the return parameter HUKEY returns the ID of the handling unit that was created in the KEY = ID1 field. To pack the handling unit that was just created in another handling unit, call up the BAPI_HU_CREATE method again with the following import parameters:
IHEADERPROPOSAL: pack_mat = 'CONTAINER'
ITEMPROPOS AL: hu_item_type = '3'
lower_level_key = ID1
12-16-2014 10:13 AM
Thanks Simone,
I have tried with the HU_STATUS_INIT. though it is generating Internal number not updating VEKP table.. so I've Updated that HU with elow code with the Delivery number...
* Assigning HU to delivery
HUHEADER-PACK_MAT_OBJECT = '01'. "Outbound delivery
HUHEADER-PACK_MAT_OBJ_KEY = P_VBELN. "Delivery no
CALL FUNCTION 'BAPI_HU_CHANGE_HEADER'
EXPORTING
HUKEY = HUKEY
HUCHANGED = HUHEADER
IMPORTING
HUHEADER = HUHEADER
TABLES
RETURN = RETURN.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
But, BAPI_HU_CHANGE_HEADER is returning empty HUHEADER. it is clearing everything that passed into it before.
Is ther any other ways to generate HU's. ?
Regards,
Raghu
12-16-2014 10:18 AM
12-16-2014 10:25 AM
It is returning an Information message with 'HU functions outside of the delivery only via unique number assignment'. Same for both BAPI's.
Regards,
Raghu
03-31-2021 12:59 PM
Hi Raghu,
I am facing the same problem ( BAPI_HU_CREATE is returning the key alongside the header data, but no record is to be found in VEKP. The BAPI_HU_CHANGE_HEADER also clears all the inputs. Both BAPI's return the same information message that you had) - did you manage to solve the issue?
My main goal is to pack the materials in outbound delivery using the flow of:
1. BAPI_HU_CREATE (Create HU)
2. BAPI_HU_CHANGE_HEADER (Bind HU with delivery)
3. WS_DELIVERY_UPDATE (Update the delivery with HU bound items) - returns the error of HUGENERAL 099 - I think this might be because of the missing records in VEKP..
Regards,
Mario
Edit: Problem solved by checking the 'HU ID unique' flag in the view V_TVSHP_HU.