on 2019 Jun 05 3:45 PM
Greetings Experts,
I was asked to check a client program that help transferring goods using the BAPI BAPI_GOODSMVT_CREATE, but for some reason is failing, even though this is a copy of another program that works perfectly using the same BAPI but in that case for “Goods issue”, I was wondering if maybe we are filling the data incorrectly or we could be missing some key data, this is the current logic the program is executing:
REFRESH: lti_goodsmvt_item.
lwa_goodsmvt_header-gr_gi_slip_no = gwa_movimiento_im-no_documento.
LOOP AT im_o_md->gwa_ajuste_inventario-movimientos[]
ASSIGNING FIELD-SYMBOL(<fs_movimiento>) ##NEEDED "#EC CI_CALLTA
WHERE no_documento = gwa_movimiento_im-no_documento.
CLEAR: lv_fecha.
lv_fecha = <fs_movimiento>-fecha_movimiento.
CONDENSE lv_fecha NO-GAPS.
lwa_goodsmvt_header-pstng_date = lv_fecha+0(8).
CLEAR: lv_fecha.
lv_fecha = <fs_movimiento>-fecha_movimiento.
CONDENSE lv_fecha NO-GAPS.
lwa_goodsmvt_header-doc_date = lv_fecha+0(8).
lwa_goodsmvt_header-header_txt = <fs_movimiento>-no_transferencia_alpina.
CLEAR: lwa_goodsmvt_item, gv_flag.
READ TABLE gtd_materiales INTO DATA(lwa_materiales) WITH KEY material_ean = <fs_movimiento>-material_ean.
IF sy-subrc = 0.
lwa_goodsmvt_item-material = lwa_materiales-descripcion.
lwa_goodsmvt_item-move_mat = lwa_materiales-descripcion.
ENDIF.
READ TABLE gtd_causal INTO DATA(lwa_causal) WITH KEY causal = <fs_movimiento>-causal.
IF sy-subrc = 0.
lwa_goodsmvt_item-move_type = lwa_causal-no_documento.
lwa_goodsmvt_item-move_reas = lwa_causal-no_transferencia_alpina.
ENDIF.
CONVERT TIME STAMP <fs_movimiento>-fecha_vencimiento TIME ZONE sy-zonlo INTO DATE lwa_goodsmvt_item-expirydate.
CLEAR: lwa_homo_werks.
READ TABLE lti_homo_werks INTO lwa_homo_werks WITH KEY zwerkslr = <fs_movimiento>-org_origen.
READ TABLE ltd_causal INTO DATA(lwa_causal_1) WITH KEY casual = <fs_movimiento>-causal.
IF sy-subrc = 0.
IF <fs_movimiento>-org_destino = space.
CASE lwa_causal_1-devol.
WHEN 'X'.
lwa_goodsmvt_item-plant = lwa_homo_werks-zwerksd.
lwa_goodsmvt_item-stge_loc = lwa_homo_werks-zlgortd.
lwa_goodsmvt_item-move_plant = lwa_homo_werks-zwerkso.
lwa_goodsmvt_item-move_stloc = lwa_homo_werks-zlgorto.
WHEN OTHERS.
lwa_goodsmvt_item-plant = lwa_homo_werks-zwerksd.
lwa_goodsmvt_item-stge_loc = lwa_homo_werks-zlgortd.
ENDCASE.
ELSE.
lwa_goodsmvt_item-plant = lwa_homo_werks-zwerksd.
lwa_goodsmvt_item-stge_loc = lwa_homo_werks-zlgortd.
CLEAR: lwa_homo_werks.
READ TABLE lti_homo_werks INTO lwa_homo_werks WITH KEY zwerkslr = <fs_movimiento>-org_destino.
lwa_goodsmvt_item-move_plant = lwa_homo_werks-zwerksd.
lwa_goodsmvt_item-move_stloc = lwa_homo_werks-zlgortd.
ENDIF.
ENDIF.
READ TABLE lti_t001k INTO lwa_T001k WITH KEY bwkey = lwa_goodsmvt_item-plant
lv_bukrs = lwa_T001k-bukrs.
CLEAR: lv_param_id, lv_bukrs.
lv_param_id = 'LOTE'.
CLEAR: lwa_parameters, lv_sysubrc.
zcl_bc_parameters=>get_parameter( "#EC CI_SEL_NESTED or "#EC CI_SROFC_NESTED
EXPORTING
im_v_wricef = 'IM_LOTELR'
im_v_id = lv_param_id
im_v_bukrs = lv_bukrs
IMPORTING
ex_wa_param = lwa_parameters
ex_v_subrc = lv_sysubrc ).
IF lwa_parameters-valor <> space.
lwa_goodsmvt_item-batch = lwa_parameters-valor.
lwa_goodsmvt_item-move_batch = lwa_parameters-valor.
ENDIF.
lwa_goodsmvt_item-entry_qnt = <fs_movimiento>-cantidad.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT' ##FM_SUBRC_OK
EXPORTING
input = <fs_movimiento>-unidad_medida
language = sy-langu
IMPORTING
output = lwa_goodsmvt_item-entry_uom
EXCEPTIONS
unit_not_found = 1
OTHERS = 2.
APPEND lwa_goodsmvt_item TO lti_goodsmvt_item.
ENDLOOP.
REFRESH: lti_return.
CLEAR: lv_materialdocument, lv_matdocumentyear.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = lwa_goodsmvt_header
goodsmvt_code = '04'
IMPORTING
materialdocument = lv_materialdocument
matdocumentyear = lv_matdocumentyear
TABLES
goodsmvt_item = lti_goodsmvt_item
return = lti_return.
If we execute it in a test run, it works perfectly, the return table is empty and it seems like it was a success, but if we do a real run, then we get the following error message “VL581 - Assign a goods receiving point to the inbound delivery”, I’m not entirely sure what to do with said error, maybe we are missing some key data in the BAPI or the system is lacking some sort of configuration, but the user tell us he can manually create this transfer in the transaction MIGO without issues.
I manage to track said error in this INCLUDE “FV50XF0B_INB_DELIV_REC_POINT_C” for program “SAPMV50A”, it seems like is related to the table LIKP, but not sure why is it assigning that data in this case.
Any help would be greatly appreciated.
Additional information:
The example that we are checking is using the movement type “301”, maybe that could be affecting the BAPI behavior
Request clarification before answering.
Hi,
I think system try to assine good receiving point. Before assign the goods receiving point, you must define the plant and storage location. You will find information on this in the structure maintenance of the enterprise structure, where plants and storage locations in the general logistics and materials management areas are defined.
Regards,
Nawa.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try to google the error with "SAP ERROR VL581"?
You can see it should be raised if you have WM active on the warehouse where you are receiving the goods.
WM, in this case, needs a Receiving point to allocate the materials.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for you comment Simone, the thing is I’m mostly a programmer and I’m kind of new to this module, so I’m not familiar with warehouse configuration, I did search for the error as you mention, but I can’t find were said “receiving point” can be configure, is that a specific part of the warehouse? Maybe the one we are using is currently lacking that data
Hi ronald.cadena,
Ask your MM referent if the warehouses are under WM or check in customizing like explained here: if so, you cannot move materials with the BAPI, but you have to create a Transfer Order between them (FMs L_TO_*) and confirm them if autoconfirm is not active.
User | Count |
---|---|
99 | |
15 | |
10 | |
8 | |
5 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.