Monday, April 8, 2013

0 Uploading Data Using BAPI ( BAPI_BANK_CREATE )


*&---------------------------------------------------------------------*
*& Report  ZBAPI1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report  zbapi1 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.

data: wa_return 
like bapiret2.

*CALL FUNCTION 'UPLOAD'
*  EXPORTING
*    filetype = 'DAT '
*  TABLES
*    data_tab = lt_data.

*//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_CREATE'
  
exporting
    bank_ctry    = wa_data-bctry
    bank_key     = wa_data-bkey
    bank_address = wa_add
  
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