Hi,
I try to implement Goods Movement by using BAPI_GOODSMVT_CREATE. I try to do it over delivery number. So I use the following code. But somehow it returns "Order not found or not permitted for goods movement" error. I can do the same movement over MIGO transaction. But BAPI can not find the order. Do you have any idea? Do I miss a parameter o something?
Thanks.
data: begin of gmhead. include structure bapi2017_gm_head_01. data: end of gmhead. data: begin of gmcode. include structure bapi2017_gm_code. data: end of gmcode. data: begin of mthead. include structure bapi2017_gm_head_ret. data: end of mthead. data: begin of itab occurs 100. include structure bapi2017_gm_item_create. data: end of itab. data: begin of errmsg occurs 10. include structure bapiret2. data: end of errmsg. data: wmenge like iseg-menge, error_code(220) type C, temp_xchpf like mara-xchpf, sbatch like mseg-charg. DATA : temp_vbeln LIKE likp-vbeln. ************************************************************************ gmhead-pstng_date = sy-datum. gmhead-doc_date = sy-datum. gmhead-pr_uname = 'sy-uname. gmhead-VER_GR_GI_SLIP = '1'. gmhead-VER_GR_GI_SLIPX = 'X'. gmcode-gm_code = '01'. " for 101 itab-mvt_ind = 'F'. itab-plant = '0001'. itab-entry_qnt = AMOUNT. itab-move_type = '101'. itab-item_text = 'invoice'. itab-deliv_numb = temp_vbeln. APPEND itab. CALL FUNCTION 'BAPI_GOODSMVT_CREATE' EXPORTING goodsmvt_header = gmhead goodsmvt_code = gmcode goodsmvt_headret = mthead TABLES goodsmvt_item = itab return = errmsg. CLEAR error_code. LOOP AT errmsg. IF errmsg-type EQ 'E'. error_code = errmsg-message. ENDIF. ENDLOOP. IF error_code IS INITIAL. COMMIT WORK. IF sy-subrc NE 0. error_code = 'Commit error'. EXIT. ENDIF. ENDIF. ERROR_C = error_code.