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

bapi error in BAPI_GOODSMVT_CREATE

Former Member
0 Likes
3,323

HI friends ,

i am using BAPI_GOODSMVT_CREATE for migo using movement type 101 . but it is always throughing

same error 'Goods movement not possible with mvmt type 101' . i am unable to understand the actual cause of this error . what should i do shall we have to use any other bapi for this . plz help me regarding this .

Thanks ,

Amit Ranjan

9 REPLIES 9
Read only

Former Member
0 Likes
2,115

Hi Amit,

have you set goodsmvt_item-mvt_ind = 'B' ?

regards,

Edgar

Read only

0 Likes
2,115

HI FRIEND ,

thanks for your prompt reply . i have used goodsmvt_item-mvt_ind = 'B' but the error is still there .

i am sending u my whole program for better understanding .

&----


*& Report ZBAP

*&

&----


*&

*&

&----


REPORT ZBAP.

parameters: xpost like sy-datum default sy-datum.

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,

errflag.

data: begin of pcitab occurs 100,

ext_doc(10), "External Document Number

mvt_type(3), "Movement Type

doc_date(8), "Document Date

post_date(8), "Posting Date

plant(4), "Plant

material(18), "Material Number

qty(13), "Quantity

recv_loc(4), "Receiving Location

issue_loc(4), "Issuing Location

pur_doc(10), "Purchase Document No

po_item(3), "Purchase Document Item No

del_no(10), "Delivery Purchase Order Number

del_item(3), "Delivery Item

prod_doc(10), "Production Document No

scrap_reason(10), "Scrap Reason

upd_sta(1), "Update Status

end of pcitab.

call function 'WS_UPLOAD'

exporting

filename = 'c:\migo.txt'

filetype = 'DAT'

  • IMPORTING

  • FILELENGTH =

tables

data_tab = pcitab

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • OTHERS = 6

.

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-pstng_date = sy-datum.

gmhead-doc_date = sy-datum.

gmhead-pr_uname = sy-uname.

gmcode-gm_code = '01'. "01 - MB01 - Goods Receipts for Purchase Order

loop at pcitab.

itab-move_type = pcitab-mvt_type.

itab-mvt_ind = 'B'.

itab-plant = pcitab-plant.

itab-material = pcitab-material.

itab-entry_qnt = pcitab-qty.

itab-move_stloc = pcitab-recv_loc.

itab-stge_loc = pcitab-issue_loc.

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 = '03'

  • 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.

endif.

endif.

PLZ check it and telll me where is the fault .

Thanks ,

Amit Ranjan

Read only

0 Likes
2,115

Hello


...
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = '03'
...

It is wrong. For 101 movement type it must be 01.

Read only

0 Likes
2,115

hi friend ,

when i put goodsmvt_code = '01' . it worked and the previous error has been disappeared .

i am doing it for other errors .

i will get back to all of u very soon .

THANKS ,

AMIT RANJAN

Read only

0 Likes
2,115

HI Friends ,

in the same bapi named "BAPI_GOODSMVT_CREATE" i have to add some more our own developed fields so that this bapi will update the standard fields as well as our own developed fields . i have added those developed fields in the structure named "bapi2017_gm_item_create" . but what coding i have to do for updating those ztables and where i have to do coding for this .

Thanks ,

AMIT Ranjan

Read only

0 Likes
2,115

Check out enhancement MB_CF001 and badi MB_DOCUMENT_BADI.

!

Oh, and I've forgotten, MB_BAPI_GOODSMVT_CREATE. You should use EXTENSIONIN, not bapi2017_gm_item_create.

You could actually create a Z_BAPI_GOODSMVT_CREATE that would call the standard BAPI and then update your tables if you haven't place your fields as an append structure of MKPF or MSEG.

hope it helps,

Edgar

Edited by: Edgar Soares on Mar 2, 2009 10:17 AM

Read only

Former Member
0 Likes
2,115

Hi

Good

Try this BAPI BAPI_OUTB_DELIVERY_CONFIRM_DEC.

Thanks

mrutyun^

Read only

Former Member
0 Likes
2,115

Hi,

Check out this link, code used this BAPI

http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm

Thanks,

Krishna...

Read only

Former Member
0 Likes
2,115

Hi, check out this code, I had de same error.

You don't have to populate the field MOVE_REAS at least the movement be devolution = '102'

I hope this help you, sorry for my bad english.

DATA: wa_header LIKE bapi2017_gm_head_01.

DATA BEGIN OF it_items OCCURS 0.

INCLUDE STRUCTURE /afs/bapi2017_gm_item_create.

DATA END OF it_items.

DATA BEGIN OF it_return OCCURS 0.

INCLUDE STRUCTURE bapiret2.

DATA END OF it_return.

DATA: w_code LIKE bapi2017_gm_code.

w_code = '01'."MB01 contab.entrada mercancías p.pedido

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' "agrega ceros

EXPORTING

input = wa_header-ref_doc_no

IMPORTING

output = wa_header-ref_doc_no.

wa_header-pstng_date = sy-datum.

wa_header-doc_date = sy-datum.

CLEAR it_items.

it_items-move_type = '101'. "Clase de movimiento

it_items-mvt_ind = 'B'."Indicador de movimiento

it_items-po_number = '610000003'.

SELECT SINGLE lifnr INTO it_items-vendor

FROM ekko WHERE ebeln = '0610000003'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' "agrega ceros

EXPORTING

input = it_items-vendor

IMPORTING

output = it_items-vendor.

SELECT SINGLE ebelp

matnr

werks

lgort

menge

INTO (it_items-po_item,

it_items-material,

it_items-plant,

it_items-stge_loc,

it_items-entry_qnt)

FROM ekpo WHERE ebeln = '0610000003' AND ebelp = '10'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' "agrega ceros

EXPORTING

input = it_items-material

IMPORTING

output = it_items-material.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' "agrega ceros

EXPORTING

input = it_items-po_number

IMPORTING

output = it_items-po_number.

APPEND it_items.

BREAK-POINT.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = wa_header

goodsmvt_code = w_code

  • TESTRUN = ' '

  • IMPORTING

  • GOODSMVT_HEADRET =

  • MATERIALDOCUMENT =

  • MATDOCUMENTYEAR =

TABLES

goodsmvt_item = it_items

  • GOODSMVT_SERIALNUMBER =

return = it_return

  • AFS_GOODSMVT_SKU =

.

READ TABLE it_return WITH KEY type = 'E' .

IF sy-subrc NE 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

  • IMPORTING

  • RETURN =

.