How to zip a file in abap
Hi folks,
plz help me out with the code to zip a file .I have a zip a file...Kindly help me out...I tried with ws_execute but unable to do ....
Regards,
Raj
Hi,
have a look at this:
abap gzip zip
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/gzip
Best regards.
Edited by: pablo casamayor on Mar 31, 2008 3:18 PM
Similar Messages
-
How to zip multi files into one zip file in ABAP
hi all:
As you know, ABAP has CL_ABAP_GZIP class to support zip file function. But it only support one file zip. If I want to zip two files into one zip file, how to do it?
thanks.Hi,
<li>If you know how to zip one file, to zip two files , you can follow the below steps.
DATA:g_zipper TYPE REF TO cl_abap_zip.
"create our zipper object
CREATE OBJECT g_zipper.
"add 1st file to zip
CALL METHOD g_zipper->add
EXPORTING
name = file_name
content = content_x.
"add 2nd file to zip
CALL METHOD g_zipper->add
EXPORTING
name = file_name
content = content_y.
"save zip
CALL METHOD g_zipper->save
RECEIVING
zip = zip.
Thanks
Venkat.O -
How to Zip Excel files using File Adapter?
Hi,
We have tried to ZIP the Excel file with PayloadZipBean in File adapter. But we faced some issue while zipping.
We have seen some zunk data in excel file after zipping with PayloadZipBean. Someone please help how to zip Excel files in PI with File Adapter.
Regards,
Sreeramulu Konjeti.Hi Sree,
If you are facing any issue with PayloadZipBean then you can use java mapping to Zip the files.
Please find the complete Java mapping code to zipt the file
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50ce0433-4309-2b10-4bb4-d421e78463f7?quicklink=index&overridelayout=true -
How to zip one file i have on disk with java.util.zip
I don't know how to zip a file. I managed to do new html file, but i don't know how to zip it.
This is my code:
PrintWriter pw = new PrintWriter (new FileWriter(export), true);
Thanks!heres a zipper class i wrote which i have butchered a bit to make more generic (its basic and at present only takes one zipentry etc, but very simple and should be easy to extend etc) Just pass it your file in its constructor and then call its zipme method. PS if it can be made better let me know so i can update my class, cheers.
import java.io.*;
import java.util.zip.*;
import java.awt.*;
class zipper
public File file;
public zipper(File f)
file = new File(f);
public void zipme()
try
FileInputStream fin = new FileInputStream(file);
int a = (int)file.length();
byte b[] = new byte[a];
fin.read(b);
ZipEntry k = new ZipEntry(fin.getName());//represents a single file in a zip archive!
File newFile = new File("D:\\AZipFile.zip");
ZipOutputStream zi = new ZipOutputStream(new FileOutputStream(newFile));
zi.putNextEntry(k);
zi.write(b,0,a);
zi.close();
fin.close();
catch(FileNotFoundException e)
//System.out.println("ERROR File not found");
catch(IOException ee)
//System.out.println("ERROR IO exception in Zipping file");
} -
How to ZIP the files and folders/sub folder files using java
HI All,
I'm New to this Forum, Could anybody tell me how to zip the files and folders/sub folders using java. For example I have a folder with the name testfolder and side that folder I have some files and some sub folders inside subfolders I have some other files. I need to ZIP the files and folders as they are in same hierarchy.
Any pointers or help wolud be appritiated.
Thanks,
Rajeshbabu V[http://www.devx.com/tips/Tip/14049]
-
How to zip a file on mac pro?
how to zip a file on mac pro?
Tristan,
Select multiple items that you want to zip, right click and choose "Compress XX Items." -
How to Zip a file and find it size using ABAP code
Hi All,
My requirement is to extract a file from Al11 ZIP it and find it size.
Please let me know whether there are any Function modules or Classes for Zipping and finding the size of it.
Note : Used Class "cl_abap_zip" but the output at in chinese language.
Thanks in advancve for your support.
Regards
JithuCheck https://wiki.sdn.sap.com/wiki/display/profile/GZIP
and how to zip and unzip a file in abap
May it useful
Kanagaraja L -
How to Zip server files(in a directory) and throwing back to client
Can someone tell me how to zip all the files in a particular directory of my web application and throwing back to client to give option for save that zipped file.
i have used the below used function to zip in servlet. But I cann't zip a particular directory of my application in server.
Please help
private void zipDir(String dir2zip, ZipOutputStream zos)
try
//create a new File object based on the directory we
// have to zip File
File fileDir2Zip = new File(dir2zip);
System.out.println("is directory ..."+fileDir2Zip.isDirectory());
//get a listing of the directory content
String[] dirList = fileDir2Zip.list();
for(int i = 0 ; i < dirList.length ; i++)
System.out.println("Dir list ..."+dirList);
byte[] readBuffer = new byte[2156];
int bytesIn = 0;
//loop through dirList, and zip the files
for(int i=0; i<dirList.length; i++)
File f = new File(fileDir2Zip, dirList[i]);
if(f.isDirectory())
//if the File object is a directory, call this
//function again to add its content recursively
String filePath = f.getPath();
zipDir(filePath, zos);
//loop again
continue;
//if we reached here, the File object f was not
//a directory
//create a FileInputStream on top of f
FileInputStream fis = new FileInputStream(f);
//create a new zip entry
ZipEntry anEntry = new ZipEntry(f.getPath());
//place the zip entry in the ZipOutputStream object
zos.putNextEntry(anEntry);
//now write the content of the file to the ZipOutputStream
while((bytesIn = fis.read(readBuffer)) != -1)
zos.write(readBuffer, 0, bytesIn);
System.out.println("Last");
//close the Stream
fis.close();
catch(Exception e)
e.printStackTrace();Hi
Whatever file exist in directory should execute with out any condition because they delete all files after exection of my process chain. They are using another process chain once a day for deletion of all files in that directory.
So directory always contains fresh files.
Here by using routine in infopackge i am unable to run all files one by one at a time.
As of my knowledge by using infopackage we can run only one file at a time.
Here my question is , can we run more than one file in single run of infopackage?
or can we have any function module to run the infopackage from externally? so that i can use function module in abap program? any ideas..
Regards
Raju -
How to ZIP, PDF file attachment
Hi,
I have an ABAP report requirement to send an email to a user. This program will send an email with PDF attachement. However, the PDF attachment is quite big (9MB) and our email server couldn't handle it (5MB only). Is there any way to ZIP this PDF file attachment?
I am using a SAP release ECC 6.0with OS WinNT. And the ABAP program should be able to run in Foreground/Background.
Thanks for your help in advance...Hi,
Try this code:
data ca_attach_zip(22) TYPE c VALUE 'Attch.',
OPEN DATASET va_filename_zip FOR INPUT IN BINARY MODE.
DO.
READ DATASET va_filename_zip INTO objbin.
IF sy-subrc NE 0. EXIT. ENDIF.
APPEND objbin.
ENDDO.
APPEND objbin.
DESCRIBE TABLE objbin LINES tab_lines.
CLOSE DATASET va_filename_zip.
DELETE DATASET va_filename.
DELETE DATASET va_filename_zip.
DESCRIBE TABLE objbin LINES tab_lines.
objhead = ca_attach_zip.
APPEND objhead.
***Creation of the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = ca_zip.
objpack-obj_name = ca_attach_zip.
objpack-obj_descr = ca_attach_zip.
objpack-doc_size = tab_lines * ca_255.
APPEND objpack.
*** Completing the recipient list
reclist-receiver = va_mail_address.
reclist-express = 'X'.
reclist-rec_type = 'U'.
APPEND reclist.
*** Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = ca_x
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = 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.
You have to load your file in the contents_bin table of FM.
You can load the file by OPEN DATASET and the READ DATASET command.
In the object_header you can put some description.
For your info:
1. Zip the data and send as an email attachment
2. How to Zip the data in an internal table
3. Re: How to ZIP a PDF file email attachment
May it helps you.
Regards.
Deepak Sharma. -
How to display HTML files using ABAP Webdynpro?
Hi,
I have a html index file and a bunch of other files accessed by the index file in a specific directory on the SAP server. I'd like to display the index file via ABAP webdynpro and allow the users to click on what they need to see. How can I achieve this using utilizing the ABAP webdynpro technology ?
Thanks!Hi Thomas,
Thanks for taking the time to answer my question.
I have the main html file and all other files needed by the main file in one directory on the application layer of SAP. I'd like to provide the user with a link, by clicking on which they should be able to get to the main html file using the browser. This is just a standalone application.
I can try the approach using BSPs, however, I'm new to that area. Could you point me in the right direction to get started? -
How to zip keynote files?
How to Zip or Reduce Keynote Files?
Newer versions of Keynote zip the documents as part of the save process by default; these files can't be compressed much further without losing content. To check, control-click the document in the Finder and see if Show Package Contents is an option; if not, it's already zipped. If it is, choose to compress or archive it from that menu.
(63532) -
How to print external file using ABAP program
Hello
I want to print an external file which is located in server (
20.99.0.18\GUI\xyz\8.0QUALITY\QM_TS.DOC) .....i want to print these kind of files(which i have retrieved from table 'DRAW' field 'filep' )......i need to print these files using ABAP program.
thank you
Vikram.
Message was edited by:
Vikram Bojjaextract the data and pass to script or smartform for printing
-
How to create .csv file from ABAP report
Hi
We have a requirement to generate .csv file from abap report.
Currently user saves data from abap report to spreadsheet(.xls format) in desktop. Then opens excel file and save as .csv format. Need option to save directly in .csv format instead of .xls format.
Please let me know, if there is any standard function module available to create .csv file.
Regards
UmaI tried with your code it's going to dump
REPORT ZTEMP101 message-id 00.
tables: lfa1.
types: begin of t_lfa1,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of t_lfa1.
data: i_lfa1 type standard table of t_lfa1,
wa_lfa1 type t_lfa1.
types truxs_t_text_data(4096) type c occurs 0.
data: csv_converted_table type table of TRUXS_T_TEXT_DATA.
select-options: s_lifnr for lfa1-lifnr.
select lifnr name1 from lfa1 into table i_lfa1
where lifnr in s_lifnr.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ';'
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
TABLES
I_TAB_SAP_DATA = I_LFA1
CHANGING
I_TAB_CONVERTED_DATA = csv_converted_table
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME =
'C:\Documents and Settings\ps12\Desktop\Test folder\exl.cvs'
FILETYPE = 'DAT'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = csv_converted_table
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
my version is 4.6c -
Hi folks...
I need to zip a file from Oracle Forms 6i (Oracle EBS 11.5.2.10) or a PL/SQL object to send it by e-mail.
I did a search and the only solution that I found was using Java:
*1) Create a java file like:*
import java.util.zip.*;
import java.io.*;
public class zipfile
public boolean addFile(String filename,String outFilename)
try {
int len;
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
FileInputStream in = new FileInputStream(filename);
// Add ZIP entry to output stream.
out.putNextEntry(new ZipEntry(filename));
byte[] buf = new byte[1024];
while ((len = in.read(buf)) > 0)
out.write(buf, 0, len);
in.close();
out.closeEntry();
out.close();
return true;
} catch (IOException e)
return false;
*2) Compile this file and import it at Oracle forms using Import Java Classes. But when I try to import this file I get the following error:*
Importing Class Zipfile...
Exception occurred: java.lang.UnsupportedClassVersionError: Zipfile (Unsupported major.minor version 50.0)
What can be? Other Ideas to zip a file using Forms or PL/SQL?
tksThis might work, but you have to compile it with an older version of the java-compiler than you do. You might try JDeveloper 9.x which comes with the developersuite10g, but it might also be that you have to use an even older version.
-
How to ZIP a File from File adapter
Hi All,
How Can I create a ZIP file after reading from the directory.
Is there any property which zip's all the read file?
The requirement is to read an xml and create a zip of the same file in different location. Appreciate your response.
Thanks,Hi,
You can use OOTB Pipelines and Valves to achieve this. Refer below and let us know if you have any questions.
http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#autoId19
Regards,
Neeraj Sehgal
Maybe you are looking for
-
PS 2013 - Autofilter in SQL Reporting Services Reports
Hi, Is it possible to have an autofilter option on the columns of a Reporting Services table in BI? I am using Project Server 2013 and Reporting Services 2013. Thank you. Best regards, Ricardo Segawa - Segawas Projetos / Microsoft Partner
-
I have an early 2008 Macbook and have been using a Mini-DVI to HDMI adapter and HDMI cable to connect to my TV. It was working great until I upgraded to OS X Lion. Now the video is laggy/glitchy on the TV and the computer when the cable is plugged
-
New features for each version of Hyperion major planning
Good morning, I'd like to work on the list of the new features for each of Hyperion Planning major version release: 9.0, 9.1, 9.2, 9.3, 9.3.1. But if there's already available guide/ chart for this, I'd love to refer to that particular documentation.
-
Bal.Sheet and Profit and report in New GL
Hi All, I am trying to execute the Financial Statements Query (0FIGL_V10_Q0001) which is based on the Virtual cube 0FIGL_V10. The issue is I am unable to see any data when I execute the Query. I tried other queries too based on the 0FIGL_V
-
Collabortars email not received
We want to use the cloud to share a InDesign file with one of our clients. We were testing it but when we invited someone, they never get the email.