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: 

Goods Movement for Production Order

former_member192971
Participant
0 Kudos

Hello Experts,

I have been working with the Bapi "BAPI_GOODSMVT_CREATE" for Goods movement against a Production order from one S_Location to another S-Location. I am using  Movement_Type : 261, Mvt_Code : 02 and Mvt_Ind : 'F' . And passing the parameters like Workorder, Plant, S_Loc, Material, Quantity, Move_To_Plant, Move_To_S.Loc , and Units. But couldn't get it done as I am getting a return error message as Goods Movement not possible with Movement Type 216 .

Do i need to pass any other parameters and let me know whether the Movement type, code, Indicator are correct for goods movement .

Appreciate your help.

Thanks,

Uday.

5 REPLIES 5

raymond_giuseppi
Active Contributor
0 Kudos

Just a typo, in the post or in the source code ?


...

I have been working with the Bapi "BAPI_GOODSMVT_CREATE" for Goods movement against a Production order from one S_Location to another S-Location. I am using  Movement_Type : 261, Mvt_Code : 02 and Mvt_Ind : 'F' . And passing the parameters like Workorder, Plant, S_Loc, Material, Quantity, Move_To_Plant, Move_To_S.Loc , and Units. But couldn't get it done as I am getting a return error message as Goods Movement not possible with Movement Type 216 .

...

Else (Did you use search tool ?)


Which GM code did you use,

Check for 261 in both those tables in your system :

  • T158G "MMIM: Possible Codes for BAPI Goods Movement" Else BAPI not allowed
  • T158B "Check Table: Movement Type for Transaction Code" to find transactions allowed so correct gm_code to use in BAPI

For reference (documentation) read Note 520813 - FAQ: BAPIs for goods movements.

Regards,

Raymond

Abhijit74
Active Contributor
0 Kudos

Hello,

Can you post your code? .

Thanks,

Abhijit

Former Member
0 Kudos

Uday,

Go through the BAPI documentation which explains , what are all the required parameters those needs to be passed to successfully post the Goods mvt.

Thanks,

Kishor.

0 Kudos

sample code :

Here is some sample code from one of my programs, which does a 551 movement type.  This should get you started.  Just check the RETURN table for messages, they should tell you what you are missing.


* 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'.

Thanks,

Kishor.

karun_prabhu
Active Contributor
0 Kudos

Hello Uday.

Goods movement code for 261 movement is 03.