Вы находитесь на странице: 1из 7

Upload tab delimited file from application server to SAP - ABAP Page 1 of 7

SAP Development SAP Reporting File Processing File Upload & Download Fi

Interfacing

Upload Tab delimited file from application server into ABAP intern

ABAP code for uploading a TAB


See code below for structures.
simple txt file.

*&-------------------
---------------------
*& Report
ZUPLOADTAB
*
*&

*&-------------------
---------------------
*& Example of Uploadi
file
*&
*&---------------------------------------------------
REPORT zuploadtab .

PARAMETERS: p_infile LIKE rlgrap-filename


OBLIGATORY DEFAULT '/usr/sap

DATA: ld_file LIKE rlgrap-filename.

*Internal tabe to store upload data


TYPES: BEGIN OF t_record,
name1 like pa0002-VORNA,
name2 like pa0002-name2,
age type i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITI
wa_record TYPE t_record.

*Text version of data table


TYPES: begin of t_uploadtxt,
name1(10) type c,
name2(15) type c,

http://www.sapdev.co.uk/file/file_uptabsap.htm 11/30/2010
Upload tab delimited file from application server to SAP - ABAP Page 2 of 7

age(5) type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.

*String value to data in initially.


DATA: wa_string(255) type c.

constants: con_tab TYPE x VALUE '09'.

*If you have Unicode check active in program attribut


*need to declare constants as follows:

*class cl_abap_char_utilities definition load.


*constants:
* con_tab type c value cl_abap_char_utilities=>HO

*****************************************************
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-na
wa_uploadtxt-na
wa_uploadtxt-ag
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.

*****************************************************
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal ta

* Display report data for illustration purposes


loop at it_record into wa_record.
write:/ sy-vline,

http://www.sapdev.co.uk/file/file_uptabsap.htm 11/30/2010
Upload tab delimited file from application server to SAP - ABAP Page 3 of 7

(10) wa_record-name1, sy-vline,


(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.

Buzz ItShare
0 tweet

Login

z This blog post

z All blog posts

Subscribe to this blog post's comments through...

z
Add
Subscribe in NewsGator Online
z

Add to My Yahoo!
z

Feedblitz
z

Add to Pageflakes
z

Add to Google
z

Subscribe with Bloglines


z

z Add

http://www.sapdev.co.uk/file/file_uptabsap.htm 11/30/2010
Upload tab delimited file from application server to SAP - ABAP Page 4 of 7

http://www.sapdev.co.uk/file/file_uptabsap.htm 11/30/2010
Upload tab delimited file from application server to SAP - ABAP Page 5 of 7

SAP Develpment

Ads by Google
Sap
Excel Sap Upload
ABAP Project
Sap ABAP Consulting
Sap Master Data
ALV
SAP ABAP List viewer
ABAP Reporting
SAPscript
Presenting data using
SAPScripts
SAP Help
SAP development
ABAP Help
ABAP development code
Dialog screens
ABAP dynpro screen
development
BAPI/RFC
Calling BAPI's and RFC's
File Upload and
Download
MS interface
Integrating SAP and
Microsoft
ABAP Performance
Improve performance
Testing / eCATT
Test SAP programs
SAP Graphics
Using graphics in sap
programs
MINISAP
Stand alone SAP system
for you home PC
SAP Upgrade
Upgrading your SAP ERP
system
SAP Currency /
Language conversion
Converting your SAP
system to handle mutiple
currencies/languages
SAP Security and
Authorisations
Security topics such as
authority checking and
password fields

SAP Netweaver

SAP Web
development
Developing SAP web

http://www.sapdev.co.uk/file/file_uptabsap.htm 11/30/2010
Upload tab delimited file from application server to SAP - ABAP Page 6 of 7

If you have a website, link to it here.

OpenID URL http://

Comment as a Guest or login using OpenID Sim


Submit Comment Upd
Subscribe to None SUN
** S
Comments by IntenseDebate SUN
** S

SAP
** S
PRO
MAN

SAP
** A
MAN
MAN
MAN

SAP
This
FI C
CON

http://www.sapdev.co.uk/file/file_uptabsap.htm 11/30/2010
Upload tab delimited file from application server to SAP - ABAP Page 7 of 7

Website Navigation to related information

ABAP file processing within SAP ABAP upload and down


Processing files stored in SAP or your PC via ABAP Upload and download d
programming
SAP File selection popu
Display file selection wi

Contact Us Message Board Partners Terms of Service Privac

http://www.sapdev.co.uk/file/file_uptabsap.htm 11/30/2010

Вам также может понравиться