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: 

Automatic update of HU data in Outbound delivery

Former Member
0 Kudos
346

Hello all,

I would like to create an ABAP program to automatically update the HU data in an outbound delivery. The purpose is to have an excel spreadsheet with the HUs per delivery and download them into the outbound delivery without the need to use manual actions.

Does anybody know of a FUNCTION, BAPI, IDOC or anything else that may assist me in this task ?

Thanks,

Isaac

1 REPLY 1

Former Member
0 Kudos
73

Hi Issac,

Please check the below code for packing of HU. I have used the following Function Modules and it helped me.

clear l_packing_request.

l_PACKING_REQUEST-VENUM = st_hu-venum.

l_PACKING_REQUEST-VELIN = '1'.

l_PACKING_REQUEST-BELNR = st_hu-inhalt+0(10).

l_PACKING_REQUEST-POSNR = st_hu-inhalt+10(6).

l_PACKING_REQUEST-ALTME = st_hu-gewei.

if i_quantity is SUPPLIED.

l_PACKING_REQUEST-QUANTITY = i_quantity.

clear ls_wb_d.

loop at lt_wb_d into ls_wb_d

Where wbdg_docnum eq i_weighbridge_doc

and wbdg_item eq I_WEIGHBRIDGE_item.

endloop.

else.

if I_FL_WEIGHBRIDGE eq 'X'.

    • Weighbridge weight*

read table lt_wb_d into ls_wb_d index l_item_count.

l_PACKING_REQUEST-QUANTITY = ls_wb_d-VEH_LD_WEIGHT

- st_hu-tarag.

else.

    • Indicative weight*

l_PACKING_REQUEST-QUANTITY = st_hu-magew - st_hu-tarag.

endif.

if l_packing_request-quantity <= 0.

l_PACKING_REQUEST-QUANTITY = 0.

endif.

endif.

CALL FUNCTION 'HU_PACKING_AND_UNPACKING'

EXPORTING

IF_REPACK = ' '

IS_PACKING_REQUEST = l_packing_request

EXCEPTIONS

MISSING_DATA = 1

HU_NOT_CHANGEABLE = 2

NOT_POSSIBLE = 3

CUSTOMIZING = 4

WEIGHT = 5

VOLUME = 6

SERIAL_NR = 7

FATAL_ERROR = 8

OTHERS = 9.

case sy-subrc.

when 0.

when others.

message i999(zv) with 'Error while packing - return code' sy-subrc.

raise error_updating_hus.

endcase.

if I_FL_WEIGHBRIDGE eq 'X'.

CLEAR ls_changed.

ls_changed-changed_f = 'VEGR1'.

ls_changed-f_value = 'WGHBR'.

APPEND ls_changed TO l_changed_fields.

CALL FUNCTION 'V51F_HU_HEADER_UPDATE'

EXPORTING

if_with_update = 'X'

if_venum = st_hu-venum

it_changed_fields = l_changed_fields

EXCEPTIONS

not_found = 1

exidv_already_exist = 2

not_possible = 3

overloading_w = 4

overloading_v = 5

fatal_error = 6

OTHERS = 7.

IF sy-subrc <> 0.

raise error_updating_hus.

ENDIF.

endif.

CALL FUNCTION 'HU_PACKING_UPDATE'.

    • Update weighbridge table with delivery number now that it*

    • is packed, and the shipment number on the header level.*

if I_FL_WEIGHBRIDGE eq 'X'.

move:

sy-uname to ls_wb_h-changed_by,

sy-datum to ls_wb_h-changed_on,

i_shipment to ls_wb_h-tknum.

modify zvhwbdg from ls_wb_h.

move:

s_lips-vbeln to ls_wb_d-vbeln_dl,

s_lips-posnr to ls_wb_d-posnr_dl.

modify zvdwbdg from ls_wb_d.

endif.

commit work and wait.

Reward Points if it was useful for you.

Regards

Abhishek Raj.