Sunday 31 July 2016

Calling BAPIs from SAP-ABAP ( BAPI_CREATE_BANK and BAPI_TRANSACTION_COMMIT )


BAPI_CREATE_BANK used to Create Bank.

  1. Object Name :  Bank.
  2. Object Type : BUS1011.
  3. BAPI Method : Create.
  4. BAPIBAPI_CREATE_BANK.
  • To find out the BAPI_CREATE_BANK details.
  • Go to Transaction Code : SWO1.
  • Enter the Object Type name and click on Display.
  • Expand Methods.

  • Double click on Method name.

  • Pop-up will Appear.
  • Click on ABAP Tab , we can find BAPI name.

BAPI : BAPI_TRANSACTION_COMMIT


  1. Object Name :  BapiService.
  2. Object Type : SAP0001.
  3. BAPI Method : TransactionCommit.
  4. BAPI : BAPI_TRANSACTION_COMMIT.
  • To find out the BAPI_TRANSACTION_COMMIT details.
  • Go to Transaction Code : SWO1.

  • Enter the Object Type name and click on Display.
  • Expand Methods.
  • Double click on Method name.
  • Pop-up will Appear.
  • Click on ABAP Tab , we can find BAPI name.

Usage

  • Go to Transaction Code :SE38.
  • Enter the program name which start's with Y or Z< program name > and click on Create.
  • Pop-up will appear.
  • Enter the Title.
  • Select the Attribute Type as : Executable Program.
  • Click on SAVE.
  • Source Code.
DATA BANK_ADDRESS TYPE  BAPI1011_ADDRESS,
       RETURN TYPE BAPIRET2.

BANK_ADDRESS-BANK_NAME 'J.D CRASTA &CO.'.
BANK_ADDRESS-STREET 'BANTWAL'.
BANK_ADDRESS-CITY 'MANGALORE'.
BANK_ADDRESS-BANK_BRANCH 'MANGALORE'.


call function 'BAPI_BANK_CREATE'
  exporting
    bank_ctry             'IN'
   BANK_KEY              '786114'
    bank_address          BANK_ADDRESS
*   BANK_METHOD           =
*   BANK_FORMATTING       =
*   BANK_ADDRESS1         =
*   I_XUPDATE             = 'X'
 IMPORTING
   RETURN                RETURN
*   BANKCOUNTRY           =
*   BANKKEY               =
          .

call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
          .

IF RETURN IS  INITIAL.

  MESSAGE 'The bank is created successfully' TYPE 'S'.

  ELSE.

    WRITE /  RETURN-MESSAGE.

ENDIF.



  • Save -> Check -> Activate.
  • Execute  ( F8 ).

Input- 1

  • Check the status bar.

Test

  • Go to Transaction Code FI03.
  • Enter the details.
  • Press Enter.

Input- 2

  • Execute the Program.

No comments:

Post a Comment