Monday, April 8, 2013

0 CHANGING DATA IN THE DATA BASE TABLE BY USING BAPI FOR “FI01” TCODE


*&---------------------------------------------------------------------*
*& Report  ZBAPI2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zbapi2 NO STANDARD PAGE HEADING.

DATA:BEGIN 
OF wa_data,
     bctry 
LIKE bapi1011_key-bank_ctry,
     bkey  
LIKE bapi1011_key-bank_key.
        
INCLUDE STRUCTURE bapi1011_address.
DATA END OF wa_data.


DATA lt_data LIKE TABLE OF wa_data.



DATA : wa_add LIKE bapi1011_address,
       WA_ADD1 
LIKE BAPI1011_ADDRESSX.

DATA: wa_return 
LIKE bapiret2.

*CALL FUNCTION 'UPLOAD'
*  EXPORTING
*    filetype = 'DAT '
*  TABLES
*    data_tab = lt_data.
WA_ADD1-BANK_NAME = 
'X'.
WA_ADD1-REGION    = 
'X'.
WA_ADD1-STREET    = 
'X'.
WA_ADD1-CITY      = 
'X'.
WA_ADD1-POBK_CURAC = 
'X'.

*//Local Varible delaration
DATA:con_path 
TYPE string.

*// Selection screen design
PARAMETERS : p_path TYPE rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
  
CALL FUNCTION 'F4_FILENAME'
    
EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    
IMPORTING
      file_name     = p_path.

START-OF-SELECTION.
  con_path = p_path.
*//Uploading Data from Prsenetation Server
  
CALL FUNCTION 'GUI_UPLOAD'
    
EXPORTING
      filename = con_path
      filetype = 
'ASC'
    
TABLES
      data_tab = lt_data.

  
LOOP AT lt_data INTO wa_data.
    
MOVE-CORRESPONDING wa_data TO wa_add.
    
CALL FUNCTION 'BAPI_BANK_CHANGE'
      
EXPORTING
        bankcountry          = WA_DATA-BCTRY
        bankkey              = WA_DATA-BKEY
        bank_address         = WA_ADD
        bank_addressx        = WA_ADD1
      
IMPORTING
       
RETURN               = WA_RETURN.




    
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

    
IF NOT wa_return IS INITIAL.
      WRITE:/ wa_return-message.
    ENDIF.
  ENDLOOP.

  
IF SY-SUBRC EQ 0.
    WRITE: 
'SUCCESS'.
  ENDIF.
 

SAP-ABAP Copyright © 2011 - |- Template created by Vishnu - |- Powered by Blogger Templates