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

function module needed

Former Member
0 Likes
401

HI, guys

function module for moving the stock from one storage location to another storage location with in a plant

thanks

2 REPLIES 2
Read only

Former Member
0 Likes
367

hi

you can use this bapi for stock movement

BAPI_GOODSMVT_CREATE

Regards

G. Nikhil Kumar

Read only

Former Member
0 Likes
367

Hi Use

BAPI_GOODSMVT_CREATE as below.

DATA: gt_goodsmvt_header  LIKE bapi2017_gm_head_01,
      gt_goodsmvt_item    LIKE bapi2017_gm_item_create OCCURS 0 WITH HEADER LINE,
      gt_return           LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: gt_goodsmvt_headret LIKE bapi2017_gm_head_ret,
      goodsmvt_code_tmp   TYPE bapi2017_gm_code,
      testrun             TYPE c VALUE 'X'.
    data: l_return like BAPIRET2.

TABLES lips.

*PARAMETERS p_vbeln LIKE lips-vbeln. " Delivery number

START-OF-SELECTION.
  gt_goodsmvt_header-pstng_date = sy-datum.
  gt_goodsmvt_header-doc_date   = sy-datum.


***<<<<<<<<<<<BAPI Communication Structure: Material Document Header Data>>>>>>>
    gt_goodsmvt_item-material             = 'MATERIAL 1' .
    gt_goodsmvt_item-plant                =  'ZTEC'.
    gt_goodsmvt_item-stge_loc             =  'ZTEC'.
*    gt_goodsmvt_item-deliv_numb_to_search = lips-vbeln.
*    gt_goodsmvt_item-deliv_item_to_search = lips-posnr.
    gt_goodsmvt_item-move_type            = '101'.
    gt_goodsmvt_item-vendor  = '0000204310'.
    gt_goodsmvt_item-entry_qnt            = '1'.
    gt_goodsmvt_item-entry_uom            = 'TOM'.
*    gt_goodsmvt_item-ENTRY_UOM_ISO        = 'D41'.
    gt_goodsmvt_item-PO_PR_QNT            = '1'.
gt_goodsmvt_item-ORDERPR_UN = 'TOM'.
*gt_goodsmvt_item-ORDERPR_UN_ISO  = 'D41'.
    gt_goodsmvt_item-mvt_ind              = 'B'.
    gt_goodsmvt_item-po_number            = '4500017615'.
    gt_goodsmvt_item-po_item              = '00010'.
*    gt_goodsmvt_item-CURRENCY                              = 'INR'.
*gt_goodsmvt_item-CURRENCY_ISO             = 'INR'.
gt_goodsmvt_item-REF_DOC_YR              = '2009'.
gt_goodsmvt_item-REF_DOC                       = '5000012161'.
gt_goodsmvt_item-REF_DOC_IT                   =  '0001'.
gt_goodsmvt_item-LINE_ID                      = '000002'.
gt_goodsmvt_item-EXPIRYDATE  = '20091105'.
*    gt_goodsmvt_item-no_more_gr           = 'X'.
    APPEND  gt_goodsmvt_item.

  goodsmvt_code_tmp =          '01'. "Assign code to transaction for BAPI goods movement
****<<<<<<<Post goods movements with MB_CREATE_GOODS_MOVEMENT>>>>>>>>>>>>>>>>>>>
  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
      goodsmvt_header          = gt_goodsmvt_header
      goodsmvt_code            = goodsmvt_code_tmp
*      testrun                  = testrun
   IMPORTING
     goodsmvt_headret          =  gt_goodsmvt_headret
    TABLES
      goodsmvt_item            = gt_goodsmvt_item
*   GOODSMVT_SERIALNUMBER       =
      return                   = gt_return.

  IF gt_return[] IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
     EXPORTING
       WAIT          = 'X'
     IMPORTING
       RETURN        = l_return.

    WRITE:/3  'ASN Number', gt_goodsmvt_item-deliv_numb_to_search,
          /3  'Item',gt_goodsmvt_item-deliv_item_to_search.
  ELSE.
    read table gt_return index 1.
    WRITE: '~ERROR~',
           / gt_return-message.
  ENDIF.

Regards

Gaurav

Edited by: Gaurav Arora on Feb 11, 2010 7:48 AM