Autor Tema: BAPI_0050_CREATE  (Leído 10467 veces)

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

Desconectado camaron

  • Novato
  • *
  • Mensajes: 2
    • Ver Perfil
BAPI_0050_CREATE
« en: 02 de Abril de 2008, 05:28:24 pm »
Hola gente:
quiero que me den una ayudadita con la BAPI_0050_CREATE para la creacion de documentos en la transaccion FMBB si hay alguien que halla utilizado esta bapi por favor expliqueme gracias aigos

Desconectado oscar

  • Administrador
  • Usuario Sr.
  • *****
  • Mensajes: 112
    • Ver Perfil
Re: BAPI_0050_CREATE
« Respuesta #1 en: 03 de Abril de 2008, 01:43:36 pm »
He visto este ejemplo en el SDN.

Si te puede servir de ayuda para ver como rellena los datos...

Código: [Seleccionar]
REPORT ztest LINE-SIZE 80 NO STANDARD PAGE HEADING MESSAGE-ID 00.

DATA: BEGIN OF header.
        INCLUDE STRUCTURE bapi_0050_header.
DATA: END OF header.

DATA: BEGIN OF item OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_item.
DATA: END OF item.

DATA: BEGIN OF sender OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_item.
DATA: END OF sender.

DATA: BEGIN OF period OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_period.
DATA: END OF period.

DATA: BEGIN OF period_sender OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_period.
DATA: END OF period_sender.

DATA: BEGIN OF return OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA: END OF return.

DATA: poper(3) TYPE n,

start-of-selection.

PERFORM update_using_bapi .

*&---------------------------------------------------------------------
*& Form update_using_bapi
*&---------------------------------------------------------------------
*   text
*----------------------------------------------------------------------
FORM update_using_bapi .

  PERFORM get_current_period.
  PERFORM fill_header.
  PERFORM fill_item.
  PERFORM fill_sender.
  PERFORM fill_period.
  PERFORM save_doc.

ENDFORM. " update_using_bapi

*&---------------------------------------------------------------------
*& Form fill_header
*---------------------------------------------------------------------
FORM fill_header .

  REFRESH: item,
  period.

  MOVE sy-datum TO : header-docdate.

  header-fm_area = 'COCD'.
  header-version = '000'.
  header-docstate = '1'.
  header-doctype = '1'.
  header-process = 'TRAN'.
  header-doctype = 'TRAN'.

ENDFORM. " fill_header

*&---------------------------------------------------------------------
*& Form fill_sender
*&---------------------------------------------------------------------
FORM fill_sender.

  sender-item_num = 1.
  sender-fisc_year = '2007'.
  sender-budcat = '9F'.

  sender-budtype = 'TSFS'.

  sender-distkey = '0'.

  sender-fund = '300002'.
  sender-funds_ctr = '101165'.
  sender-cmmt_item = 'CITEM'.
  sender-trans_curr = 'CAD'.
  sender-total_amount = '123.45'.
  sender-valtype = 'B1'.

  APPEND sender.

ENDFORM. " fill_sender

*&---------------------------------------------------------------------
*& Form fill_item
*&---------------------------------------------------------------------
FORM fill_item .


  item-item_num = 2.
  item-fisc_year = '2007'.
  item-budcat = '9F'.

  item-budtype = 'TSFR'.

  item-distkey = '0'.

  item-fund = '300002'.
  item-funds_ctr = '100653'.
  item-cmmt_item = 'CITEM'.
  item-trans_curr = 'CAD'.
  item-total_amount = '123.45'.
  item-valtype = 'B1'.

  APPEND item.

ENDFORM. " fill_item

*&---------------------------------------------------------------------
*& Form save_doc
*&---------------------------------------------------------------------
FORM save_doc .

  DATA: do_commit,
  first VALUE 'X'.

  CLEAR return.
  REFRESH return.

  CALL FUNCTION 'BAPI_0050_CREATE'
    EXPORTING
      language           = 'E'
      header_data        = header
      testrun            = 'X'
    TABLES
      item_data          = item
      sender_item_data   = sender
      sender_period_data = period_sender
      period_data        = period
      return             = return.

  CLEAR return.
  REFRESH return.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    IMPORTING
      return = return.

ENDFORM. " save_doc

*&---------------------------------------------------------------------
*& Form fill_period
*&---------------------------------------------------------------------
*       text
*----------------------------------------------------------------------
FORM fill_period .

  period-item_num = 1.
  period-budgeting_period = poper.
  period-period_amount = '123.45'.
  APPEND period.

  period_sender-item_num = 1.
  period_sender-budgeting_period = poper.
  period_sender-period_amount = '123.45'.
  APPEND period_sender.

ENDFORM. " fill_period

