2011 Aug 16 9:52 AM
Hi,
i want to transfer some of the materials from second quality storage location to packaging storage location(because it is iron and if necessities are not matched while producing the material, then we can use this material for packaging purposes).
İ got error about spec_stock that y is not defined. when i use 'E' instead of y, it wants me to enter sales order and item.
could you write me about this, thanks.
st_gmhead-pstng_date = sy-datum.
st_gmhead-doc_date = sy-datum.
st_gmhead-header_txt = text-m01.
*
LOOP AT gt_out where statu eq 'A'.
va_gmcode = '04'.
tb_gmitem-material = gt_out-matnr.
tb_gmitem-plant = '0006'."st_mch1-werks.
tb_gmitem-stge_loc = gt_out-lgort.
tb_gmitem-batch = gt_out-charg.
tb_gmitem-val_sales_ord = st_mch1-vbeln.
tb_gmitem-val_s_ord_item = st_mch1-posnr.
tb_gmitem-move_type = '311'.
tb_gmitem-spec_stock = 'Y'.
tb_gmitem-sales_ord = st_mch1-vbeln.
tb_gmitem-s_ord_item = st_mch1-posnr.
tb_gmitem-move_mat = gt_out-matnr.
tb_gmitem-move_plant = '0006'."st_mch1-werks.
tb_gmitem-move_stloc = '0098'."pn_lgort.
tb_gmitem-move_batch = gt_out-charg.
tb_gmitem-entry_qnt = gt_out-clabs.
APPEND tb_gmitem.
CLEAR: tb_message.
tb_message-msgty = 'I'.
tb_message-msgid = 'FB'.
tb_message-msgno = '899'.
tb_message-msgv1 = gt_out-charg.
tb_message-msgv2 = 'New location : '.
tb_message-msgv3 = '0098'."pn_lgort.
tb_message-msgv4 = 'Taransfer complete!'.
APPEND tb_message.
ENDLOOP.
*
IF NOT tb_gmitem[] IS INITIAL.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = st_gmhead
goodsmvt_code = va_gmcode
IMPORTING
materialdocument = va_matdoc
matdocumentyear = va_matdyr
TABLES
goodsmvt_item = tb_gmitem
return = tb_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
endif.
2011 Aug 16 10:23 AM
2011 Aug 16 10:31 AM
2011 Aug 16 11:45 AM
Hi,
thanks for your interest.
Message id : M7 and number 146
thanks
2011 Aug 16 12:04 PM
Hi
have you tried to post the document online? I mean by transaction?
Try to check if the special stock exists, but I suppose yes because it's a standard one
Max
2011 Aug 16 10:45 AM
Hi,
special stock means that it is assigned to something, a sales order, a project or something else. So you either need to find out:
what kind of special stock this is
can you move the material without special stock indicator (just 311)
you are using the proper movement type
I think you can best look into this with the help of a functional consultant.
Roy