This website is not affiliated with, sponsored by, or approved by SAP AG.

Assign HU to outbound delivery

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Assign HU to outbound delivery

Postby roortman » Mon May 23, 2011 4:44 am

Dear all,

I have created an unassigned HU with some materials in it...
Example:

PALLET 1000095436
BOX 35
MATNR JM5019 100 ea
BOX 36
MATNR JM5019 100 ea

This is just an unassigned HU sitting in an IM environment (which is not HU managed)...

Now I have an outbound delivery which I have fully picked.
This outbound delivery contains 200 ea for this material.

So normally I would go to packing, and manually assign the pallet HU number, which works fine...

Now I need this done via a function module due to business requirement, but I can't get any function module to work.
Does anybody have an example with this programmed? Surely more people done this, but I can't get it to work, nor can I find any decent post on SDN or wherever about this.

Thanks a lot in advance.
roortman
 
Posts: 221
Joined: Wed Sep 13, 2006 4:14 am

Re: Assign HU to outbound delivery

Postby SHS » Mon May 23, 2011 8:06 am

Hi,

check the following code... all I do is assign one (or more) HU to a delivery.

Please note, I have left out some code for readability.
E.g., before the function module is executed there is an enqueue-check, and the returncode of the function module is checked as well.
But this should work:

Code: Select all
  LOOP AT li_vbeln ASSIGNING <lwa_vbeln>.

    lwa_verko-exidv = <lwa_vbeln>-exidv.
    lwa_verko-vhilm = <lwa_vbeln>-vhilm.
    INSERT lwa_verko INTO TABLE li_verko.

    AT END OF vbeln.

      CALL FUNCTION 'SD_DELIVERY_UPDATE_PACKING'
        EXPORTING
          delivery            = <lwa_vbeln>-vbeln
          commit              = 'X'
          synchron            = 'X'
        TABLES
          verko_tab           = li_verko
          verpo_tab           = li_verpo
          prot                   = li_prott
        EXCEPTIONS
          update_not_possible = 1
          OTHERS              = 2.

    ENDAT.

  ENDLOOP.
SHS
 
Posts: 483
Joined: Mon Mar 06, 2006 3:57 am

Re: Assign HU to outbound delivery

Postby roortman » Mon May 23, 2011 8:57 am

Hi SHS,

Thanks for you quick reply.. Just one question though.
In this coding, are you generating a HU number or actually assigning an existing one?

Because in the code you sent me your only using EXIDV & VHILM field in the VERKO table, and don't fill the VERPO and PROTT table correct?

Thanks again!

p.s. and maybe you data definition of the structures involved might come in handy too :-)
roortman
 
Posts: 221
Joined: Wed Sep 13, 2006 4:14 am

Re: Assign HU to outbound delivery

Postby SHS » Tue May 24, 2011 2:05 am

Hi,

data definition is easy:

Code: Select all
      li_verko      TYPE TABLE OF verko,
      li_verpo      TYPE TABLE OF verpo,
      li_prott      TYPE TABLE OF prott,


I use an existing HU number, the code I sent is implemented in a user exit of an inbound TO Idoc and the HU number is supplied in that Idoc (in a z-segment).

li_verpo is not filled, li_prott is filled by the function module if something goes wrong.

Good luck :-)
SHS
 
Posts: 483
Joined: Mon Mar 06, 2006 3:57 am

Re: Assign HU to outbound delivery

Postby roortman » Tue May 24, 2011 2:26 am

mmm I figured indeed that it would work like that.
In that case, I'm still getting the same error message that i got before...

see below my version of the code; (there is some crap in it from previous tests...)

Code: Select all
DATA: it_verko TYPE TABLE OF verko,
      ls_verko TYPE verko,
      it_verpo TYPE TABLE OF verpo,
      it_prot TYPE TABLE OF prott,
      lv_vbeln TYPE likp-vbeln,
      lv_exidv TYPE vekp-exidv.
CONSTANTS: cn_exidv TYPE vekp-exidv VALUE '00000000001000095812',  "using constants for just a test
                   cn_vbeln TYPE likp-vbeln VALUE '0090000669'.                      "using constants for just a test

lv_vbeln = cn_vbeln.
lv_exidv = cn_exidv.

REFRESH: it_prot, it_verpo.
SELECT SINGLE exidv vhilm FROM vekp INTO CORRESPONDING FIELDS OF ls_verko
      WHERE exidv EQ lv_exidv.
APPEND ls_verko TO it_verko.

CALL FUNCTION 'SD_DELIVERY_UPDATE_PACKING'
  EXPORTING
    delivery            = cn_vbeln
    commit              = 'X'
    synchron            = 'X'
  TABLES
    verko_tab           = it_verko
    verpo_tab           = it_verpo
    prot                = it_prot
  EXCEPTIONS
    update_not_possible = 1
    OTHERS              = 2
.


So to explain more... I have 1 pallet HU (00000000001000095812) and in that pallet there are 2 boxes, and in those 2 boxes there is 2 materials.

0 PALLET
1 BOX
2 JM5019 (MATNR)
1 BOX
2 JM5019 (MATNR)

As you can see above, I think it is filling up the table correctly, at least same as yours.
In our Z-transaction, we have picked the delivery (IM so not TO's) and now we need to add the pallet HU (including the boxes ofcourse) to the delivery.

But when doing this I receive the following error;

There is already a handling unit 1000095812 posted for GR without stock
Message no. HUSELECT005

Diagnosis
Handling unit 1000095812 already exists in the system with the status 'Posted for GI without stock information (at a non-HU storage location)'.

Procedure
Check whether the existing handling unit can be deleted or assign a new number to the current handling unit to ensure that both handling units can be clearly identified.


Any ideas?

And again, thank you very much for your help..
roortman
 
Posts: 221
Joined: Wed Sep 13, 2006 4:14 am

Re: Assign HU to outbound delivery

Postby SHS » Tue May 24, 2011 4:20 am

No sorry :(

My situation is probably a lot easier, as there are no actual contents in the HU.
Its just a number we assign to the delivery.
SHS
 
Posts: 483
Joined: Mon Mar 06, 2006 3:57 am

Re: Assign HU to outbound delivery

Postby stjacqd » Wed Sep 14, 2011 9:42 am

Hello roortman

Have you found a solution to your problem?

I have a similar problem.

I have 1 pallet containing boxes where those one are containing items.

I am using the BAPI_HU_CREATE to create the HU but the pallet section is not created into the delivery.

The boxes are created properly, containing the items but the pallet is not created.

Regards
stjacqd
stjacqd
 
Posts: 252
Joined: Tue Oct 22, 2002 9:10 am
Location: Montreal, Qc, Canada

Re: Assign HU to outbound delivery

Postby Havliczech » Wed Mar 19, 2014 8:45 am

Hi folks,

Just for others fighting this kind of problem. You can take inspiration at http://havliczech.blogspot.de/2014/03/how-to-pack-delivery-x-hus-by-abap.html
Havliczech
 
Posts: 1
Joined: Wed Mar 19, 2014 8:35 am


Return to ABAP

Who is online

Users browsing this forum: No registered users and 7 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.