Skip to Content
author's profile photo Former Member
Former Member

call func 'BAPI_GOODSMVT_CREATE' problem

hi

ı have a trouble with 'BAPI_GOODSMVT_CREATE'

in this code its giving error like this "Error in function

Update control of movement type is incorrect (entry 301 X X _ Q)"

ı give manually in migo it says ok


FORM bapi.
if sy-subrc <> 0.
  message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  exit.
endif.


gmhead-pr_uname = sy-uname.
gmcode-gm_code = '04'.   "01 - MB01 - Goods Receipts for Purchase Order



loop at gt_out.
  itab-move_type  = '301'.
  itab-mvt_ind    = 'Q'.
  itab-plant      = gt_out-werks.
  itab-material   = gt_out-maktx .
  itab-entry_qnt  = gt_out-erfmg.
  itab-move_stloc = gt_out-tlgort.
  itab-stge_loc   = gt_out-flgort.
  itab-BATCH      = gt_out-charg.
  itab-WBS_ELEM   = gt_out-wbs.
  itab-VAL_TYPE   = gt_out-charg.
  gmhead-pstng_date = gt_out-postd.
gmhead-doc_date = gt_out-doc_d.
*  itab-po_number  = pcitab-pur_doc.
*  itab-po_item    = pcitab-po_item.
*  concatenate pcitab-del_no pcitab-del_item into itab-item_text.
*  itab-move_reas  = pcitab-scrap_reason.

  append itab.
endloop.


call function 'BAPI_GOODSMVT_CREATE'
  exporting
    goodsmvt_header             = gmhead
    goodsmvt_code               = gmcode
*   TESTRUN                     = ' '
 IMPORTING
    goodsmvt_headret            = mthead
*   MATERIALDOCUMENT            =
*   MATDOCUMENTYEAR             =
  tables
    goodsmvt_item               = itab
*   GOODSMVT_SERIALNUMBER       =
    return                      = errmsg
          .
clear errflag.
loop at errmsg.
  if errmsg-type eq 'E'.
    write:/'Error in function', errmsg-message.
    errflag = 'X'.
  else.
    write:/ errmsg-message.
  endif.
endloop.

if errflag is initial.
  commit work and wait.
  if sy-subrc ne 0.
    write:/ 'Error in updating'.
    exit.
  else.
    write:/ mthead-mat_doc, mthead-doc_year.
*    perform upd_sta.
  endif.
endif.

ENDFORM.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2012 at 02:48 PM

    Hi,

    Once go through the function module documentation, it will help you a lot.

    pass movement indicator as 'B' and check once again

    loop at gt_out.

    itab-move_type = '301'.

    itab-mvt_ind = 'Q'. <----


    'B'

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      problem resolved

      change wbs element with code is below

      all problems resolved

      itab-val_wbs_elem   = '00009001'.
      *numan p_wbs düzeltme
         itab-wbs_elem       = '00009001'.
         itab-spec_mvmt      = 'R'.
      *numanitab-val_wbs_elem -->itab-wbs_elem.
      
      *  itab-po_number  = pcitab-pur_doc.
      *  itab-po_item    = pcitab-po_item.
      *  concatenate pcitab-del_no pcitab-del_item into itab-item_text.
      *  itab-move_reas  = pcitab-scrap_reason.
      perform conversion_exit_abpsp_output
                         changing  :
                                     itab-val_wbs_elem.
          perform conversion_exit_abpsp_output
                         changing  :
                                    itab-wbs_elem.
      
      
      form conversion_exit_abpsp_output      using p_value.
        call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
          exporting
            input  = p_value
          importing
            output = p_value.
      
      endform.                    " CONVERSION_EXIT
      
      

  • Posted on Feb 02, 2012 at 02:53 PM

    Hi

    See also SAP Note 520813 - FAQ: BAPIs for goods movements

    Regards

    Eduardo

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.