Need help with recovering data from a truecrypt HDD

I have done something stupid, I have run fdisk on my truecrypt hdd by mistake, and created 2 new partition. the 1st one on 67mb and the 2sd for the rest of the hdd.
Can someone plz help me with restoring the data? I am not really sure there to begin.

Get testdisk.  I use Parted Magic to recover partitions with Testdisk.  So long as you can decrypt the resurrected partitions AND provided you have NOT written to those two partitions after they were fdisk'ed you should be able to recover from this mess.  I really recommend PartedMagic for this sort of thing only because it has a good interface and a lot of other tools in one place.
Testdisk isn't hard to use and there are mini-tutorials out there if you're really stuck such as these links from our wiki:
Testdisk and Photorec

Similar Messages

  • HELP - Need help with recovering photos from iCloud

    This may be a simple question, but I've never had to do it before, so I am asking.
    I have an iPhone 4S.  It was backed up to iCloud yesterday before I had to swap my cracked screen phone for a new phone.  How do I recover photos that were backed up yesterday?  I am sure it is a couple easy steps, but can someone let me know what those might be to restore my phone from iCloud's backup yesterday?

    Photos and videos from your camera roll are backed up to iCloud when you do an iCloud backup.
    This article tells you how to restore an iCloud backup:
    http://support.apple.com/kb/TS4036

  • Need Help: Generate Customer Data from Prod Database

    Hi All,
    My company have an Oracle Financial System, with and old version Oracle Application 11.0.3 and Oracle Database 8.0.5. The database name PROD. This system has been use for more than 7 years and in between there were many stuff resigned without handover and therefore many records and supporting steps cannot be trace back. However the system is still keep running and updated daily.
    Recently we have a user request to generate out a list of customer company name, and their related products purchase from the database, this is because they does not have any methods to print out the list from application. Unfortunately, we do not know which tables or index is actualy storing the name of the customer and products. We have the list of below users accounts that able to log in to the database.
    PA/PA
    APPLSYS/APPS
    APPS/APPS
    ALR/ALR
    AX/AX
    AK/AK
    GL/GLRG/RG
    FA/FAHR/HR
    SSP/SSP
    HXT/HXT
    OTA/OTA
    RLA/RLA
    VEH/VEH
    QA/QA
    ICX/ICX
    AZ/AZ
    AP/AP
    AR/AR
    OE/OE
    OSM/OSM
    NSM/NSM2020
    CN/CN
    MFG/MFG
    INV/INV
    PO/PO
    BOM/BOM
    ENG/ENG
    MRP/MRP
    CRP/CRP
    WIP/WIP
    CZ/CZ
    PJM/PJM
    FLM/FLM
    MSC/MSC
    CS/CS
    CE/CE
    EC/EC
    JG/JG
    APPS/APPS
    All the reference documents is no longer exist. I am able to use SQL Plus to generate the list of tables with the command : select table_name from user_tables. Each user accounts will return different kind of table names. But still I cant locate which table that actually storing the name of the customers and products.
    Is that anybody got hands on this case before? Urgent

    We have this table: And need to unload this table data in flat file format.
    Need help with unload SQL file with these two columns:
    AMT_PAID_ORIG, AMT_PAID_ADJ
    SQL> desc flconv.claim_adj_less
    Name Null? Type
    SAK_CLAIM_ADJ_LESS NUMBER(10)
    SAK_CLAIM_ADJ NUMBER(10)
    ADJ_CLAIM_ICN NUMBER(13)
    ORIGINAL_CLAIM_ICN NUMBER(13)
    DATE_PAID_ORIG NUMBER(8)
    DATE_PAID_ADJ NUMBER(8)
    AMT_PAID_ORIG NUMBER(10,2)
    AMT_PAID_ADJ NUMBER(10,2)
    SAK_PROV_LOC NUMBER(9)
    SAK_FUND_CODE NUMBER(9)
    CHECK_SAK NUMBER(9)
    SAK_PUB_HLTH NUMBER(9)

  • Need help with saving data and keeping table history for one BP

    Hi all
    I need help with this one ,
    Scenario:
    When adding a new vendor on the system the vendor is suppose to have a tax clearance certificate and it has an expiry date, so after the certificate has expired a new one is submitted by the vendor.
    So i need to know how to have SBO fullfil this requirement ?
    Hope it's clear .
    Thanks
    Bongani

    Hi
    I don't have a problem with the query that I know I've got to write , the problem is saving the tax clearance certificate and along side it , its the expiry date.
    I'm using South African localization.
    Thanks

  • I need help with a download from Adobe

    I need help with Adode photoshop elements that I bought from Adobe. The download take forever. I can't get signed in very easy. It take forever

    Hi Kathy1963-1964,
    Welcome to Adobe Forum,
    You have photoshop elements 12, you can try downloading without the akamei downloader .
    http://prodesigntools.com/photoshop-elements-12-direct-download-links-premiere.html
    Please read the " very important instruction" prior to downoload.
    I would request you to disable the firewall & the antivirus prior to download.
    Let us know if it worked.
    Regards,
    Rajshree

  • Gurus..need help in reading data from virtual infocube

    Gurus,
    I have to read data from an virtual infocube...I am trying to use FM RSDRI_INFOPROV_READ to read data but it doesn't work..
    I am doing exactly what has been done in the demo program RSDRi_INFOPROV_READ_DEMO...
    Please help me...its really URGENT...
    Thanks
    sam

    Check out this thread....
    must be helpful
    Re: Read data from 0BWTC_C02 via ABAP

  • NEED HELP with contact/data recovery from restore backup before current

    My girlfriend synched her iphone 5 to itunes 6 months after purchasing it and wiped all of her data. Instead of clicking "restore backup", she chose "Backup now", which replaced the version we needed. Is there anyway of retrieving the data from that restore?

    No, not unless she had a backup of the data she loss.

  • Need help with recovering old account that e-mail is no longer valid.  Birth date on account is not correct.

    Does anyone know how to get an old account password when all the information on the account is not accurate and the e-mail address is no longer valid.

    If none of the following will work If you forgot your Apple ID password (which sounds likely) contact Apple support: Apple ID: Contacting Apple for help with Apple ID account security

  • Problem with recovering data from Bit Locker enabled hard disk with bad sectors

    Hi,
    I have Lenovo T430 laptop with Windows 7 and Bit Locker enabled hard disk. While working I encountered blue screen error multiple times. After some time, the laptop stopped to boot by itself and started showing error 'A disk read write error has occurred.
    Press Ctrl+Alt+Del to restart' message. I tried to connect the hard disk to a different PC as a secondary drive and tried to check the disk to recover the data. The 500 GB disk is showing as unallocated space and I am not sure how to recover the
    data from the hard disk. Appreciate your help to recover the data from corrupted hard disk.
    I used the Lenovo Diagnostics tools available in BIOS and it showed 48 bad sector errors on the hard disk. I also used Windows 7 CD and tried auto repair but it looks like it didn't do anything.
    Thanks in advance!

    Hi  SenneVL,
    Since there are 48 bad sectors on your hard disk, this means the system can not boot any more, the data might not be restored in a normal way, you'd better turn to data restore company for help.
    Regards
    Wade Liu
    TechNet Community Support

  • Help with exporting data from pdf form

    I have about 100 pdf forms that I created in adobe forms central and distributed as a pdf form (rather than on the web). I am trying to export the data into a spreadsheet but when I export it, the fields are all jumbled in the csv file, as in they are not in the same order. I need to export the data all together so I'm going to the forms menu and selecting "manage form data" and then selecting "merge data files into spreadsheet". I tried exporting a single file but that gave me something really weird.
    Please help, I have a deadline next week to analyze this data and can't make sense of it once it is exported to a spreadsheet.

    Would you please share your form with me and send me one of your pdf forms and some of the csv files?
    You can share your form by doing the following:
    1. Click on the “Share” icon on the bottom left corner.
    2. Click on “Add Collaborator” on the popup menu.
    3. Enter [email protected] under “People to share with”.
    4. Set subject to "Export data from pdf form"
    5. Click the “Share” button on the bottom right of the dialog.
    Thanks
    Ken

  • Need help with my HttpConnection From Midlet To Servlet...

    NEED HELP ASAP PLEASE....
    This class is supposed to download a file from the servlet...
    the filename is given by the midlet... and the servlet will return the file in bytes...
    everything is ok in emulator...
    but in nokia n70... error occurs...
    Http Version Mismatch shows up... when the pout.flush(); is called.. but when removed... java.io.IOException: -36 occurs...
    also i have posted the same problem in nokia forums..
    please check also...
    http://discussion.forum.nokia.com/forum/showthread.php?t=105567
    now here are my codes...
    midlet side... without pout.flush();
    public class DownloadFile {
        private GmailMidlet midlet;
        private HttpConnection hc;
        private byte[] fileData;
        private boolean downloaded;
        private int lineNumber;
    //    private String url = "http://121.97.220.162:8084/ProxyServer/DownloadFileServlet";
        private String url = "http://121.97.221.183:8084/ProxyServer/DownloadFileServlet";
    //    private String url = "http://121.97.221.183:8084/ProxyServer/Attachments/mark.ramos222/GmailId111d822a8bd6f6bb/01032007066.jpg";
        /** Creates a new instance of DownloadFile */
        public DownloadFile(GmailMidlet midlet, String fileName) throws OutOfMemoryError, IOException {
            System.gc();
            setHc(null);
            OutputStream out = null;
            DataInputStream is= null;
            try{
                setHc((HttpConnection)Connector.open(getUrl(), Connector.READ_WRITE));
            } catch(ConnectionNotFoundException ex){
                setHc(null);
            } catch(IOException ioex){
                ioex.printStackTrace();
                midlet.alertScreen = new AlertScreen("Error C1", ioex.toString(),
                        null, AlertType.ERROR);
                midlet.alertScreen.setTimeout(Alert.FOREVER);
                midlet.display.setCurrent(midlet.alertScreen);
            try {
                if(getHc() != null){
                    getHc().setRequestMethod(HttpConnection.POST);
                    getHc().setRequestProperty("Accept","*/*");
                    getHc().setRequestProperty("Http-version","HTTP/1.1");
                    lineNumber = 1;
                    getHc().setRequestProperty("CONTENT-TYPE",
                            "text/plain");
                    lineNumber = 2;
                    getHc().setRequestProperty("User-Agent",
                            "Profile/MIDP-2.0 Configuration/CLDC-1.1");
                    lineNumber =3;
                    out = getHc().openOutputStream();
                    lineNumber = 4;
                    PrintStream pout = new PrintStream(out);
                    lineNumber = 5;
                    pout.println(fileName);
                    lineNumber = 6;
    //                pout.flush();
                    System.out.println("File Name: "+fileName);
                    lineNumber = 7;
                    is = getHc().openDataInputStream();
                    long len = getHc().getLength();
                    lineNumber = 8;
                    byte temp[] = new byte[(int)len];
                    lineNumber = 9;
                    System.out.println("len "+len);
                    is.readFully(temp,0,(int)len);
                    lineNumber = 10;
                    setFileData(temp);
                    lineNumber = 11;
                    is.close();
                    lineNumber = 12;
                    if(getFileData() != null)
                        setDownloaded(true);
                    else
                        setDownloaded(false);
                    System.out.println("Length : "+temp.length);
                    midlet.setAttachFile(getFileData());
                    lineNumber = 13;
                    pout.close();
                    lineNumber = 14;
                    out.close();
                    lineNumber = 15;
                    getHc().close();
            } catch(Exception ex){
                setDownloaded(false);
                ex.printStackTrace();
                midlet.alertScreen = new AlertScreen("Error C2+ line"+lineNumber,
                        ex.toString()+
                        " | ",
                        null, AlertType.ERROR);
                midlet.alertScreen.setTimeout(Alert.FOREVER);
                midlet.display.setCurrent(midlet.alertScreen);
        public HttpConnection getHc() {
            return hc;
        public void setHc(HttpConnection hc) {
            this.hc = hc;
        public String getUrl() {
            return url;
        public void setUrl(String url) {
            this.url = url;
        public byte[] getFileData() {
            return fileData;
        public void setFileData(byte[] fileData) {
            this.fileData = fileData;
        public boolean isDownloaded() {
            return downloaded;
        public void setDownloaded(boolean downloaded) {
            this.downloaded = downloaded;
    }this is the midlet side with pout.flush();
    showing Http Version Mismatch
    public class DownloadFile {
        private GmailMidlet midlet;
        private HttpConnection hc;
        private byte[] fileData;
        private boolean downloaded;
        private int lineNumber;
    //    private String url = "http://121.97.220.162:8084/ProxyServer/DownloadFileServlet";
        private String url = "http://121.97.221.183:8084/ProxyServer/DownloadFileServlet";
    //    private String url = "http://121.97.221.183:8084/ProxyServer/Attachments/mark.ramos222/GmailId111d822a8bd6f6bb/01032007066.jpg";
        /** Creates a new instance of DownloadFile */
        public DownloadFile(GmailMidlet midlet, String fileName) throws OutOfMemoryError, IOException {
            System.gc();
            setHc(null);
            OutputStream out = null;
            DataInputStream is= null;
            try{
                setHc((HttpConnection)Connector.open(getUrl(), Connector.READ_WRITE));
            } catch(ConnectionNotFoundException ex){
                setHc(null);
            } catch(IOException ioex){
                ioex.printStackTrace();
                midlet.alertScreen = new AlertScreen("Error C1", ioex.toString(),
                        null, AlertType.ERROR);
                midlet.alertScreen.setTimeout(Alert.FOREVER);
                midlet.display.setCurrent(midlet.alertScreen);
            try {
                if(getHc() != null){
                    getHc().setRequestMethod(HttpConnection.POST);
                    getHc().setRequestProperty("Accept","*/*");
                    getHc().setRequestProperty("Http-version","HTTP/1.1");
                    lineNumber = 1;
                    getHc().setRequestProperty("CONTENT-TYPE",
                            "text/plain");
                    lineNumber = 2;
                    getHc().setRequestProperty("User-Agent",
                            "Profile/MIDP-2.0 Configuration/CLDC-1.1");
                    lineNumber =3;
                    out = getHc().openOutputStream();
                    lineNumber = 4;
                    PrintStream pout = new PrintStream(out);
                    lineNumber = 5;
                    pout.println(fileName);
                    lineNumber = 6;
                    pout.flush();
                    System.out.println("File Name: "+fileName);
                    lineNumber = 7;
                    is = getHc().openDataInputStream();
                    long len = getHc().getLength();
                    lineNumber = 8;
                    byte temp[] = new byte[(int)len];
                    lineNumber = 9;
                    System.out.println("len "+len);
                    is.readFully(temp,0,(int)len);
                    lineNumber = 10;
                    setFileData(temp);
                    lineNumber = 11;
                    is.close();
                    lineNumber = 12;
                    if(getFileData() != null)
                        setDownloaded(true);
                    else
                        setDownloaded(false);
                    System.out.println("Length : "+temp.length);
                    midlet.setAttachFile(getFileData());
                    lineNumber = 13;
                    pout.close();
                    lineNumber = 14;
                    out.close();
                    lineNumber = 15;
                    getHc().close();
            } catch(Exception ex){
                setDownloaded(false);
                ex.printStackTrace();
                midlet.alertScreen = new AlertScreen("Error C2+ line"+lineNumber,
                        ex.toString()+
                        " | ",
                        null, AlertType.ERROR);
                midlet.alertScreen.setTimeout(Alert.FOREVER);
                midlet.display.setCurrent(midlet.alertScreen);
        public HttpConnection getHc() {
            return hc;
        public void setHc(HttpConnection hc) {
            this.hc = hc;
        public String getUrl() {
            return url;
        public void setUrl(String url) {
            this.url = url;
        public byte[] getFileData() {
            return fileData;
        public void setFileData(byte[] fileData) {
            this.fileData = fileData;
        public boolean isDownloaded() {
            return downloaded;
        public void setDownloaded(boolean downloaded) {
            this.downloaded = downloaded;
    }here is the servlet side...
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            if(request.getMethod().equals("POST")){
                BufferedReader dataIN = request.getReader();
                String fileName = dataIN.readLine();
                File file = new File(fileName);
                String contentType = getServletContext().getMimeType(fileName);
                response.setContentType(contentType);
                System.out.println("Content Type: "+contentType);
                System.out.println("File Name: "+fileName);
                int size = (int)file.length()/1024;
                if(file.length() > Integer.MAX_VALUE){
                    System.out.println("Very Large File!!!");
                response.setContentLength(size*1024);
                FileInputStream fis = new FileInputStream(fileName);
                byte data[] = new byte[size*1024];
                fis.read(data);
                System.out.println("data lenght: "+data.length);
                ServletOutputStream sos = response.getOutputStream();
                sos.write(data);
    //            out.flush();
            }else{
                response.setContentType("text/plain");
                PrintWriter out = response.getWriter();
                BufferedReader dataIN = request.getReader();
                String msg_uid = dataIN.readLine();
                System.out.println("Msg_uid"+msg_uid);
                JDBConnection dbconn = new JDBConnection();
                String fileName = dbconn.getAttachment(msg_uid);
                String[] fileNames = fileName.split(";");
                int numFiles = fileNames.length;
                out.println(numFiles);
                for(int i = 0; i<numFiles; i++){
                    out.println(fileNames);
    out.flush();
    out.close();
    Message was edited by:
    Mark.Ramos222

    1) Have you looked up the symbian error -36 on new-lc?
    2) Have you tried the example in the response on forum nokia?
    3) Is the address "121.97.220.162:8084" accessible from the internet, on the device, on the specified port?

  • Help with rescuing data from faulty disk

    Sorry the long wall of text, I wanted to explained everything as detailed as possible to not mess with the chronological order (TL; DR down below!)
    Ok, here's the thing. I have two hard drives, a ssd [sda] (for the OS [arch linux, ubuntu and win7], munchkin 240gb) and a sata 3 one ([sdc] wd, 1 tb)  that I use for everything else. A couple of weeks ago I found there were progressive, unexpected  and random behaviour particularly with windows, random freezes, no bsod, ecc... I finally found that the second hard drive was the culprit so I decided stop using a buy a new disk (while sending the faulty to RMA, since it's barely one year old, and I don't do nothing out of ordinary), I got a seagate with 1 tb.
    I honestly didn't want to mess too much about the data and wanted to save the most without wasting time, so I decided to try to clone the whole disk with dd according to the wiki (Disk Cloning). I imagined that the "bad sectors" were from the ntfs partition, so I went with that. Clearly I could get corrupt files in linux too, but my guess was that the most important data was safe, because I had been using it for the last couple of days without problems. The process ended with a lot of I/O errors, but in the end it showed the same number of `in` and `out`. I regenerated the UUID for the new cloned disk and each partition, modified the fstab and restarted (fingers crossed).
    I could log into arch linux without problems, used it for a while, restarted a second time (that windows habit that I still found hard to overcome) and everything was okay (yes I made sure I was actually on the new disk). Next was windows time, which to my surprise worked fine too, I even played a while. After patting myself in the back, I rebooted the machine thinking in how much work I would like to have done today, and there were an error that apparead on the login screen, just a ms before I pressed enter, I think I read it was referring to another partition of sda. The system got stuck in the middle of the "log in screen" and loading x with a black screen, nothing else. Waited a while, losing hope I pushed the RESET button.
    Now, it was stuck during the boot up process, after "killing rf radio" or something. It was obviously stuck somewhere else... (that message had appeared there since I built the pc) it read though that the /var partition was clean, same with the root partition, next I tried with "recovery" kernels, and each other kernel I had still in grub; but the problem persisted. Tried with ubuntu, had to change fstab again, rebooted, tried to enter, stuck on the loading screen with the big purple background. I couldn't get anything else past that, neither to get a decent log.
    I don't know why (or maybe because I was desperate) I entered the uefi/bios settings and found that the time was localtime instead utc.... weird I thought and I blamed windows (though, I had the registry hack working for a while) and imagined that I updated something that removed that *fixed* the blessed fix. Since I remember having issues with partitions not being correctly mounted once because of time issues, I thought it was a problem with the time... nope, nothing changed.
    I tried again with the recovery kernel of the ubuntu install, I could drop on the root shell, and tried to fix the clock time after remounting, same with mounting the /var partition (ubuntu doesn't use that one), it threw that "bad superblock error", but fsck ran saying the filesystem was clean and it was mount normally later. Somewhere between, I mounted the home partition, no errors, gave a quick navigation. I tried to install ntpd to follow the "troubleshoot" from the Time arch wiki page,  but HA, no internet.
    Rebooted again, and from the menu from "ubuntu recovery", allowed me to enable networking. Quite nice I thought, and pressed enter. It politely informed that I needed to mount the system (root partition) in read/write instead read-only. I happily said yes (I already had remounted the ubuntu root as rw, and worked ok), but stopped at the home partition taking about 10 minutes in "phase 2", suddenly started throwing a lot of errors, about missing inodes, files pointing nowhere, etc. It put a lot of files into lost+found directory. Oh, there it was... I thought, let's go into Arch Linux then...
    Now the system booted up quite fast, and I was welcomed by the black screen asking coldly for my login information, I wrote the credentials, pressed enter, aaaaand PAH, "/home/pablo" change directory failed: No such file or directory. HA, funny I thought, lsblk, the partition was mounted, ls -l /home/... WHAT? the folder wasn't there.
    I looked for the lost+found folder inside the home directory, and it had a lot of directories and files called DXXXXXX.RCN, and IXXXXXX.RCN and some symbolic links. The directories had files inside, the IXXXXX are actually files, ecc.
    Right now, I'm lost... I'm not scared about the data, because it's still living happily (?) on the bad disk, but I still need to recover it, so I can filter it later allowing to write zeros to the fault disk and send it for a replacement. Is there any chance to recover the data? (I rather not going into around 100 files/directories with cryptics names), or maybe use another method to "recover" the data from the previous disk? using cp or rsync? Any good experience or advice on this?
    PS.- Sorry for the epic story, I hope I don't scare readers or other fellow members.
    TL; DR
    + I have 2 disks (ssd [OS {win7, arch and ubuntu}] and sata3 [data])
    + Sata3 disk started to fail on windows (users folder it's on the sata3), arch/ubuntu never had a problem
    + I bought a new one, and I'm trying to send the old one for a RMA
    + Clone the disk according to the wiki and rebuilt the UUID
    + Change fstab to use the new cloned disk
    + Worked fine for a couple of times
    + Used windows, played, everything fine
    + Entered arch, now I couldn't it got stuck without showing any errors
        + Tried every kernel and recovery image without success
    + With Ubuntu I could drop into a root shell
        + Mounted home partition, no problems
        + Tried to activate networking, started to run fsck and threw a lot of errors (I remember I read something about "offset" not correcting) and moved files to lost+found directory
    + Arch Linux started, but I couldn't log because /home/pablo doesn't exist anymore and it seems everything lives now in the lost+found directory with weird names like DXXXXXX and IXXXXXXX
    Aftermath: I have the original data, safe (?) on the bad disk (like I said, I never had any problem in my home partition). I really don't want to be nit picky about what I can save, I'll be happy to save as much as I can, but I don't mind losing corrupt files (that's why I thought cloning with filling with zeros would be enough). I just want to ditch the bad disk and send it to wd for a replacement.
    End of TL; DR
    2014/07/29: Added a TL; DR section
    Last edited by pablox (2014-07-29 13:55:46)

    I can see three possibilities:
    1. The new HDD is broken as well.
    2. The Linux partition contained a little garbage from old HDD's errors and that confused Linux and caused it to corrupt the partition further by writing more garbage to it.
    3. The garbage from old HDD's errors contained on the Windows partition confused Windows and caused it to corrupt the Linux partition by overwriting it with garbage.
    1. Rather unlikely if the HDD is new, but still worth checking. Install smartmontools and run smartctl -a /dev/new-hdd. On the "SMART attributes" list, check if any of "Reallocated_Sector_Ct", "Reallocated_Event_Count", "Current_Pending_Sector", "Offline_Uncorrectable" have RAW_VALUE other than zero or if the "SMART Error Log" contains any entries. If the attributes are all zero and the error log is empty, everything is fine.
    2. Make new image of the old HDD. Make sure that Windows and Linux partitions don't overlap each other due to HDD read error. Run fsck on the Linux partition before mounting it to ensure that it doesn't contain errors which could lead to further errors. If it doesn't, it should be safe to mount and use it.
    3. You said that Windows partition certainly contains error. Don't run Windows and don't mount this partition in Linux without running some NTFS checker (Windows tools on some other Windows system or ntfsck on Linux) and fixing all errors contained there. Alternatively, you can reinstall Windows on the new HDD and manually copy all the files you care about that are still readable from the old HDD. BTW, don't modify anything on the old HDD, as this would likely corrupt its other contents in the same way that modifying its copy corrupted other parts of its copy.
    Last edited by mich41 (2014-07-30 22:30:11)

  • Need help in transferring data from flatfiles to SAP R/3 tables

    Hi,
    I need to *transfer data in the flatfiles (NON SAP SYSTEM) to SAP R/3 tables*. Can we do it with a help of program ?
    Please help me out
    Thanks and regards,
    Shiva shekar k

    Hi Shiva,
        This code will be helpful to you.
    *Code used to create BDC
    *& Report  ZBDC                                               *
    *& Example BDC program, which updates net price of item 00010 of a     *
    *& particular Purchase order(EBELN).                                   *
    REPORT  ZBDC  NO STANDARD PAGE HEADING
                          LINE-SIZE 132.
    Data declaration
    TABLES: ekko, ekpo.
    TYPES: BEGIN OF t_ekko,
        ebeln TYPE ekko-ebeln,
        waers TYPE ekko-waers,
        netpr TYPE ekpo-netpr,
        err_msg(73) TYPE c,
    END OF t_ekko.
    DATA: it_ekko  TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko  TYPE t_ekko,
          it_error TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_error TYPE t_ekko,
          it_success TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_success TYPE t_ekko.
    DATA: w_textout            LIKE t100-text.
    DATA: gd_update TYPE i,
          gd_lines TYPE i.
    *Used to store BDC data
    DATA: BEGIN OF bdc_tab OCCURS 0.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdc_tab.
    *Used to stores error information from CALL TRANSACTION Function Module
    DATA: BEGIN OF messtab OCCURS 0.
            INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF messtab.
    *Screen declaration
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
                                        TITLE text-001. "Purchase order Num
    SELECT-OPTIONS: so_ebeln FOR ekko-ebeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME
                                        TITLE text-002. "New NETPR value
    PARAMETERS:  p_newpr(14)   TYPE c obligatory.  "LIKE ekpo-netpr.
    SELECTION-SCREEN END OF BLOCK block2.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Retrieve data from Purchase order table(EKKO)
      SELECT ekkoebeln ekkowaers ekpo~netpr
        INTO TABLE it_ekko
        FROM ekko AS ekko INNER JOIN ekpo AS ekpo
          ON ekpoebeln EQ ekkoebeln
       WHERE ekko~ebeln IN so_ebeln AND
             ekpo~ebelp EQ '10'.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Check data has been retrieved ready for processing
      DESCRIBE TABLE it_ekko LINES gd_lines.
      IF gd_lines LE 0.
      Display message if no data has been retrieved
        MESSAGE i003(zp) WITH 'No Records Found'(001).
        LEAVE TO SCREEN 0.
      ELSE.
      Update Customer master data (instalment text)
        LOOP AT it_ekko INTO wa_ekko.
          PERFORM bdc_update.
        ENDLOOP.
      Display message confirming number of records updated
        IF gd_update GT 1.
          MESSAGE i003(zp) WITH gd_update 'Records updated'(002).
        ELSE.
          MESSAGE i003(zp) WITH gd_update 'Record updated'(003).
        ENDIF.
    Display Success Report
      Check Success table
        DESCRIBE TABLE it_success LINES gd_lines.
        IF gd_lines GT 0.
        Display result report column headings
          PERFORM display_column_headings.
        Display result report
          PERFORM display_report.
        ENDIF.
    Display Error Report
      Check errors table
        DESCRIBE TABLE it_error LINES gd_lines.
      If errors exist then display errors report
        IF gd_lines GT 0.
        Display errors report
          PERFORM display_error_headings.
          PERFORM display_error_report.
        ENDIF.
      ENDIF.
    *&      Form  DISPLAY_COLUMN_HEADINGS
          Display column headings
    FORM display_column_headings.
      WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
      SKIP.
      WRITE:2 'The following records updated successfully:'(013).
      WRITE:/ sy-uline(42).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
              (10) 'Purchase Order'(004), sy-vline,
              (11) 'Old Netpr'(005), sy-vline,
              (11) 'New Netpr'(006), sy-vline.
      WRITE:/ sy-uline(42).
    ENDFORM.                    " DISPLAY_COLUMN_HEADINGS
    *&      Form  BDC_UPDATE
          Populate BDC table and call transaction ME22
    FORM bdc_update.
      PERFORM dynpro USING:
          'X'   'SAPMM06E'        '0105',
          ' '   'BDC_CURSOR'      'RM06E-BSTNR',
          ' '   'RM06E-BSTNR'     wa_ekko-ebeln,
          ' '   'BDC_OKCODE'      '/00',                      "OK code
          'X'   'SAPMM06E'        '0120',
          ' '   'BDC_CURSOR'      'EKPO-NETPR(01)',
          ' '   'EKPO-NETPR(01)'  p_newpr,
          ' '   'BDC_OKCODE'      '=BU'.                      "OK code
    Call transaction to update customer instalment text
      CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
             MESSAGES INTO messtab.
    Check if update was succesful
      IF sy-subrc EQ 0.
        ADD 1 TO gd_update.
        APPEND wa_ekko TO it_success.
      ELSE.
      Retrieve error messages displayed during BDC update
        LOOP AT messtab WHERE msgtyp = 'E'.
        Builds actual message based on info returned from Call transaction
          CALL FUNCTION 'MESSAGE_TEXT_BUILD'
               EXPORTING
                    msgid               = messtab-msgid
                    msgnr               = messtab-msgnr
                    msgv1               = messtab-msgv1
                    msgv2               = messtab-msgv2
                    msgv3               = messtab-msgv3
                    msgv4               = messtab-msgv4
               IMPORTING
                    message_text_output = w_textout.
        ENDLOOP.
      Build error table ready for output
        wa_error = wa_ekko.
        wa_error-err_msg = w_textout.
        APPEND wa_error TO it_error.
        CLEAR: wa_error.
      ENDIF.
    Clear bdc date table
      CLEAR: bdc_tab.
      REFRESH: bdc_tab.
    ENDFORM.                    " BDC_UPDATE
          FORM DYNPRO                                                   *
          stores values to bdc table                                    *
    -->  DYNBEGIN                                                      *
    -->  NAME                                                          *
    -->  VALUE                                                         *
    FORM dynpro USING    dynbegin name value.
      IF dynbegin = 'X'.
        CLEAR bdc_tab.
        MOVE:  name TO bdc_tab-program,
               value TO bdc_tab-dynpro,
               'X'  TO bdc_tab-dynbegin.
        APPEND bdc_tab.
      ELSE.
        CLEAR bdc_tab.
        MOVE:  name TO bdc_tab-fnam,
               value TO bdc_tab-fval.
        APPEND bdc_tab.
      ENDIF.
    ENDFORM.                               " DYNPRO
    *&      Form  DISPLAY_REPORT
          Display Report
    FORM display_report.
      FORMAT COLOR COL_NORMAL.
    Loop at data table
      LOOP AT it_success INTO wa_success.
        WRITE:/      sy-vline,
                (10) wa_success-ebeln, sy-vline,
                (11) wa_success-netpr CURRENCY wa_success-waers, sy-vline,
                (11) p_newpr, sy-vline.
        CLEAR: wa_success.
      ENDLOOP.
      WRITE:/ sy-uline(42).
      REFRESH: it_success.
      FORMAT COLOR COL_BACKGROUND.
    ENDFORM.                    " DISPLAY_REPORT
    *&      Form  DISPLAY_ERROR_REPORT
          Display error report data
    FORM display_error_report.
      LOOP AT it_error INTO wa_error.
        WRITE:/      sy-vline,
                (10) wa_error-ebeln, sy-vline,
                (11) wa_error-netpr CURRENCY wa_error-waers, sy-vline,
                (73) wa_error-err_msg, sy-vline.
      ENDLOOP.
      WRITE:/ sy-uline(104).
      REFRESH: it_error.
    ENDFORM.                    " DISPLAY_ERROR_REPORT
    *&      Form  DISPLAY_ERROR_HEADINGS
          Display error report headings
    FORM display_error_headings.
      SKIP.
      WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
      SKIP.
      WRITE:2 'The following records failed during update:'(008).
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_HEADING.
      WRITE:/      sy-vline,
              (10) 'Purchase Order'(009), sy-vline,
              (11) 'Netpr'(010), sy-vline,
              (73) 'Error Message'(012), sy-vline.
      WRITE:/ sy-uline(104).
      FORMAT COLOR COL_NORMAL.
    ENDFORM.                    " DISPLAY_ERROR_HEADINGS

  • Need help with saving item from combobox to textfile

    Hi all. right now my codes can only save one stock information in the textfile but when I tried to save another stock in the textfile , it overrides the pervious one.
    So I was wondering which part of my codes should be changed??
    DO the following
    Create a fypgui class and put this bunch of codes inside
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.io.BufferedInputStream;
    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.Scanner;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTable;
    public class fypgui {
         private ArrayList<Stock> stockList = new ArrayList<Stock>();
         private String[] stockArray;
         private JComboBox choice1;
         private JTabbedPane tabbedPane = new JTabbedPane();
         private JPanel displayPanel = new JPanel(new GridLayout(5, 1));
         private JButton saveBtn = new JButton("Save");
         private JPanel choicePanel = new JPanel();
         String yahootext;
         String     symbol;
         int index;
         public fypgui() {
              try {
                   //read from text file for stockname
                   File myFile = new File("D:/fyp/savedtext2.txt");
                   FileReader reader = new FileReader(myFile);
                   BufferedReader bufferedReader = new BufferedReader(reader);
                   String line = bufferedReader.readLine();
                   while (line != null) {
                        Stock stock = new Stock();
                        // use delimiter to get name and symbol
                        Scanner scan = new Scanner(line);
                        scan.useDelimiter(",");
                        String name = "";
                        String symbol = "";
                        while (scan.hasNext()) {
                             name += scan.next();
                             symbol += scan.next();
                        stock.setStockName(name);
                        stock.setSymbol(symbol);
                        stockList.add(stock);
                        line = bufferedReader.readLine();
                   //size of the array(stockarray) will be the same as the arraylist(stocklist)
                   stockArray = new String[stockList.size()];
                   for (int i = 0; i < stockList.size(); i++) {
                        stockArray[i] = stockList.get(i).getStockName();
                   //create new combobox
                   choice1 = new JComboBox(stockArray);
                   //For typing stock symbol manually
                   choice1.setEditable(true);
                   //set the combobox as blank
                   choice1.setSelectedIndex(-1);
              } catch (IOException ex) {
                   ex.printStackTrace();
              JFrame frame1 = new JFrame("Stock Ticker");
              frame1.setBounds(200, 200, 300, 300);
              JPanel panel1 = new JPanel();
              panel1.add(choice1);
              choice1.setBounds(20, 35, 260, 20);
              JPanel panel2 = new JPanel();
              JPanel panel5 = new JPanel();
              panel5.add(saveBtn);
              displayPanel.add(panel1);
              displayPanel.add(panel5);
              tabbedPane.addTab("Choice", displayPanel);
              tabbedPane.addTab("Display", choicePanel);
              JLabel label2 = new JLabel("Still in Progress!");
              choicePanel.add(label2);
              frame1.add(tabbedPane);
              frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame1.setVisible(true);
              saveBtn.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        // initalize index as the postion of the stock in the combo box
                        index = choice1.getSelectedIndex();
                        /*if the postion of the combobox is not blank,
                             it will get the StockName and symbol according to the
                             position and download the stock*/
                        if(index != -1){
                             symbol = stockList.get(index).getSymbol();
                             save(symbol);
         @SuppressWarnings("deprecation")
         public void save(String symbol){
              try {
                   String part1 = "http://download.finance.yahoo.com/d/quotes.csv?s=";
                   String part2 = symbol;
                   String part3 = "&f=sl1d1t1c1ohgv&e=.csv";
                   String urlToDownload = part1+part2+part3;
                   URL url = new URL(urlToDownload);
                   //read contents of a website
                   InputStream fromthewebsite = url.openStream(); // throws an IOException
                   //input the data from the website and read the data from the website
                   DataInputStream yahoodata = new DataInputStream(new BufferedInputStream(fromthewebsite));
                   // while there is some contents from the website to read then it will print out the data.
                   while ((yahootext = yahoodata.readLine()) != null) {
                        File newsavefile = new File("D:/fyp/savedtext.txt");
                        try {
                             FileWriter writetosavefile = new FileWriter(newsavefile);
                             writetosavefile.write(yahootext);
                             System.out.println(yahootext);
                             writetosavefile.close();
                        } catch (IOException e) {
                             e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
         public static void main(String[] args) {
              // TODO code application logic here
              new fypgui();
    Create a Stock class a put this bunch of codes inside
    public class Stock {
         String stockName ="";
         String symbol="";
         double lastDone=0.0;
         double change =0.0;
         int volume=0;
         public String getStockName() {
              return stockName;
         public void setStockName(String stockName) {
              this.stockName = stockName;
         public String getSymbol() {
              return symbol;
         public void setSymbol(String symbol) {
              this.symbol = symbol;
         public double getLastDone() {
              return lastDone;
         public void setLastDone(double lastDone) {
              this.lastDone = lastDone;
         public double getChange() {
              return change;
         public void setChange(double change) {
              this.change = change;
         public int getVolume() {
              return volume;
         public void setVolume(int volume) {
              this.volume = volume;
    Create a folder called fyp in D drive and create two txt file in it.
    -savedtext.txt
    -savedtext2.txt
    in the saved savedtext2.txt add
    A ,AXP
    B ,B58.SI
    C ,CLQ10.NYM
    this is my whole application. if you guys can tell me what can I do to make sure that the stock info doesn't overrides . I will more than thankful.
    Edited by: javarookie123 on Jul 9, 2010 9:49 PM

    javarookie123 wrote:
    Hi all. right now my codes can only save one stock information in the textfile but when I tried to save another stock in the textfile , it overrides.. 'over writes'
    ..the pervious one.
    So I was wondering which part of my codes should be changed??Did not look at the code closely, but I am guessing the problem lies in the instantiation of the FileWriter. Try [this constructor|http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/io/FileWriter.html#FileWriter(java.io.File,%20boolean)] (<- link). The documentation is a wonderful thing. ;-)
    And generally on the subject of getting help:
    - There is no need for two question marks. One '?' means a question, while 2 or more typically means a dweeb.
    - Do your best to [write well|http://catb.org/esr/faqs/smart-questions.html#writewell] (<- link). Each sentence should start with an upper case letter. Not just the first one.
    Also, when posting code, code snippets, XML/HTML or input/output, please use the code tags. The code tags protect the indentation and formatting of the sample. To use the code tags, select the sample and click the CODE button.

  • I need help with a lab from programming.

    I need the following tasks implemented in the code I wrote below. I would really appreciate if someone could achieve this because it would help me understand the coding process for the next code I have to write. Below are the four classes of code I have so far.
    save an array of social security numbers to a file
    read this file and display the social security numbers saved
    The JFileChooser class must be used to let the user select files for the storage and retrieval of the data.
    Make sure the code handles user input and I/O exceptions properly. This includes a requirement that the main() routine does not throw any checked exceptions.
    As a part of the code testing routine, design and invoke a method that compares the data saved to a file with the data retrieved from the same file. The method should return a boolean value indicating whether the data stored and retrieved are the same or not.
    * SSNArray.java
    * Created on February 28, 2008, 9:45 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package exceptionhandling;
    import java.util.InputMismatchException; // program uses class InputMismatchException
    import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
    * @author mer81348
    public class SSNArray
        public static int SOCIAL_SECURITY_NUMBERS = 10;
        private String[] socialArray = new String[SOCIAL_SECURITY_NUMBERS];
        private int socialCount = 0;
        /** Creates a new instance of SSNArray */
        public SSNArray ()
        public SSNArray ( String[] ssnArray, int socialNumber )
            socialArray = ssnArray;
            socialCount = socialNumber;
        public int getSocialCount ()
            return socialCount;
        public String[] getSocialArray ()
            return socialArray;
        public void addSocial ( String index )
            socialArray[socialCount] = index;
            socialCount++;
        public String toString ()
            StringBuilder socialString = new StringBuilder ();
            for ( int stringValue = 0; stringValue < socialCount; stringValue++ )
                socialString.append ( String.format ("%6d%32s\n", stringValue, socialArray[stringValue] ) );
            return socialString.toString ();
        public void validateSSN ( String socialInput ) throws InputMismatchException, DuplicateName
            if (socialInput.matches ("\\d{9}"))
                return;
            else
                throw new InputMismatchException ("ERROR! Incorrect data format");       
    * SSNArrayTest.java
    * Created on February 28, 2008, 9:46 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package exceptionhandling;
    import java.util.InputMismatchException; // program uses class InputMismatchException
    import java.util.Scanner; // program uses class Scanner
    import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
    * @author mer81348
    public class SSNArrayTest
        /** Creates a new instance of SSNArrayTest */
        public SSNArrayTest ()
         * @param args the command line arguments
        public static void main (String[] args)
            // create Scanner to obtain input from command window
            Scanner input = new Scanner ( System.in );
            System.out.printf ( "\nWELCOME TO SOCIAL SECURITY NUMBER CONFIRMER\n" );
            SSNArray arrayStorage = new SSNArray ();
            for( int socialNumber = 0; socialNumber < SSNArray.SOCIAL_SECURITY_NUMBERS; )
                String socialString = ( "\nPlease enter a Social Security Number" );
                System.out.println (socialString);
                String socialInput = input.next ();
                try
                    arrayStorage.validateSSN (socialInput);
                    arrayStorage.addSocial (socialInput);
                    socialNumber++;
                catch (InputMismatchException e)
                    System.out.println ( "\nPlease reenter Social Security Number\n" + e.getMessage() );
                catch (DuplicateName e)
            System.out.printf ("\nHere are all your Social Security Numbers stored in our database:\n");
            System.out.printf ( "\n%8s%32s\n", "Database Index", "Social Security Numbers" );
            System.out.println (arrayStorage);
    * SSNArrayExpanded.java
    * Created on February 28, 2008, 9:52 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package exceptionhandling;
    import java.util.InputMismatchException;
    import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
    * @author mer81348
    public class SSNArrayExpanded extends SSNArray
        /** Creates a new instance of SSNArrayExpanded */
        public SSNArrayExpanded ()
        public SSNArrayExpanded ( String[] ssnArray, int socialNumber )
            super ( ssnArray, socialNumber );
        public void validateSSN ( String socialInput ) throws InputMismatchException, DuplicateName
            super.validateSSN (socialInput);
                int storedSocial = getSocialCount ();
                for (int socialMatch = 0; socialMatch < storedSocial; socialMatch++ )
                    if (socialInput.equals (getSocialArray () [socialMatch]))
                        throw new DuplicateName ();
            return;
    * SSNArrayTestExpanded.java
    * Created on February 28, 2008, 9:53 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package exceptionhandling;
    import java.util.InputMismatchException; // program uses class InputMismatchException
    import java.util.Scanner; // program uses class Scanner
    import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
    * @author mer81348
    public class SSNArrayTestExpanded
        /** Creates a new instance of SSNArrayTest */
        public SSNArrayTestExpanded ()
         * @param args the command line arguments
        public static void main (String[] args)
            // create Scanner to obtain input from command window
            Scanner input = new Scanner ( System.in );
            System.out.printf ( "\nWELCOME TO SOCIAL SECURITY NUMBER CONFIRMER\n" );
            SSNArrayExpanded arrayStorage = new SSNArrayExpanded(); 
            for( int socialNumber = 0; socialNumber < SSNArray.SOCIAL_SECURITY_NUMBERS; )
                String socialString = ( "\nPlease enter a Social Security Number" );
                System.out.println (socialString);
                String socialInput = input.next ();
                try
                    arrayStorage.validateSSN (socialInput);
                    arrayStorage.addSocial (socialInput);
                    socialNumber++;
                catch (InputMismatchException e)
                catch (DuplicateName e)
                    System.out.println ( "\nSocial Security Number is already claimed!\n" + "ERROR: " + e.getMessage() ); 
            System.out.printf ("\nHere are all your Social Security Numbers stored in our database:\n");
            System.out.printf ( "\n%8s%32s\n", "Database Index", "Social Security Numbers" );
            System.out.println (arrayStorage);
    }

    cotton.m wrote:
    >
    That writes creates the file but it doesn't store the social security numbers.True.Thanks for confirming that...
    How do I get it to save?
    Also, in the last post I had the write method commented out, the correct code is:
         System.out.printf ("\nHere are all your Social Security Numbers stored in our database:\n");
            System.out.printf ( "\n%8s%32s\n", "Database Index", "Social Security Numbers" );
            System.out.println ( arrayStorage );
            try
                File file = new File ("Social Security Numbers.java");
                // Create file if it does not exist
                boolean success = file.createNewFile ();
                if (success)
                      PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("Social Security Numbers.txt")));               
    //                BufferedWriter out = new BufferedWriter (new FileWriter ("Social Security Numbers.txt")); 
                    out.write( "what goes here ?" );
                    out.close ();
                    // File did not exist and was created
                else
                    // File already exists
            catch (IOException e)
            System.exit (0);
    }It still doesn't write.

Maybe you are looking for