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 to pack deliveries into HU's within shipment - please help

former_member182500
Contributor
0 Kudos

Hi,

Grateful if someone can help.

I have a shipment that can be viewed via the VTxxN transactions. The shipment has several deliveries in it. I want to emulate the packing of the deliveries into HU's (I have set up config to use external HU id numbers and will be using one of two packing material numbers) within VT02N (brown cardboard box icon) using a BAPI or fn module.

Im having difficulties with function module HU_PACKING_AND_UNPACKING which I thought was the one to use, but this fn module has a structure GS_HEADER51 which is populated when called from VT02N but of course its not populated when I test it or call from my code, and the contents of this structure are checked. After creating an enhancement to set up this structure, for testing purposes, I then find other structures that are not populated. It is going to get messy this way.

There are other BAPI's like BAPI_HU_PACK and BAPI_HU_CREATE but I dont believe these work with deliveries.

At the minimum I believe I need a BAPI that will accept the following four fields - delivery number, delivery item, HU id and packaging material number.

I dont want to write a CALL TRANSACTION calling VT02N as I need to pack HU's within containing HU's, so there will be multiple HUs to be packed - then I start having the difficulty of page up/page down screen control.

Would be great if someone with experience of this can help as Im stuck and really need to resolve this.

Kind regards in advance,

Jon-Paul.

4 REPLIES 4

former_member291353
Discoverer
0 Kudos

Hi Jon,

How do You solved this problem? Any idea how to implement this in other way?

Peter

former_member555112
Active Contributor
0 Kudos

Hi,

Basically the function module HU_PACKING_AND_UNPACKING also works.

You are correct that the global table GS_HEADER51 needs to be filled.


Basically understand that SAP fills the global table via a different function module.


So if you use HU_PACKING_AND_UNPACKING then you need to call the function module which fills the global data before it and then after that call FM HU_PACKING_AND_UNPACKING.


I do not have the system at the moment with me but you can get the function module in the same function group.


This is a common issue with the function module HU_PACKING_AND_UNPACKING.


Regards,

Ankur Parab

former_member555112
Active Contributor
0 Kudos

Hi

If you using "HU_PACKING_AND_UNPACKING"

then you need to call the FMs in below sequence.

* if your HU is shipment based then

call function 'RV_SHIPMENT_VIEW'

                 exporting

                   shipment_number       = lt_vttp-tknum

                   option_items          = lc_x

                   option_package_dialog = lc_x

                   option_partners       = lc_x

                 exceptions

                   not_found             = 1

                   no_authority          = 2

                   delivery_missing      = 3

                   delivery_lock         = 4

                   others                = 5.

               if sy-subrc <> 0.

*              PERFORM error_message_own.

                 exit.

               endif.

**refrech buffer

               call function 'HU_INITIALIZE_PACKING'.

**get HU details. this will fill the global tables.

               call function 'HU_GET_HUS'

                 exporting

                   if_lock_hus = 'X'

                   it_venum    = li_venum

                 importing

                   et_header   = li_header

                   et_items    = li_huitem

                 exceptions

                   hus_locked  = 1

                   no_hu_found = 2

                   fatal_error = 3

                   others      = 4.

               if sy-subrc <> 0.

                 exit.

               endif.


*

call function 'HU_PACKING_AND_UNPACKING'


and finally


call function 'HU_POST'





0 Kudos

Thank You Ankur Parab.

I was looking for working example. Great!