Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with BAPI_GOODSMVT_CREATE

Former Member
0 Likes
938

Hi all!

We need to create an Goods Receipt from an Outbound Delivery. We're using FM BAPI_GOODSMVT_CREATE.

Sometimes the FM do the Goods Receipt, sometimes the FM returns the functional error "Stock in transit exceeded".

The problem is that when the FM returns the error, i attempt to do so by migo and it posts.

I use a commit work and the FM 'C14Z_WAIT_ON_COMMIT' before the excecution.

I think the problem could be that the material is blocked, or something like that.

Here is the code:

  • Header data

move ls_psibapi_header-fecha_f to: ls_header-pstng_date,

ls_header-doc_date.

move i_delivery to ls_header-ref_doc_no.

  • Item data

loop at ls_psibapi_detail assigning <detail>.

append initial line to lt_item assigning <item>.

move: c_data_we-werks to <item>-plant,

c_data_we-lgort to <item>-stge_loc,

101 to <item>-move_type,

<detail>-net_weight to <item>-entry_qnt,

<detail>-umb_pn to <item>-entry_uom,

i_delivery to <item>-deliv_numb_to_search,

<detail>-pos to <item>-deliv_item_to_search,

'B' to <item>-mvt_ind,

<detail>-matnr to <item>-material.

check gt_batch is not initial.

read table gt_batch assigning <batch> index 1.

move <batch>-batch to <item>-batch.

endloop.

  • Excecute

call function 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = ls_header

goodsmvt_code = '01'

IMPORTING

materialdocument = e_mat_doc

TABLES

goodsmvt_item = lt_item

return = lt_return.

Thanks in advance,

John.

4 REPLIES 4
Read only

Former Member
0 Likes
612

Hi,

If you are able to post manually, then this should also work.

After calling this BAPI, call BAPI_TRANSACTION_COMMIT exporting WAIT = 'X'. Check if it works.

I guess problem is coming for STOs. In case of STOs first goods will be issued from supplying plant and the GR will be posted in the receiving plant. If GR qty at the receiving plant is more than GI qty at the supplying plant, this problem might occurs.

Regards,

Ganga

Edited by: Ganga Bhavani R on Feb 24, 2010 9:19 PM

Read only

Former Member
0 Likes
612

Hi

try using FMs BAPI_TRANSACTION_COMMIT and

DEQUEUE_ALL

after your bapi good movement

may be this will help you solve the problem, as you were saying that problem is due to block on material.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
612

check this link:[http://www.sapfans.com/forums/viewtopic.php?f=13&t=17708&start=0&st=0&sk=t&sd=a]

Read only

Former Member
0 Likes
612

Hi,

I'm having the same problem.

But even with bapi_transaction_comiit I don't get the document ready.

Anyway, how are we supossed to be sure that the document was processed ? Because when the bapi returns the error, how do you check the material document number ?