Skip to Content
avatar image
Former Member

Is there any BAPI or Function module to update Standard field 'EPC1' of table VEKP

There is requirement like, in VL02N when the Material is packed into any handling unit it should display pop-up asking to enter a number ,and that number should get saved in the field EPC1 according to handling unit.Secondly when the user clicks on empty button,the material is unpacked and the number which got saved while packing should get deleted from the field EPC1.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 08, 2014 at 06:02 PM

    Hi Bhavika,

    Hu header VEKP table cannot be updated directly.

    There are 4 FM's to be called together(one after other) to achieve it. viz.

    HU_PACKING_REFRSH

    V51P_FILL_GT

    HU_HEADER_UPDATE

    HU_PACKING_UPDATE

    Please find below my code where i tried to update VEGR1 and VEGR2 field

    /* Populate the tables required to pass to the FM.

    READ TABLE gt_huheader INTO gw_huheader WITH KEY hu_exid = gw_alvhu-exidv.

    IF sy-subrc = 0.

    lw_hu-exidv = gw_alvhu-exidv.

    APPEND lw_hu TO lt_hus.

    lw_flags-no_db_select = ' '.

    lw_flags-lock_hu = 'X'.

    lw_flags-add_and_exp = 'X'.

    APPEND lw_object TO lt_objects.

    lw_new_values-hdl_unit_itid = gw_huheader-hu_id. " Internal Handling Unit Number

    lw_new_values-hdl_unit_exid = gw_huheader-hu_exid. " External Handling Unit Identification

    lw_new_values-field_name = 'VEGR1'. " Field name of changed field

    lw_new_values-field_value = gw_alvhu-pci . " Value of field to be changed

    APPEND lw_new_values TO lt_new_values.

    lw_new_values-hdl_unit_itid = gw_huheader-hu_id. " Internal Handling Unit Number

    lw_new_values-hdl_unit_exid = gw_huheader-hu_exid. " External Handling Unit Identification

    lw_new_values-field_name = 'VEGR2'. " Field name of changed field

    lw_new_values-field_value = gw_alvhu-load . " Value of field to be changed

    APPEND lw_new_values TO lt_new_values.

    /*Call the FM in sequence

    CALL FUNCTION 'HU_PACKING_REFRESH'.

    IF lt_hus[] IS NOT INITIAL.

    CALL FUNCTION 'V51P_FILL_GT'

    EXPORTING

    is_flags = lw_flags

    it_hus = lt_hus

    IMPORTING

    ef_rcode = lv_rcode

    et_vekp = lt_header

    et_vepo = lt_items

    et_vevw = lt_history

    et_highest_level = lt_high

    et_messages = lt_messages_hu

    EXCEPTIONS

    hu_locked = 01

    no_hu_found = 02

    OTHERS = 99.

    ENDIF.

    IF lt_new_values IS NOT INITIAL.

    CALL FUNCTION 'HU_HEADER_UPDATE'

    EXPORTING

    it_new_values = lt_new_values

    IMPORTING

    et_messages = lt_messages

    EXCEPTIONS

    not_possible = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE e018 WITH gw_huheader-hu_exid.

    else.

    CALL FUNCTION 'HU_PACKING_UPDATE'

    EXPORTING

    if_synchron = 'X'.

    ENDIF.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 08, 2014 at 02:54 PM

    Hi Bhavika,

    Use HU_HEADER_UPDATE function module.

    data : lt_changed TYPE hum_update_header_t,
    ls_changed TYPE hum_update_header,

    ls_changed-hdl_unit_exid = vekp_tab-exidv.

    ls_changed-field_name = 'EPC1'.
    ls_changed-field_value = <value>

    APPEND ls_changed TO lt_changed.


    CALL FUNCTION 'HU_HEADER_UPDATE'
    EXPORTING
    it_new_values = lt_changed
    IMPORTING
    et_messages = lt_messages
    EXCEPTIONS
    not_possible = 1
    OTHERS = 2.


    For packing you can fill the field_value and for unpacking you can clear the field_value before calling the function module.


    Hopes this helps you.


    Thanks,

    Ashok.

    Add comment
    10|10000 characters needed characters exceeded