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: 

551 GI to Scrap

Former Member
0 Kudos

I have a requirement to create a 551 movement to do a GI to scrap. However, since this requires a cost center I can't get BAPI_GOODSMVT_CREATE to work. Is there any other function or BAPI to call to avoid doing it via call transaction?

1 ACCEPTED SOLUTION

former_member181966
Active Contributor
0 Kudos

Try

ALM_ME_GOODSMVT_CREATE

PM_GOODSMVT_CREATE

ALE_GOODSMVT_SAPCREATE

BAPI_GOODSMVT_SAPCREATE

IDOC_INPUT_GOODSMVT_SAPCREATE

ALE_GOODSMVT_CREATE

BAPI_GOODSMVT_CREATE

Thanks,

Saquib Khan

8 REPLIES 8

former_member181966
Active Contributor
0 Kudos

Try

ALM_ME_GOODSMVT_CREATE

PM_GOODSMVT_CREATE

ALE_GOODSMVT_SAPCREATE

BAPI_GOODSMVT_SAPCREATE

IDOC_INPUT_GOODSMVT_SAPCREATE

ALE_GOODSMVT_CREATE

BAPI_GOODSMVT_CREATE

Thanks,

Saquib Khan

0 Kudos

You could simply fill the cost center using the BAPI_GOODSMVT_CREATE.

Regards,

Rich Heilman

0 Kudos

I thought he doesn’t want to fill cost center ....

<b>FYI</b>

<b>However, since this requires a cost center I can't get BAPI_GOODSMVT_CREATE to work</b>

0 Kudos

If it requires a cost center in this BAPI, it will require a cost center anyway you try to do it in R/3, other FM or BAPIs, BDC, etc. If the BAPI wants, a cost center, you must provide a cost center. You don't get to pick and choose what you want to give the BAPI, the BAPI tells you what it wants.

Regards,

Rich Heilman

0 Kudos

I tried filling the GOODSMVT_ITEM-COSTCENTER field with my valid cost center '999999' but am getting the error 'Cost center 2000 /999999 does not exist on 06/14/2006'. If I populate the same fields via MB1A or MIGO it works fine.

0 Kudos

I have a program that has been working good for some time. Here is the code. Maybe there is some config missing for your cost center, or maybe something missing in your code. check below.



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

  perform show_status using 'Scrapping(551) Material'.

* 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 xresb-matnr  to gm_item-material.
  move p_bdmng      to gm_item-entry_qnt.
  move xresb-meins  to gm_item-entry_uom.
  move xresb-werks  to gm_item-plant.
  move xresb-lgort  to gm_item-stge_loc.
  move p_grund      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.

  if not gm_retmtd is initial.
    commit work and wait.
    call function 'DEQUEUE_ALL'.
  else.
    commit work and wait.
    call function 'DEQUEUE_ALL'.
    message i013.
  endif.

Regards,

Rich Heilman

0 Kudos

Thanks for your code Rich. It helped me see that I wasn't passing the leading 0's in the cost center field! It works now.

0 Kudos

Alright! Good work.

REgards,

Rich Heilman