*&---------------------------------------------------------------------
*& Form get_current_period
*&---------------------------------------------------------------------
*      text
*----------------------------------------------------------------------
FORM get_current_period .

  CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    EXPORTING
      i_date  = sy-datum
      i_periv = 'VA'
    IMPORTING
      e_buper = poper.

ENDFORM. " get_current_period


Un saludo.

Desconectado camaron

  • Novato
  • *
  • Mensajes: 2
    • Ver Perfil
Re: BAPI_0050_CREATE
« Respuesta #2 en: 03 de Abril de 2008, 04:38:05 pm »
MUchas Gracias, lo probare
Saludo2


He visto este ejemplo en el SDN.

Si te puede servir de ayuda para ver como rellena los datos...

Código: [Seleccionar]
REPORT ztest LINE-SIZE 80 NO STANDARD PAGE HEADING MESSAGE-ID 00.

DATA: BEGIN OF header.
        INCLUDE STRUCTURE bapi_0050_header.
DATA: END OF header.

DATA: BEGIN OF item OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_item.
DATA: END OF item.

DATA: BEGIN OF sender OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_item.
DATA: END OF sender.

DATA: BEGIN OF period OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_period.
DATA: END OF period.

DATA: BEGIN OF period_sender OCCURS 0.
        INCLUDE STRUCTURE bapi_0050_period.
DATA: END OF period_sender.

DATA: BEGIN OF return OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA: END OF return.

DATA: poper(3) TYPE n,

start-of-selection.

PERFORM update_using_bapi .

*&---------------------------------------------------------------------
*& Form update_using_bapi
*&---------------------------------------------------------------------
*   text
*----------------------------------------------------------------------
FORM update_using_bapi .

  PERFORM get_current_period.
  PERFORM fill_header.
  PERFORM fill_item.
  PERFORM fill_sender.
  PERFORM fill_period.
  PERFORM save_doc.

ENDFORM. " update_using_bapi

*&---------------------------------------------------------------------
*& Form fill_header
*---------------------------------------------------------------------
FORM fill_header .

  REFRESH: item,
  period.

  MOVE sy-datum TO : header-docdate.

  header-fm_area = 'COCD'.
  header-version = '000'.
  header-docstate = '1'.
  header-doctype = '1'.
  header-process = 'TRAN'.
  header-doctype = 'TRAN'.

ENDFORM. " fill_header

*&---------------------------------------------------------------------
*& Form fill_sender
*&---------------------------------------------------------------------
FORM fill_sender.

  sender-item_num = 1.
  sender-fisc_year = '2007'.
  sender-budcat = '9F'.

  sender-budtype = 'TSFS'.

  sender-distkey = '0'.

  sender-fund = '300002'.
  sender-funds_ctr = '101165'.
  sender-cmmt_item = 'CITEM'.
  sender-trans_curr = 'CAD'.
  sender-total_amount = '123.45'.
  sender-valtype = 'B1'.

  APPEND sender.

ENDFORM. " fill_sender

*&---------------------------------------------------------------------
*& Form fill_item
*&---------------------------------------------------------------------
FORM fill_item .


  item-item_num = 2.
  item-fisc_year = '2007'.
  item-budcat = '9F'.

  item-budtype = 'TSFR'.

  item-distkey = '0'.

  item-fund = '300002'.
  item-funds_ctr = '100653'.
  item-cmmt_item = 'CITEM'.
  item-trans_curr = 'CAD'.
  item-total_amount = '123.45'.
  item-valtype = 'B1'.

  APPEND item.

ENDFORM. " fill_item

*&---------------------------------------------------------------------
*& Form save_doc
*&---------------------------------------------------------------------
FORM save_doc .

  DATA: do_commit,
  first VALUE 'X'.

  CLEAR return.
  REFRESH return.

  CALL FUNCTION 'BAPI_0050_CREATE'
    EXPORTING
      language           = 'E'
      header_data        = header
      testrun            = 'X'
    TABLES
      item_data          = item
      sender_item_data   = sender
      sender_period_data = period_sender
      period_data        = period
      return             = return.

  CLEAR return.
  REFRESH return.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    IMPORTING
      return = return.

ENDFORM. " save_doc

*&---------------------------------------------------------------------
*& Form fill_period
*&---------------------------------------------------------------------
*       text
*----------------------------------------------------------------------
FORM fill_period .

  period-item_num = 1.
  period-budgeting_period = poper.
  period-period_amount = '123.45'.
  APPEND period.

  period_sender-item_num = 1.
  period_sender-budgeting_period = poper.
  period_sender-period_amount = '123.45'.
  APPEND period_sender.

ENDFORM. " fill_period

*&---------------------------------------------------------------------
*& Form get_current_period
*&---------------------------------------------------------------------
*      text
*----------------------------------------------------------------------
FORM get_current_period .

  CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    EXPORTING
      i_date  = sy-datum
      i_periv = 'VA'
    IMPORTING
      e_buper = poper.

ENDFORM. " get_current_period


Un saludo.