Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

outbound interface using file concept

Former Member
0 Kudos

Hi,

Please send me example program for transfering data through application server.

ex: open dataset file for output or input.

Thanks

Ali

1 REPLY 1

Former Member
0 Kudos

Is this the type of thing you mean? A "real" version would need validations etc, but it should give you the idea of what might be needed.

Jonathan

report zlocal_jc_sdn_extract_to_file.                                                                                
parameters:                                                            
  p_fname            like rlgrap-filename obligatory.                                                                                
start-of-selection.                                                    
  perform create_extract.                                                                                
*---------------------------------------------------------------------
* form create_extract.                                                   
*---------------------------------------------------------------------
form create_extract.                                                                                
data:                                                                
    l_text                   like sy-ucomm,                            
    begin of ls_data,                                                  
      matnr                  like makt-matnr,                          
      maktx                  like makt-maktx,                          
    end of ls_data,                                                    
    lt_data                  like ls_data occurs 100.                                                                                
select matnr maktx into corresponding fields of table lt_data        
    from makt                                                          
    where spras = sy-langu.                                                                                
if lt_data[] is initial.                                              
    exit.                                                               
  endif.                                                                                
open dataset p_fname for output in text mode. "encoding default.                                                                                
l_text = 'This is a header'.                                          
  transfer l_text to p_fname.                                                                                
loop at lt_data into ls_data.                                         
    transfer ls_data to p_fname.                                        
  endloop.                                                                                
l_text = 'This is a footer'.                                          
  transfer l_text to p_fname.                                                                                
close dataset p_fname.                                                                                
endform.