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: 

BAPI_HU_CREATE is not updating VEKP

0 Kudos

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

5 REPLIES 5

SimoneMilesi
Active Contributor
0 Kudos

Check the help for that bapi, you are missing INIT_STATUS

Example


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

0 Kudos

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



0 Kudos

What do you have in Return?

0 Kudos

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

0 Kudos

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.