Skip to Content
0

User exit after saving HUMO

Jun 15, 2017 at 12:46 PM

107

avatar image

Hi experts,

Is there any userexit or enhancement after saving handling unit in transaction HUMO? The user wants to sabe some data in a Z table after saving.

Thanks a lot,

María

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Maria Merino Jun 23, 2017 at 09:30 AM
0

I solved it by using:

function BAPI_HU_GETLIST to get HU details. Then I fill the fields I need to change:

LOOP AT li_huheader ASSIGNING <lfs_huheader>.
MOVE-CORRESPONDING <lfs_huheader> TO lw_huheader.
ls_new_values-hdl_unit_itid = lw_huheader-hu_id.
ls_new_values-hdl_unit_exid = lw_huheader-hu_exid.
IF p_data-laeng IS NOT INITIAL.
ls_new_values-field_name = 'LAENG'.
ls_new_values-field_value = p_data-laeng.
APPEND ls_new_values TO lt_new_values.
ENDIF.
IF p_data-breit IS NOT INITIAL.
ls_new_values-field_name = 'BREIT'.
ls_new_values-field_value = p_data-breit.
APPEND ls_new_values TO lt_new_values.
ENDIF.
IF p_data-hoehe IS NOT INITIAL.
ls_new_values-field_name = 'HOEHE'.
ls_new_values-field_value = p_data-hoehe.
APPEND ls_new_values TO lt_new_values.
ENDIF.
IF p_data-ntgew IS NOT INITIAL.
ls_new_values-field_name = 'NTGEW'.
ls_new_values-field_value = p_data-ntgew.
APPEND ls_new_values TO lt_new_values.
ENDIF.
IF p_data-brgew IS NOT INITIAL.
ls_new_values-field_name = 'BRGEW'.
ls_new_values-field_value = p_data-brgew.
APPEND ls_new_values TO lt_new_values.
ENDIF.
IF p_data-btvol IS NOT INITIAL.
ls_new_values-field_name = 'BTVOL'.
ls_new_values-field_value = p_data-btvol.
APPEND ls_new_values TO lt_new_values.
* lw_huheader-total_vol = p_data-btvol.
ENDIF.
IF p_data-palet_exp IS NOT INITIAL.
ls_new_values-field_name = 'VHILM'.
ls_new_values-field_value = p_data-palet_exp.
APPEND ls_new_values TO lt_new_values.
* lw_huheader-total_vol = p_data-btvol.
ENDIF.

ls_hu-exidv = p_data-exidv.
APPEND ls_hu TO lt_hus.

ls_flags-no_db_select = ' '.
ls_flags-lock_hu = 'X'.
ls_flags-add_and_exp = 'X'.
APPEND ls_object TO lt_objects.

CALL FUNCTION 'V51P_FILL_GT'
EXPORTING
is_flags = ls_flags
it_hus = lt_hus
IMPORTING
ef_rcode = lf_rcode
et_vekp = lt_header
et_vepo = lt_items
et_vevw = lt_history
et_highest_level = lt_high
et_messages = et_messages
EXCEPTIONS
hu_locked = 01
no_hu_found = 02
OTHERS = 99.

CALL FUNCTION 'HU_HEADER_UPDATE'
EXPORTING
it_new_values = lt_new_values
IMPORTING
et_messages = t_messages
EXCEPTIONS
not_possible = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'HU_PACKING_UPDATE'
EXPORTING
if_synchron = 'X'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.

ENDLOOP.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jun 15, 2017 at 01:18 PM
0

Use BADI BADI_HU_SAVE.

Thanks

Anand

Share
10 |10000 characters needed characters left characters exceeded