ia lo implemente en mi programa.. y sale todo bien...
.. gracias x el dato d commit.. si seguia probandolo en la se37 me iba a volver loca
*declaracion de variables
*BAPI_GOODSMVT_CREATE
DATA: GOODSMVT_HEADER LIKE BAPI2017_GM_HEAD_01,
GOODSMVT_CODE LIKE BAPI2017_GM_CODE,
TESTRUN LIKE BAPI2017_GM_GEN-TESTRUN,
GOODSMVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE
OCCURS 0 WITH HEADER LINE,
RETURN2 LIKE BAPIRET2
OCCURS 0 WITH HEADER LINE.
DATA: MATERIALDOCUMENT TYPE BAPI2017_GM_HEAD_RET-MAT_DOC,
MATDOCUMENTYEAR TYPE BAPI2017_GM_HEAD_RET-DOC_YEAR.
*---------------------------------------------------------------------*
* FORM F_INICIALIZAR_ESTRUCTURAS
*---------------------------------------------------------------------*
FORM F_INICIALIZAR_ESTRUCTURAS.
CLEAR : MATERIALDOCUMENT, MATDOCUMENTYEAR.
CLEAR : GOODSMVT_HEADER,
GOODSMVT_CODE.
REFRESH: GOODSMVT_ITEM,
RETURN2.
ENDFORM.
*---------------------------------------------------------------------*
* Form F_BAPI2
*---------------------------------------------------------------------*
FORM F_BAPI2.
PERFORM F_GOODSMVT_HEADER.
PERFORM F_GOODSMVT_CODE.
PERFORM F_GOODSMVT_ITEM.
PERFORM F_CARGAR_BAPI2.
ENDFORM.
*---------------------------------------------------------------------*
* FORM F_GOODSMVT_HEADER *
*---------------------------------------------------------------------*
FORM F_GOODSMVT_HEADER.
CLEAR GOODSMVT_HEADER.
* Fecha de contabilización en el documento
GOODSMVT_HEADER-PSTNG_DATE = SY-DATUM.
* Fecha de documento en documento
GOODSMVT_HEADER-DOC_DATE = SY-DATUM.
* Nombre de usuario
GOODSMVT_HEADER-DOC_DATE = SY-UNAME.
ENDFORM.
*---------------------------------------------------------------------*
* FORM F_GOODSMVT_CODE *
*---------------------------------------------------------------------*
FORM F_GOODSMVT_CODE.
SELECT SINGLE GMCODE INTO GOODSMVT_CODE
FROM T158G WHERE TCODE = 'MB1B'.
ENDFORM.
*---------------------------------------------------------------------*
* FORM F_GOODSMVT_ITEM *
*---------------------------------------------------------------------*
FORM F_GOODSMVT_ITEM.
GOODSMVT_ITEM-PLANT = TZMM_COMPINT-WERKSA. "centro origen
GOODSMVT_ITEM-STGE_LOC = TZMM_COMPINT-LGORTA. "almacen origen
GOODSMVT_ITEM-MOVE_TYPE = '351'.
SELECT SINGLE MENGE INTO GOODSMVT_ITEM-ENTRY_QNT
FROM EKPO WHERE EBELN = G_DOC
AND EBELP = C_POS. "cantidad
GOODSMVT_ITEM-PO_NUMBER = G_DOC. "orden d compra
GOODSMVT_ITEM-PO_ITEM = C_POS. "posicion
APPEND GOODSMVT_ITEM.
ENDFORM.
*---------------------------------------------------------------------*
* F_FORM CARGAR_BAPI2 *
*---------------------------------------------------------------------*
FORM F_CARGAR_BAPI2.
* Registrar traspaso
CLEAR RETURN2.
REFRESH RETURN2.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = GOODSMVT_HEADER
GOODSMVT_CODE = GOODSMVT_CODE
IMPORTING
MATERIALDOCUMENT = MATERIALDOCUMENT
MATDOCUMENTYEAR = MATDOCUMENTYEAR
TABLES
GOODSMVT_ITEM = GOODSMVT_ITEM
RETURN = RETURN2
.
COMMIT WORK.
IF NOT RETURN2 IS INITIAL.
* Log
LOOP AT RETURN2.
CLEAR T_LOG.
MOVE-CORRESPONDING TZMM_COMPINT TO T_LOG.
T_LOG-TIPO = RETURN2-TYPE.
T_LOG-MSG = RETURN2-MESSAGE.
APPEND T_LOG.
ENDLOOP.
ENDIF.
ENDFORM.