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 - Batch Expiry Date......

Former Member
0 Likes
2,969

HI Im,

using this BAPI to post a goods movement from one location to another in the same plant.

The stock is being posted to a specific Batch. When I do this the material document gets created okay and the stock moves.

The problem is that the batch expiry date is not updating. The stock I'm moving has a later expiry date than the current date. If I do this manually in MIGO it works fine and updates the batch expiry date with the later date.

Has anyone else experienced this or know of a work around ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,813

Try to pass the expiry date to the parameter:

GOODSMVT_ITEM-EXPIRYDATE.

Regards,

Ravi

2 REPLIES 2
Read only

Former Member
0 Likes
1,814

Try to pass the expiry date to the parameter:

GOODSMVT_ITEM-EXPIRYDATE.

Regards,

Ravi

Read only

Former Member
0 Likes
1,813

Hi

I am populating the item data like:

*- Populate item data

LOOP AT i_items_trans.

CLEAR ibapigm_item.

*- Convert the matnr backto 18 char form (External)

CALL FUNCTION 'CONVERSION_EXIT_MATN2_INPUT'

EXPORTING

input = i_items_trans-matnr

IMPORTING

output = i_items_trans-matnr

EXCEPTIONS

number_not_found = 1

length_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ibapigm_item-material = i_items_trans-matnr.

ibapigm_item-plant = x_user-werks.

ibapigm_item-stge_loc = x_user-lgort.

ibapigm_item-move_type = '101'. "Goods Receipt

ibapigm_item-mvt_ind = 'B'. "Goods Movement for PO

ibapigm_item-po_number = i_items_trans-ebeln.

ibapigm_item-po_item = i_items_trans-ebelp.

ibapigm_item-gr_rcpt = sy-uname.

ibapigm_item-quantity = i_items_trans-ktmng.

ibapigm_item-base_uom = i_items_trans-meins.

ibapigm_item-entry_qnt = i_items_trans-ktmng.

ibapigm_item-entry_uom = i_items_trans-meins.

ibapigm_item-batch = i_items_trans-charg.

APPEND ibapigm_item.

ENDLOOP.

Header data like:

MOVE: sy-datum TO bapigm_head-pstng_date,

sy-datum TO bapigm_head-doc_date,

sy-uname TO bapigm_head-pr_uname,

v_mblnr TO bapigm_head-ref_doc_no,

con_bfwms_bestand TO bapigm_head-ext_wms.

*- Document Header Text

IF NOT v_bktxt IS INITIAL.

*- Preceed "INV=" to the Invoice number entered

CONCATENATE 'INV='(003) v_bktxt INTO v_bktxt

SEPARATED BY space.

bapigm_head-header_txt = v_bktxt.

ENDIF.

MOVE gmcode_01 TO bapigm_code-gm_code.

And calling the BAPI as:

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = bapigm_head

goodsmvt_code = bapigm_code

IMPORTING

goodsmvt_headret = bapigm_headret

TABLES

goodsmvt_item = ibapigm_item

return = ibapigm_ret.

*- Commit on Success

IF NOT bapigm_headret-mat_doc IS INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

Havent faced any problem so far...

Did you populate <b>EXPIRYDATE</b> in structure <b>BAPI2017_GM_ITEM_CREATE</b>? If yes, see in debugging, whatz happening to this value.

Regards,

Raj