Sending EMail "Text-File" from Application Server!
Hi Experts,
how can I sending a Text-File from Application Server via Email?
Is there existing a Function Modul?
With Kind regards
Ersin
Moderator message: sending emails = FAQ, please search before posting.
Edited by: Thomas Zloch on Nov 25, 2010 4:23 PM
STF (Search the forum)! This type of question has been asked...and answered....many times.
Similar Messages
-
Download text file from application server to client server.
Hi all,
I am facing a format issue while downloading text file from application server to the client machine.
The issue is that, say I have 6 to 10 lines in my text file in application server. but when i store it on the hard drive,
it shoes all the data in a single line. Where as i need to download data in same format as in application server.
Awaiting for your responses.
Regards,
JoseHi,
If we want to upload file data from the application server to the internal table, there is no function module or class static method which we can use, we must wirte the code by ourselves.
1. For the file data which has no seperator between field columns.
PARAMETERS p_file TYPE dxfile-filename.
START-OF-SELECTION.
OPEN DATASET p_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
DO.
READ DATASET p_file INTO gds_data.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND gds_data TO gdt_data.
ENDDO.
CLOSE DATASET p_file.2. For the file data which has tab separator between field columns.
DATA: gds_field_split type gts_data.
FIELD-SYMBOLS: <fs_field> TYPE gts_data.
PARAMETERS p_file TYPE dxfile-filename.
START-OF-SELECTION.
OPEN DATASET prf_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
DO.
READ DATASET p_file INTO gds_field.
SPLIT gds_field AT cl_abap_char_utilities=>horizontal_tab
INTO TABLE gdt_field_split.
LOOP AT gdt_field_split into gds_field_split.
gdf_index = gdf_index + 1.
ASSIGN COMPONENT gdf_index OF STRUCTURE
gds_data to <fs_field>.
IF sy-subrc = 0.
<fs_field> = gds_field_split.
ENDIF.
ENDLOOP.
APPEND gds_data TO gdt_data.
ENDDO.
CLOSE DATASET p_file.
Thanks & regards,
ShreeMohan -
Downloading a text file from application server
Hi Freinds,
I am genarating a text file in our application server (Folder /usr/sap/dbi/) I need to download this text file in my destop pc or some other windows server.
What do I have to do? What is the procedure, Pls help.
If someone have sample code, pls send.
We are running SAP ECC5.0 on an iSeries (AS/400) Database DB2/400.
Regards
ThanuraHi,
try this:
REPORT ZGRO_TEST.
DATA: DATEI_A(30) TYPE C VALUE '/tmp/matnr.txt'.
DATA: DATEI_PC TYPE STRING VALUE 'C:\MATNR.TXT'.
DATA: ITAB TYPE TABLE OF MARA WITH HEADER LINE.
START-OF-SELECTION.
PERFORM DATEI_EINLESEN.
PERFORM DATEI_DOWNLOAD.
FORM DATEI_EINLESEN.
OPEN DATASET DATEI_A FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0. STOP. ENDIF.
DO.
READ DATASET DATEI_A INTO ITAB.
IF SY-SUBRC <> 0. EXIT. ENDIF.
APPEND ITAB.
ENDDO.
CLOSE DATASET DATEI_A.
IF SY-SUBRC NE 0. STOP. ENDIF.
ENDFORM. "DATEI_EINLESEN
FORM DATEI_DOWNLOAD.
Datei downloaden
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = DATEI_PC
FILETYPE = 'ASC'
CHANGING
DATA_TAB = ITAB[]
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
OTHERS = 24.
IF SY-SUBRC NE 0. STOP. ENDIF.
ENDFORM. "DATEI_DOWNLOAD
Regards, Dieter -
I am facing problem to get text file from application sever
Hi This is lokesh.
Actually my requirement is to craete sales orders by getting file from other server.for that i have used shell script to connect that server.Ok i am connecting to that different server(not sap server) successfully.
But my problem is getting text file from application SERVER.
That different server people will send the file name as 'DDHHMMSS' (Days,Hours,Minutes,Seconds).
Just suppose if they will send today means that file name will come as 20103025. and with in half an hour if they again send that file file means that file name as '20110025'.
like that file name is always varies.So how can i read that type of text files from the application server.
and one more thing that is there chance to read morethan one text file from application server.
Pls guide me if u know the solution.PLs this requirement is urgent.
Regards,
LokeshgoudHi..,
<b>Just execute this program ... this is for the files received in JUST 3 MINS...</b>
change it according to your requirement !!
data time type sy-uzeit value '100000'. <i>"<<----start time</i>
data file(8) type c value '20'.
do 180 times. <i>" <<----- for 3 minutes</i>
add sy-index to time.
concatenate file time into file.
write / file.
OPEN DATASET FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
PERFORM READ_DATASET.
ENDIF.
file = '20'.
time = '100000'.
ENDDO.
<b>form read_dataset.
read the file here with the file name <b>FILE</b>.
endform.</b>
regards,
sai ramesh -
File from application server-- Email ?
Hi,
I need to pickup a file from application server and Email the same to the intended receipents through ABAP program
For that i had used the following code:
REPORT ZEMAIL_APP_SER_FAIL.
DATA :is_doc_chng TYPE sodocchgi1,
it_objtxt TYPE STANDARD TABLE OF solisti1,
is_objtxt TYPE solisti1,
it_objpack TYPE STANDARD TABLE OF sopcklsti1,
is_objpack TYPE sopcklsti1,
it_objbin TYPE STANDARD TABLE OF solisti1,
is_objbin TYPE solisti1,
it_reclist TYPE STANDARD TABLE OF somlreci1,
is_reclist TYPE somlreci1,
w_lines_tx TYPE i.
** Create Message Body
** Title and Description
*is_doc_chng-obj_name = 'MAIL'.
is_doc_chng-obj_descr = 'Auto genareted Mail from Application server'.
** main text
is_objtxt-line = 'This is an automatically generated mail. Please do not reply to it.'(028).
APPEND is_objtxt TO it_objtxt.
is_objtxt-line = space.
APPEND is_objtxt TO it_objtxt.
* write packing list (main)
DESCRIBE TABLE it_objtxt LINES w_lines_tx.
READ TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx.
is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ).
CLEAR is_objpack-transf_bin.
is_objpack-head_start = 1.
is_objpack-head_num = 0.
is_objpack-body_start = 1.
is_objpack-body_num = w_lines_tx.
is_objpack-doc_type = 'CVS'.
is_objpack-OBJ_NAME = 'GIND_EXP'.
is_objpack-Obj_langu = 'E'.
APPEND is_objpack TO it_objpack.
is_reclist-receiver = 'XXX'@'YYY'.COM'.
is_reclist-rec_type = 'A'.
Break-point.
*is_reclist-REC_ID = 'XXX@YYY'.COM'.
APPEND is_reclist TO it_reclist.
CLEAR is_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = is_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_objpack
contents_txt = it_objtxt
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
when i execute this program:
I get the following error msg:
Activation setting not yet maintained
May i know what is the problem?If you are sending an email, the receiver type should be U (internet mail address type). From your code it appears that you have input it as 'A'. I am not sure if the error message is related to this. Have you checked in transaction SOST, whether an email has been triggered from your program? At what point of execution is this error message triggered?
-
Hi Guys,
I want to pick file from application server as an attachment and send as mail.
Thanks*This program will allowed you to send email with attachment.
First, specify the attachment file from your local hardisk and execute.
Next, specify the sender email address and click the send button.
report z_mail.
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara like selc occurs 0 with header line.
data g_objparb like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
text(4096) type c,
end of g_files.
data : fold_number(12) type c,
fold_yr(2) type c,
fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
importing
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
*g_document-OBJYR = '27'.
*g_document-OBJNO = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes = 'sap-img.com testing by program'.
g_document-folrg = 'O'.
*g_document-okcode = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'sap-img.com testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header.
*-- End of Program -
How to delete the Generated files from application server(open hub)?
hi experts,
when i try to execute process chain the DTP it is giving below dump. Exception CX_RSBK_REQUEST_LOCKED logged.
when i execute the DTP manually and trying to delete the previous request, it is giving for dump ITAB_DUPLICATE_KEY.
so to delete the generated file from application server, how to delete it for specific dates?
Information on where terminated
Termination occurred in the ABAP program "GPD6S3OE0BCVGC6L9DBNVYQARZM" - in
"START_ROUTINE".
The main program was "RSBATCH_EXECUTE_PROZESS ".
In the source code you have the termination point in line 2874
of the (Include) program "GPD6S3OE0BCVGC6L9DBNVYQARZM".
The program "GPD6S3OE0BCVGC6L9DBNVYQARZM" was started as a background job.
and when i check the dump it is point out at below code
" Populate the lookup table for 0STOR_LOC
SELECT * from /BI0/TSTOR_LOC
into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
but the programme is syntactically correct only.
how to rectify the issue.
regards
venuscm
Edited by: venugopal vadlamudi on Sep 28, 2010 1:59 PMhi experts,
We have written start routine to get the storage location text and sending to File located at Application server through OPEN HUB.
here is the code written in the Transformations
In the global section
Text for 0STOR_LOC
DATA: l_0stor_loc_text TYPE HASHED TABLE OF /bi0/tstor_loc
WITH UNIQUE KEY stor_loc.
DATA: l_0stor_loc_text_wa TYPE /bi0/tstor_loc.
and in the code to get the text
" Populate the lookup table for 0STOR_LOC
*SELECT * from /BI0/TSTOR_LOC*
into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
im sure there is problem with the Routine only. i think i need to change the code if so please provide me the modified one.
thanks
venuscm
Edited by: venugopal vadlamudi on Sep 29, 2010 9:37 AM -
How to download a text file from the server
hi everyone,
can anyone tell me how to download and read a text file from the server and saved in into resource folder.
with regards
pallaviits really easy
To read from server, use something like:
HttpConnection connector = null;
InputStream inp_stream = null;
OutputStream out_stream = null;
void CloseConnection()
if(inp_stream!=null)inp_stream.close();
inp_stream=null;
if(out_stream!=null)out_stream.close();
out_stream=null;
connector.close();
connector = null;
public void getResponse(String URL,String params)
try
if(connector==null)connector = (HttpConnection)Connector.open(URL);//URL of your text file / php script
connector.setRequestMethod(HttpConnection.POST);
connector.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.1");
connector.setRequestProperty("content-type", "application/x-www-form-urlencoded");
//connector.setRequestProperty("charset","windows-1251");
//*** If you need to send ("arg1=value&arg2=value") arguments to script use this:
out_stream = connector.openOutputStream();
byte postmsg[] = params.getBytes();
out_stream.write(postmsg);
int rc = connector.getResponseCode();//in any case here connection will be opened & closed
if (rc != HttpConnection.HTTP_OK)
CloseConnection();
throw new IOException("HTTP response code: " + rc);
inp_stream = connector.openInputStream();
int pack_len = inp_stream.available();
byte answ[]=new byte[pack_len];
inp_stream.read(answ);
CloseConnection();
ProcAnswer(answ);//process received data
catch(Exception ex)
System.err.println("ERROR IN getResponse(): "+ex);
} And you can read from resource file like
public void loadFile(String filename)
DataInputStream dis = new DataInputStream(getClass().getResourceAsStream("/"+filename));
String str="";
try
while (true)
ch = dis.read();//read character
if(ch=='\r')continue;//if file made in windows
if(ch=='\n' || ch==-1)//end of line or end of file
if(str.length()==0)continue;//if empty line
//do some thing with "str"
if(ch==-1)break;//it was last line
str="";//next line
continue;
str+=(char)ch;
dis.close();
catch (Exception e)
System.err.println("ERROR in loadFile() " + e);
}Welcome! =)
Edited by: MorskoyZmey on Aug 14, 2008 3:40 AM -
Not able to get file from application server with read dataset
Hi,
Firstly i download a file from application server from read data set and then i sent this file as attachment. But problem is that i am able to send .jpg .bmp file but i am not able to send .pdf or .doc file so what can i do for that. ?
My code is like below...
DATA : PATH TYPE STRING.
DATA: E_FILE LIKE RLGRAP-FILENAME.
CONCATENATE '/tmp/' NAME_WITH_EXT INTO E_FILE SEPARATED BY SPACE.
CONDENSE E_FILE NO-GAPS.
IF EXTENSION = 'TXT'.
OPEN DATASET E_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT WITH WINDOWS LINEFEED . " MESSAGE MSG.
IF SY-SUBRC <> 0.
WRITE: SY-SUBRC, MSG, ' LIKE ', C_FNAME.
ELSE.
WHILE SY-SUBRC = 0.
READ DATASET E_FILE INTO WA_C.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
APPEND WA_C TO IT_C.
ENDWHILE.
CLOSE DATASET E_FILE.
ENDIF.
ELSE.
OPEN DATASET E_FILE FOR INPUT IN BINARY MODE. " ENCODING DEFAULT. " INPUT IN BINARY MODE . " TEXT MODE ENCODING NON-UNICODE.
IF SY-SUBRC = 0.
DO .
READ DATASET E_FILE INTO GS_PDF_TAB.
IF SY-SUBRC = 0.
APPEND GS_PDF_TAB TO GT_PDF_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET E_FILE.
ENDIF.
ENDIF.
Regards,
Gurprit Bhatiadelete this line DEFAULT WITH WINDOWS LINEFEED and check this..
-
File from application server -Read and process and delete the file .
Hi All,
I writing a ZEE program which will read the file from application server(file will be in text delimat format) and moving the data to internal table and uploadind data base.The part which iam facing problem is -
> I hve read the file from application server like below ,
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
EXIT.
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-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
Spliting part i having problem .i need to seperate each field which is seperate from tab delimite and pass it into respective fields of internal table .
Second if another file come to the appicaltion server , wether my first file will be there ? or should i need to delete the first file after redaing how should i proceed further ?.
Regards
SRIRAM...
THANKS In ADVANCEHI,
1.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
EXIT.
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 cl_abap_char_utilities=>horizontal_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
APPEND wa_uploadtxt TO itab.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
2. If the another file get's generated in the application server with same file name then the data in old file get's over written with the new data. You are not required to delete the file. -
Regarding Reading the file from Application Server
Hi,
I am trying to read data from Application Server but due to special characters it is getting dumped out.
US24,Q,Acero (Carbon),AA,0010,0001,01,Ver Mir para dimension#
US24,Q,Acero (Carbon),AA,0010,0002,01,Area rectificada sin da#os ra
US24,Q,Acero (Carbon),AA,0010,0003,01,Ver Mir para dimension#
US24,Q,Acero (Carbon),CD,0010,0001,01,ITPE Soken para verificacion
US24,Q,Acero (Carbon),CD,0010,0010,01,No se permite desprendimiento
US24,Q,Acero (Carbon),CD,0010,0002,01,"Vernier, cinta metrica"#
In the last line it is going into dump due to special character ".
Please suggest.
Thanks
Priyanka.Hi,
You can check the mode in which you are reading the file
from application server that is
Open Dataset in Binary or Text Mode.
Hope it helps
Regards
Mansi -
Uploading and reading file from application server
Hi
My problem is when am uploading a file to application server it is getting stored in
usr/sap/transyp1/prod/in directory
after that i want to read that file from application server to update database
when using below code it is showing some other directory in f4 help
DATA: lv_hostname TYPE msxxlist-name.
DATA: lv_server TYPE bank_dte_jc_servername.
PARAMETERS: p_file TYPE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
IMPORTING
e_server = lv_server.
lv_hostname = lv_server.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FILE'
dyname = sy-cprog
dynumb = '1000'
filetype = 'P'
location = 'A'
server = lv_hostname.
experts could you please help me out
Thanks & Regards
Nagesh.ParuchuriUser Transaction file. You will get all logical file path names.
used following fucntion module to read file name and use command open dataset to read the file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = C_LOGICAL_FILENAME
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = P_IN_FILENAME
IMPORTING
FILE_NAME = P_OUT_FILENAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
IF SY-SUBRC <> 0.
MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
ENDIF. -
Problem during retriving file from application Server
Hi all,
i am trying to upload a world file (from desktop ) on application server and
retrieve it back on local desktop.
during retrieval of file from application server i am getting all the data in encoded format .
i am using -
open DATASET p_fpath for output in text mode encoding UTF-8 WITH SMART LINEFEED.
plz help.Hi,
use the tcodes CG3Y and
CG3Z
Or
try with this command
open DATASET p_fpath for output in text mode encoding default.
Regards,
nagaraj -
Reading tab delimited file from application server
Hi All,
I do know that we need to use Open data set to read a file from application server, but my question is when you use read DATASET v_file into wa_final - this wa_final is an work area and also i have mentione an internal table. so do we need to Split the record at tab into the corresponding fields. Append the records into an internal table i_input.????
Please let me know on this....
thanks in advance....
Poonam....Hi,
first see the file contents in application server, how the contents whether the contents seperated by any symbol or not, if the contents seperated by any symbol then you have to split the data before appending to internal table.
check this code.
DATA: l_data_string TYPE string.
filename = p_file.
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET filename INTO l_data_string.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CLEAR k_input.
SPLIT l_data_string AT '#' INTO k_input-agreement k_input-suffix k_input-status
k_input-first_name k_input-last_name k_input-job_title k_input-tel k_input-fax k_input-email_address k_input-mob_number.
APPEND k_input TO i_input.
ENDDO.
ENDIF.
Regards,
Venu -
Read Tilda separated file from Application Server
I have a requirement to read a tilda separated file from application server and write a tilda separeted output to application server. Please suggest how to to get data from tilda separated file to internal table ? and also How to create a tilda separated file from internal table to application server.
Hi again,
This some sample code for outputing data on application server with tilda separator.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. " MESSAGE msg.
IF sy-subrc <> 0.
message i812(LQ).
LEAVE LIST-PROCESSING.
ENDIF.
LOOP AT gs_input INTO wa_input.
CONCATENATE wa_input-wadat_ist
wa_input-sort2
wa_input-name1
wa_input-street
wa_input-region
wa_input-post_code1
wa_input-zzchep
wa_input-vbeln
wa_input-bstkd
wa_input-zfrom
wa_input-zland
wa_input-zccode
wa_input-zrcvd
wa_input-zfref
wa_input-znorc
wa_input-zsepr
wa_input-zvers
wa_input-zlout
wa_input-zinfo
wa_input-zinco
wa_input-zsqal
wa_input-zscod
wa_input-zrqal
wa_input-zeqal
wa_input-zecod
wa_input-zcust
wa_input-ztran INTO g_path SEPARATED BY '~'.
TRANSFER g_path TO p_file.
CLEAR : g_path, wa_input.
ENDLOOP.
CLOSE DATASET p_file.
Hope this will be helpful for you.
Regards,
Vijay
Maybe you are looking for
-
Mavericks: Emacs and Terminal randomly scroll / jump around (unwanted scrolling)
Both terminal and emacs just randomly jump around from time to time, often by a full viewing page or more. I assume this has something to do with "responsive scrolling" and the other scrolling bugs (mostly involving sudden failure to scroll) reported
-
Urgent: How to make transaction iVews check the connetion all time
Hi! We have an EP7 connected to an ECC6. We find out the EP7's transaction iViews can communicate with the ECC6 even the connection between them is cut off after the user logged into EP7. So seems EP7 session remembers the connection. We do not want
-
Track List Alphabetizing itself in Library
Hi, When I import tracks, I sometimes rename them When I do this, my iTunes library will alphabetize itself and if I want to burn them from my library I will not know the original order. If I create a Playlist 1st and import them into that before I c
-
[Solved] pacman-color failed to install missing dependencies
Just upgraded my AUR packages and I get this error: :: Starting AUR upgrade... :: perl-class-load-xs 0.04-2 -> 0.06-1 AUR Targets (1): perl-class-load-xs Proceed with installation? [Y/n] y :: Edit perl-class-load-xs PKGBUILD? [Y/n] n :: Building perl
-
We're stuck on ADSL1, when we need ADSL2+ for 'upt...
Can anyone help? Have been a BTInternet customer for over 12 years and have recently upgraded the 2mb broadband package to the £24.99 a month 'upto' 20mb package. The changeover was far from straightforward, with mistakes at BTInternet's end, but on