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_goodsmvt_create

Former Member
0 Likes
959

hi friends,

i m using 'bapi_goodsmvt_create' for transfer posinting. its giving me Document Number also. But the issue is , its not updating the records to tables.

i tried 'bapi_transaction_commit' bapi for posting data to tables. But its not happening.

Kan u guide me...

Regards

Satya....u help needed urgently.

2 REPLIES 2
Read only

former_member219399
Active Participant
0 Likes
374

Hi,

Did u checked the RETURN parameter. Check whether r there any errors.

then look for ur data to solve the errors and re run the program. It may helpful.

With regards,

Vamsi

Message was edited by:

Vamsi MM

Read only

Former Member
0 Likes
374

Hi,

  • Structures for BAPI

data: gm_header type bapi2017_gm_head_01.

data: gm_code type bapi2017_gm_code.

data: gm_headret type bapi2017_gm_head_ret.

data: gm_item type table of

bapi2017_gm_item_create with header line.

data: gm_return type bapiret2 occurs 0.

data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.

clear: gm_return, gm_retmtd. refresh gm_return.

  • Setup BAPI header data.

gm_header-pstng_date = sy-datum.

gm_header-doc_date = sy-datum.

gm_code-gm_code = '06'. " MB11

  • Write 551 movement to table

clear gm_item.

move '551' to gm_item-move_type .

move '000000000040001234' to gm_item-material.

move '1' to gm_item-entry_qnt.

move 'EA' to gm_item-entry_uom.

move '0004' to gm_item-plant.

move '4000' to gm_item-stge_loc.

move '201' to gm_item-move_reas.

  • Determine cost center per plant

case xresb-werks.

when '0004'.

move '0000041430' to gm_item-costcenter.

when '0006'.

move '0000041630' to gm_item-costcenter.

when '0007'.

move '0000041731' to gm_item-costcenter.

when '0008'.

move '0000041830' to gm_item-costcenter.

endcase.

append gm_item.

  • Call goods movement BAPI

call function 'BAPI_GOODSMVT_CREATE'

exporting

goodsmvt_header = gm_header

goodsmvt_code = gm_code

importing

goodsmvt_headret = gm_headret

materialdocument = gm_retmtd

tables

goodsmvt_item = gm_item

return = gm_return.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

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

http://www.4ap.de/abap/bapi_goodsmvt_create.php

DATA : V_HEADER_TXT LIKE X_GOODS_MVT_HEAD-HEADER_TXT.

DATA : X_GOODS_MVT_HEAD LIKE BAPI2017_GM_HEAD_01,

X_GOODS_MVT_CODE LIKE BAPI2017_GM_CODE,

IT_GOODS_MVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER LINE,

IT_RETURN LIKE BAPIRET2 OCCURS 0

WITH HEADER LINE.

X_GOODS_MVT_HEAD-PSTNG_DATE = SY-DATUM.

X_GOODS_MVT_HEAD-DOC_DATE = SY-DATUM.

X_GOODS_MVT_HEAD-HEADER_TXT = V_HEADER_TXT.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

GOODSMVT_HEADER = X_GOODS_MVT_HEAD

GOODSMVT_CODE = X_GOODS_MVT_CODE

IMPORTING

MATERIALDOCUMENT = P_MATDOC

TABLES

GOODSMVT_ITEM = IT_GOODS_MVT_ITEM

RETURN = IT_RETURN.

u need to call this fm if the above is successful

IF NOT P_MATDOC IS INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

V_BAPI_NO_ERR = 'X'.

ENDIF.

Regards,

Laxmi