Autor Tema: BAPI_GOODSMVT_CREATE  (Leído 30006 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Enrique.Borroni

  • Moderador_
  • Usuario Completo
  • *****
  • Mensajes: 89
    • Ver Perfil
BAPI_GOODSMVT_CREATE
« en: 03 de Noviembre de 2007, 09:56:03 am »
FUNCION BAPI_GOODSMVT_CREATE
TIPO MM
DESCRIPCION Realiza movimientos de materiales




Ejemplo
REPORT Y_BAPI_GOODSMVT_CREATE

DATA: l_goodsmvt_header  LIKE  bapi2017_gm_head_01,
      l_goodsmvt_code    LIKE  bapi2017_gm_code,
      l_testrun          LIKE  bapi2017_gm_gen-testrun,
      l_goodsmvt_headret LIKE  bapi2017_gm_head_ret,
      l_materialdocument LIKE  bapi2017_gm_head_ret-mat_doc,
      l_matdocumentyear  LIKE  bapi2017_gm_head_ret-doc_year.

DATA: i_goodsmvt_item    LIKE  bapi2017_gm_item_create OCCURS 10
                               WITH HEADER LINE,
      i_return           LIKE  bapiret2 OCCURS 10 WITH HEADER LINE.


START-OF-SELECTION.

* DATOS CABECERA
  CLEAR l_goodsmvt_header.
  l_goodsmvt_header-pstng_date = sy-datum.
  l_goodsmvt_header-doc_date   = '20010122'.
  l_goodsmvt_header-pr_uname   = sy-uname.
  l_goodsmvt_header-header_txt = 'Ent. desde fábrica'.
  L_GOODSMVT_HEADER-REF_DOC_NO = '00/00'.

* Tipo de movimiento
  l_goodsmvt_code = '01'. "Goods receipt for purchase order

* Posiciones
  CLEAR i_goodsmvt_item.
  i_goodsmvt_item-material  = '01017900'.
  i_goodsmvt_item-plant     = '0210'.
  i_goodsmvt_item-stge_loc  = '0100'.
  i_goodsmvt_item-VENDOR    = '0000000016'.
  i_goodsmvt_item-move_type = '101'.
  i_goodsmvt_item-MVT_IND   = 'B'.   "Indicador de movimiento
  i_goodsmvt_item-PO_NUMBER = '5500000058'.
  i_goodsmvt_item-po_item   = '00010'.
  i_goodsmvt_item-ENTRY_QNT = '10.000'.
  I_GOODSMVT_ITEM-ENTRY_UOM = 'ST'.
  append i_goodsmvt_item.


  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
       EXPORTING
            goodsmvt_header       = l_goodsmvt_header
            goodsmvt_code         = l_goodsmvt_code
            testrun               = ' '
       IMPORTING
            goodsmvt_headret      = l_goodsmvt_headret
            materialdocument      = l_materialdocument
            matdocumentyear       = l_matdocumentyear
       TABLES
            goodsmvt_item         = i_goodsmvt_item
*         GOODSMVT_SERIALNUMBER =
            return                = i_return
            .

  IF SY-SUBRC = 0.
    describe table i_return lines sy-tfill.
    if sy-tfill = 0.
      COMMIT WORK.
    endif.
  ENDIF.
Saludos.

Atte.,
Enrique Borroni

maito : enrique.borroni@abap.es

Desconectado soyerjuanan

  • Novato
  • *
  • Mensajes: 1
    • Ver Perfil
Re: BAPI_GOODSMVT_CREATE
« Respuesta #1 en: 11 de Noviembre de 2009, 12:03:58 pm »
Hola estoy intentando ejecutar esta bapi y me da el error E 03 453, en el que dice "No se han importado cantidades adicionales de aplicación
externa", ¿alguien me puede ayudar?, intento hacer un movimiento 201 para mover materiales de un almacén, os dejo mi código por si sirve de ayuda, muchas gracias.

DATA: l_goodsmvt_header  LIKE  bapi2017_gm_head_01,
      l_goodsmvt_code    LIKE  bapi2017_gm_code,
      l_testrun          LIKE  bapi2017_gm_gen-testrun,
      l_goodsmvt_headret LIKE  bapi2017_gm_head_ret,
      l_materialdocument LIKE  bapi2017_gm_head_ret-mat_doc,
      l_matdocumentyear  LIKE  bapi2017_gm_head_ret-doc_year.

DATA: i_goodsmvt_item    LIKE  bapi2017_gm_item_create OCCURS 10
                               WITH HEADER LINE,
      i_return           LIKE  bapiret2 OCCURS 10 WITH HEADER LINE.


* DATOS CABECERA
CLEAR l_goodsmvt_header.
l_goodsmvt_header-pstng_date = bkpf-budat. "fecha de contabilizacion poner
l_goodsmvt_header-doc_date   = sy-datum. "fecha de hoy
l_goodsmvt_header-pr_uname   = sy-uname.
l_goodsmvt_header-header_txt = 'Ent. desde fábric'.
*  L_GOODSMVT_HEADER-REF_DOC_NO = '00/00'.

* Tipo de movimiento 201
l_goodsmvt_code = '03'. "Goods receipt for purchase order "posible para quitar

* Posiciones
CLEAR i_goodsmvt_item.
REFRESH i_goodsmvt_item.
*CLEAR it_botellas.
*IF it_botellas IS INITIAL.
LOOP AT it_botellas INTO wa_botel WHERE seleccion = 'X'.
  i_goodsmvt_item-material  = wa_botel-idnrk. "tabla interna
  i_goodsmvt_item-plant     = zllenado-centro.    "centro tabla interna
  i_goodsmvt_item-stge_loc  = wa_botel-tanquesfera. "tanque-esfera o almacen
*    i_goodsmvt_item-vendor    = ' '. "no hay
  i_goodsmvt_item-move_type = '201'.
  i_goodsmvt_item-mvt_ind   = space.   "Indicador de movimiento (no lo usamos)
*  i_goodsmvt_item-PO_NUMBER = '5500000058'."no lo usamos
*  i_goodsmvt_item-po_item   = '00010'. "no lo usamos
  i_goodsmvt_item-entry_qnt = wa_botel-cantidadkg. "tabla interna cantidad
   i_goodsmvt_item-entry_uom = 'KG'. "tabla interna unidad
  APPEND i_goodsmvt_item.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
  EXPORTING
    goodsmvt_header             = l_goodsmvt_header
    goodsmvt_code               = l_goodsmvt_code
   testrun                     = ' '
 IMPORTING
   goodsmvt_headret            = l_goodsmvt_headret
   materialdocument            = l_materialdocument
   matdocumentyear             = l_matdocumentyear
  TABLES
    goodsmvt_item               = i_goodsmvt_item
*     GOODSMVT_SERIALNUMBER       =
    return                      = i_return
*     GOODSMVT_ITEM_CWM           =
          .
IF sy-subrc = 0.
  DESCRIBE TABLE i_return LINES sy-tfill.

  IF sy-tfill = 0.
    COMMIT WORK.
    CALL SCREEN 0300.
  ELSE.
    MESSAGE e000(zisoil_mm3) WITH  i_return-message.
  ENDIF.
ENDIF.