03-26-2007 8:46 AM
Hi all,
I am getting an error "Inadmissible movement type" when i am posting goods receipt for purchase orders using bapi "bapi_goodsmvt_create".
Can goods receipt for purchase orders of any movement type be posted using the bapi "bapi_goodsmvt_create' of movement type "<b>101</b>".
03-26-2007 8:53 AM
Hi,
Please check the code below:
Determine the movement type required for posting
PERFORM sub_determine_mvmntype CHANGING ls_item-move_type.
APPEND ls_item TO lt_item.
Movement type is determined on the basis of the Movement Type, Sign of
Delta quantity
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = ls_header
goodsmvt_code = cf_code "05
TABLES
goodsmvt_item = lt_item
return = lt_return.
FORM sub_determine_mvmntype CHANGING pi_move_type TYPE bwart.
IF gs_new-delme GT 0. "Quantity difference is positive
CASE gs_new-insmk.
WHEN space. "Unrestriced use
pi_move_type = cf_921. "921
WHEN cf_check. "X
pi_move_type = cf_923. "923
WHEN cf_two. "S
pi_move_type = cf_925. "925
WHEN others.
pi_move_type = space.
ENDCASE.
ELSEIF gs_new-delme LT 0. "Quantity difference is negative
CASE gs_new-insmk.
WHEN space. "Unrestriced use
pi_move_type = cf_922. "922
WHEN cf_check. "X
pi_move_type = cf_924. "924
WHEN cf_two. "S
pi_move_type = cf_926. "926
WHEN others.
pi_move_type = space.
ENDCASE.
ENDIF.
Regards
Kannaiah