on 04-27-2015 12:06 PM
Hello all,
I'm creating a new Handling Unit using the BAPI : bapi_hu_create, when I'm
doing so, the system creates a HU with wanted quantity in the base unit of material.
The base unit of my item is not KG but each unit of item (each carton) have different weight
that is different from what is mention in the master data (MM03).
How can I update the real weight of each item in this handling unit during it's building process
or right after commit of this process ?
Thank you,
Kind Regards,
Amit Berku
Did you solve it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved it in another way, did not update the bruto as I wanted
did it in the following way :
ls_newvalues-hdl_unit_itid = lv_venum.
ls_newvalues-hdl_unit_exid = lv_exidv.
ls_newvalues-field_name = 'NTGEW'.
ls_newvalues-field_value = IN_NTGEW.
APPEND ls_newvalues TO lt_newvalues.
ls_newvalues-hdl_unit_itid = lv_venum.
ls_newvalues-hdl_unit_exid = lv_exidv.
ls_newvalues-field_name = 'BRGEW'.
ls_newvalues-field_value = IN_BRGEW.
APPEND ls_newvalues TO lt_newvalues.
CALL FUNCTION 'HU_HEADER_UPDATE'
EXPORTING
it_new_values = lt_newvalues
IMPORTING
et_messages = lt_return
EXCEPTIONS
not_possible = 1
OTHERS = 2.
IF sy-subrc <> 0.
raise HU_HEADER_UPDATE_FAILED.
return.
ENDIF.
CALL FUNCTION 'HU_PACKING_UPDATE'
EXPORTING
if_synchron = 'X'.
can you please elaborate with an example what is your expectation from BAPI_HU_CREATE along with the input data and screenshot of base & wm unit of measure which is maintained in the WM view (if possible)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I'm using the followin code :
...
thead-pack_mat = '000000000000000016'.
ENDIF.
thead-stge_loc = gv_twhs.
thead-total_wght = total_brw_weight.
thead-load_wght = total_net_weight.
thead-tare_wght = gv_ctara + total_car_tara.
thead-wght_vol_fix = 'X'.
thead-hu_grp4 = carton_count." t_mutsarim-quantity.
SHIFT thead-hu_grp4 LEFT DELETING LEADING ' '.
thead-ext_id_hu_2 = 'CAGEBUILDNEW'.
...
IF lin = 1 AND t_mutsarim-vrkme = 'KG'.
LOOP AT t_mutsarim.
tdet-hu_item_type = 1.
tdet-pack_qty = t_mutsarim-net_weight.
tdet-base_unit_qty = t_mutsarim-vrkme.
tdet-material = t_mutsarim-matnr.
tdet-plant = t_mutsarim-werks.
tdet-stge_loc = gv_fwhs.
tdet-expirydate = t_mutsarim-vfdat .
APPEND tdet.
ENDLOOP.
ELSE.
LOOP AT t_mutsarim.
tdet-hu_item_type = 1.
tdet-pack_qty = t_mutsarim-quantity.
tdet-base_unit_qty = t_mutsarim-vrkme.
PERFORM add_zero_to_matnr USING t_mutsarim-matnr CHANGING tdet-material.
tdet-plant = t_mutsarim-werks.
tdet-stge_loc = gv_fwhs.
tdet-expirydate = t_mutsarim-vfdat .
APPEND tdet.
ENDLOOP.
ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_HU_CREATE'
EXPORTING
headerproposal = thead
IMPORTING
huheader = t_created
hukey = hu
TABLES
itemsproposal = tdet
return = t_ret
EXCEPTIONS
error_message = 100.
IF NOT t_ret IS INITIAL OR sy-subrc NE 0 .
DATA l_ret LIKE LINE OF t_ret.
IF NOT t_ret IS INITIAL.
LOOP AT t_ret INTO l_ret.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT_LO'
EXPORTING
titel = text-002
textline1 = l_ret-message
start_column = 4
start_row = 7.
EXIT.
ENDLOOP.
ENDIF.
ELSE.
REFRESH t_ret .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = t_ret.
...
As you can see, I'm passing the weight values of header in the header structure,
If the base unit of product is KG, I can pass the weight of single material into the quantity field and if it's not KG, I must pass quantity of items to this same field.
After executing this full perform I'm able to see my HU in HUMO (or in hu02 by HU number), the quantities of all items in this HU are taken from code (or in other words from the executed program) and the weights are taken from master data fields (mara-brgew for bruto and mara-ntgew for neto) and in this process I don't have any chance to update the real weight of this single material in my HU, althow I have the data during the run of program,
I hope that I've answered all your question.
BTW, t_mustarim is an internal table that contains items data including quantities, dates, units and weights
Kind Regards,
Amit Berku
User | Count |
---|---|
97 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.