Application Development 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: 

BAPI for Goods Issue

Former Member
0 Kudos

Hi gurus,

I am working on an interface where I need to do <b>goods Issue</b> and for this I have written the following code, but my return statement is returning this error" <b>Goods movement not possible with mvmt type 201</b>"

data: begin of it_input_file occurs 0,

matnr(18),

werks(4),

uoe_qty(13),

amount(13),

st_loc(4),

batch(10),

account(10),

uoe_uom(3),

end of it_input_file.

v_semfile = p_ifname.

refresh it_input_file.

call function 'WS_UPLOAD'

EXPORTING

filename = v_semfile

filetype = 'DAT'

TABLES

data_tab = it_input_file

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

others = 10.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

move: syst-datum to v_doc_date,

syst-datum to v_pos_date.

loop at it_input_file.

move: v_doc_date to GOODSMVT_HEADER-DOC_DATE,

v_pos_date to GOODSMVT_HEADER-pstng_date,

syst-uname to GOODSMVT_HEADER-pr_uname.

move: '05' to GOODSMVT_CODE-GM_CODE.

move: it_input_file-matnr to GOODSMVT_ITEM-material,

it_input_file-werks to GOODSMVT_ITEM-plant,

it_input_file-st_loc to GOODSMVT_ITEM-stge_loc,

it_input_file-batch to GOODSMVT_ITEM-batch,

it_input_file-uoe_qty to GOODSMVT_ITEM-entry_qnt,

it_input_file-uoe_uom to GOODSMVT_ITEM-entry_uom,

it_input_file-amount to GOODSMVT_ITEM-AMOUNT_LC,

' ' to GOODSMVT_ITEM-MVT_IND,

'X' to GOODSMVT_ITEM-NO_MORE_GR,

move: c_mov_type2 to GOODSMVT_ITEM-move_type,

append goodsmvt_item.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

GOODSMVT_HEADER = GOODSMVT_HEADER

GOODSMVT_CODE = GOODSMVT_CODE

IMPORTING

GOODSMVT_HEADRET = GOODSMVT_HEADRET

MATERIALDOCUMENT = MATERIALDOCUMENT

MATDOCUMENTYEAR = MATDOCUMENTYEAR

TABLES

GOODSMVT_ITEM = GOODSMVT_ITEM

RETURN = RETURN

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

IMPORTING

RETURN = return2.

Message was edited by:

Rajeev Gupta

Message was edited by:

Rajeev Gupta

2 REPLIES 2

jj
Active Contributor
0 Kudos

There is a check with table: t158b

SELECT SINGLE * FROM T158B WHERE TCODE = <tcode>

AND BWART = <movement type>.

When this is failing the following error message is raised.

Former Member
0 Kudos

Hey thanks for the reply john, actually I am new to ABAP can you please explain me in detail, I mean how will it work in my case. I will really appreciate your time and efforts.

Thnaks

Rajeev