Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8989

BAPI_0050_CREATE for Budget Transfer

$
0
0

Dear Sir,

I am using BAPI_0050_CREATE  for transfer of budget , during  the execution no error was reported and the BAPI got executed successfully but no document was posted . We verified the same using tcode FMB_PT01 and found that no document was posted during BAPI execution .

 

The sample BAPI code is mentioned below .

We request forum members to kindly help me please .

 

With Regards

 

B Mittal

============================================================================================

*&---------------------------------------------------------------------*
*& Report  ZTESTB1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*



REPORT ztestb1 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 = '1000'.
   header-version = '000'.
   header-docstate = '1'.
*  header-doctype = '1'.
   header-process = 'TRAN'.
   header-doctype = '0001'.
   header-docdate = sy-datum.
*  header-PSTNG_DATE = sy-datum.
ENDFORM. " fill_header

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

   sender-item_num = 1.
   sender-fisc_year = '2015'.
   sender-budcat = '9G'.

   sender-budtype = 'BT01'.

   sender-distkey = '0'.

*  sender-fund = '300002'.
   sender-funds_ctr = 'M2999'.
   sender-cmmt_item = 'MISC'.
   sender-trans_curr = 'INR'.
   sender-total_amount = '22'.
   sender-valtype = 'B1'.

   APPEND sender.

ENDFORM. " fill_sender

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


   item-item_num = 2.
   item-fisc_year = '2015'.
   item-budcat = '9G'.

   item-budtype = 'BT01'.

   item-distkey = '0'.

*  item-fund = '300002'.
   item-funds_ctr = 'M2999'.
   item-cmmt_item = 'E'.
   item-trans_curr = 'INR'.
   item-total_amount = '22'.
   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 = 2.
   period-budgeting_period = '1'.
*  period-budgeting_period = poper.
   period-period_amount = '22'.
   APPEND period.

   period_sender-item_num = 1.
   period_sender-budgeting_period = '1'.
*  period_sender-budgeting_period = poper.
   period_sender-period_amount = '22'.
   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 = 'V9'
     IMPORTING
       e_buper = poper.

ENDFORM. " get_current_period


Viewing all articles
Browse latest Browse all 8989

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>