Regex help wanted

OK - I have a CSV file where each cell value is surrounded by double-quotes. What's more, the values can have commas in them (which are not escaped in anyway). The values can also be empty. So if I have the line
    "a,b","c","","d,e,f"I want to get 4 cells here:
    a,b
    c
    <the empty String>
    d,e,fand I'm trying to do this with java.util.regex - I've tried using (\".*\") - and then getting the groups returned (as the cells) but this matches no groups!
Yes I've read the docs for Pattern, yes I've searched around (etc etc) and yes I've asked my colleagues; we're all useless at regex. Any help would be great!

sabre150 - thanks, this is a great help. I've used groups before and, quite frankly, I'm not sure how because now they don't seem to be working how I thought they did:
            String line = "\"a,b\",\"c\",\"\",\"d,e,f\"";
            Pattern pattern = Pattern.compile("\"([^\"]*)\"");
            Matcher matcher = pattern.matcher(line);
            //This just returns 1 instead of the 4 I was expecting
            //group(1) is null
            int groupCount = m.groupCount();
            String[] cells = new String[groupCount];
            for (int i = 1; i <= groupCount; i++) {
                cell[i-1] = m.group(i);
            }Is how I've been using the group facility on the Matcher. Trouble is, it doesn't work; evidently it doesn't behave as I was expecting it to! Could you elaborate on how it works and how (if at all possible) I can get the pattern to tell me how many cells it will find up front?

Similar Messages

  • I replaced my printer. Now Itunes help wants to print to my old printer. How do i change the printer in Itunes?

    I replaced my printer with an newer printer. Now itunes Help wants to print to my old printer.How do I change Itunes to print to my new printer?

    Sorry, It was not Itunes. My laptop had reverted back to my old printer.

  • [regex help]Find EXACT characters in a String.

    Ok, i got this so far ...
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class Testing2 {
        public static void main(String[] args) {
            Pattern p = Pattern.compile("[wati]");
            String text = "water";
            Matcher m = p.matcher(text);
            if (m.find()) {
                System.out.print("Found !");
    }With that code i got a match, but i ONLY want to find a match if the String matches the EXACTS characters in the Pattern ...
    in this case i got, 'w' 'a' 't' 'i', 'w' 'a' 't', are in water, but 'i' NOT, so i don't want to have a match !
    i don't know how to acomplish this :(
    hope you can help me, thanks in advance :D

    Username7260 wrote:
    Ok, i got this so far ...
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class Testing2 {
    public static void main(String[] args) {
    Pattern p = Pattern.compile("[wati]");
    String text = "water";
    Matcher m = p.matcher(text);
    if (m.find()) {
    System.out.print("Found !");
    }With that code i got a match, but i ONLY want to find a match if the String matches the EXACTS characters in the Pattern ...
    in this case i got, 'w' 'a' 't' 'i', 'w' 'a' 't', are in water, but 'i' NOT, so i don't want to have a match !
    i don't know how to acomplish this :(AFAIK there's no syntax in regular expressions to accomplish this. Try turning your string into a character array, sorting it, and then do a simple comparison.

  • Regex help for URL rewriting

    I have the following regular expression for rewriting a URL (from existing code which I had to make some quick changes)
    String     regex = "s#(href|src|url|action|background)=(\"?)(/|" + "http:originalserver.com" +"/|http.?://" + "originalserver.com"+ ")([^\">]*?)(\"?)#$1=$2" + "myserver.com" + "/$4$5#gis";
    which does a URL rewrite and changes the URL from something like
    src="http://originalserver.com/images/someimage.gif" to
    src="http://myserver.com/proxy/images/someimage.gif"
    Now I want to change this regex to add some parameters to the URL. ie.
    case 1:
    href="http://www.originalserver.com/index.htm"
    to
    href="http://www.originalserver.com/index.htm?myParam1=myValue1
    case 2:
    href="http://www.originalserver.com/index.htm?originalP1=originalV1"
    to
    href="http://www.originalserver.com/index.htm?originalP1=originalV1&myParam1=myValue1"
    How can I change the regex to do this. As I have to do this fast and not an expert in Regex, any help would be appreciated.

    Hi,
    try this :
    - first set delimiter (? or &) to append your parameters :
    char delimiter = '\?';
    String myParams = "myParam1=myValue1";
    Pattern p = Pattern.compile( "\?" );
    Matcher m = p.matcher( url );
    if( m.matches() )
    delimiter = '\&'; // not sure ampersand needs to be "backslashed"
    - then use the modified regex
    String regex = "s#(href|src|url|action|background)=(\"?)(/|" + "http:originalserver.com" +"/|http.?://" + "originalserver.com"+ ")([^\">]*?)(\"?)#$1=$2" + "myserver.com" + "/$4$5" + delimiter + myParams + "#gis";

  • Regex help for SQL update statement

    Hello,
    need help from IPS regex guru - trying to build the signature to detect SQL update statement in HTTP requests.
    1) Am I correct with regex below specified as Request-Regex?
    [Uu][Pp][Dd][Aa][Tt][Ee]([%]20|[+])[\x20-\x7e]+[Ss][Ee][Tt]([%]20|[+])[\x20-\x7e]+=
    2) How do I make sure that it detects 'Update' in URI and Arguments only and not in the body on entire webserver response (currently looks like the case)?

    1) It looks correct to me
    2) Typically, the "service HTTP" engine is used to inspect requests and the "TCP string" engine is used to inspect HTTP server responses. If you only want to inspect requests, use the service HTTP engine.

  • Regex Help: Word not following by another word

    Hi,
    I am trying to write a regex that would return me lines containing a given string but it should not be followed by another.
    Lets say the lines in the sample file are as follows:
    ABC.EXE
    ABC.PDF
    ABC.TXT
    ABC.DOC
    RegEx I used is as follows:
    ^.*ABC.*(?!EXE)$
    I want the RegEx to match all lines except the first, looks like the look ahead is not work.

    Yes, this is what I was looking for.
    Only problem and if you look at the RegEx I used
    initially, I wanted to look at all strings that start
    with ABC.
    So basically I want to exclude ABC.EXE and also
    ABCDE.EXE. How can I do this?
    Thanks in advance for your help.
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#startsWith(java.lang.String)

  • Regex help please...need to grab a part of a string...

    Hi there,
    I have a dynamic form with dynamic fields and dynamic data types.
    What I want to do is check the data-type by grabbing it from the field name.
    For example, I have a field name called "formEmail[email]"
    The whole string is the field name, but I want to also extract the string between the square brackets. This will help me validate the field when it comes to submission. I will then compare it to a last of valid possibilities.
    How can I do this? I know it must require some regex but I have never looked into REGEX....my bad I know...but I promise I will in future!
    Mnay thanks,
    Mikey.

    Mikey,
    One question: Is the string 'formEmail[email]' the actual string (as opposed to being a variable that will get evaluated)?
    There are a lot of ways to go about this sort of task with regular expressions. If 'formEmail[email]' is an example of the type of strings you are searching, a regular expression along the lines of the following might be useful:
    <cfscript>
         mystring = "formEmail[email]";
         results = ReMatch( "[(\w*)]+", mystring );
    </cfscript>
    <cfdump var="#results#">
    <cfoutput>
         First match: #results[1]#<br />
         Second match: #results[2]#<br />
    </cfoutput>
    This regular expression finds all words in a string but does not match the brackets. \w is a special character that matches any word character -- including alphanumeric chars and underscores.
    The brackets used in the regular expression are also special characters for groupingt, which you can learn more about in the section of the CF WACK book mentioned JR's reply.
    If you run this snippet, you'll notice you get an array back. The first element of the array is the first match of the regexp, or the string 'formEmail', and the second element of the array is the second match of the regexp, or the string 'email'.
    This regular expression might be helpful if you don't have consistent text before the brackets but you know the string you'll search is formatted as: string[string].
    For example, the ReMatch expression above works the same for either of the strings below:
    formPhoneNumber[phone] (would return two strings: formPhoneNumber and phone)
    formEmail[email] (would return two strings: formEmail and email)
    As you delve into the world of Regular Expressions, be sure to grab RegExr, an Adobe AIR application for testing regular expressions. Very handy, especially coupled with a reading of the RegExp section in Forta's CF WACK book!
    http://gskinner.com/RegExr/desktop/

  • Regex Help - Parsing Names

    I am receiving names from another system, and I need help parsing the data as it comes in. There are common data entry errors from the other system that I want to correct as the data is imported. I am trying to formulate a regular expression to search and replace common errors.
    Example 1: A record with the last name "DE  ROSA" is imported. Note that there are two spaces between "DE" and "ROSA". I want to remove the extra spaces. This one is more straight forward.
    Example 2: A record with the last name "DE  ROSA-DE  LA  CRUZ" is imported. It's the same problem, but now there are two places in which it needs to be fixed.
    Example 3: A record with the last name "LYNDE-DE  ROSA" is imported. I want to correct the extra spaces in "DE ROSA" but not touch Lynde, which also contains "DE" at the end.
    I can't seem to create a regular expression that will find all of the scenarios that I need without including results I don't want. These are the rules I need:
    1. Search for the expression "DE" as a phrase with one or more spaces after it.
    2. The item preceding "DE" must be nothing (the beginning of the line) or a character that is not a-z or A-Z.
    It seems simple enough, but my expression either don't catch "DE" at the beginning of the string, or they catch the "DE" at the end of a last name. The names are converted to uppercase for simplified procession.
    Any help would greatly be appreciated. I tried to explain this with the simplest examples possible, but I can provide more information if that would help.

    JavaUser wrote:
    936517 wrote:
    I suggest you use JUnit if you don't already use it to verify every possible input condition is tested and passes.Thank you for the suggestion. I don't have JUnit set up for this project. I have a small program that I created, based off of the one provided in the regex tutorial, that allows me to type in a regular expression, a string I want to evaluate, and the results it produces. The regex expression I tried and the examples I could think of all worked. I also have some test data to try, once I finish my little program. I won't be able to anticipate every possible typo the users can make, but this will be an improvement over what we have now.I suspect you are reading more into 936517's post than he meant; I certainly don't think he expected you to cover all possible inputs since, being infinite, that is impossible. I think he probably meant to say you should cover a good selection of 'good' data and a good selection of 'bad' data plus all edge conditions you can think of.
    I agree with 936517 about using JUnit. It works well even for the sort of testing you are doing.

  • Regex help... Need to improve regex skills

    Hi everyone
    I m new to java.
    currently I om working an a project that requires regex for parsing.
    I am able to parse the string but I feel that regex I wrote is not efficient.
    please help me.
    String: "Oct.8, 9, 15, 16, 22, 23, 29, 30Nov.5, 6, 12, 13, 19, 20, 26, 27"
    I want to parse Oct 8 and Nov 27 (start and end of the period)
    This is the regex that i wrote.
    regex: "([a-zA-Z]+)\..*,\s*(\d+)([a-zA-Z]+).*,\s*(\d+)"

    Found this on google, maybe it will help.
    try {
            // Some examples
            DateFormat formatter = new SimpleDateFormat("MM/dd/yy");
            Date date = (Date)formatter.parse("01/29/02");
            formatter = new SimpleDateFormat("dd-MMM-yy");
            date = (Date)formatter.parse("29-Jan-02");
            // Parse a date and time; see also
            // e317 Parsing the Time Using a Custom Format
            formatter = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
            date = (Date)formatter.parse("2002.01.29.08.36.33");
            formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
            date = (Date)formatter.parse("Tue, 29 Jan 2002 22:14:02 -0500");
        } catch (ParseException e) {
        }

  • New to HD Editing and CS, building a PC to suit requirements of HD edit. Experienced help wanted :-)

    Firstly let me say hi and thanks in advance to all that read and assist with my questions
    A Bit about me..
    I have recently acquired the need for video editing at a much higher level with both having a family now (baby daughter) and a very active hobby (rc heli flying at a sponsored level).  With this in mind I bought a HD video camera some time back without the realisation that, to effectively edit such footage requires horsepower!!.... so i have saved up for a new computer and ended up here after much reading on various forums (toms hardware, video guys etc etc).
    Where I am up too....
    I have started by firstly implementing a NAS into my Home network which is primarily used to store and stream media (Gigabit LAN) around the home. It is setup in RAID 5 with 5 x 2TB disks (so about 7TB of storage).  I have done this so there is some backup of photos, movies, home video etc (if I lose a disk , hopefully i will not lose the lot).  I have also acquired adobe Premiere Pro CS 5 and now need a workstation that will allow me to edit in confort ( the one I have will not even run it!! .
    My aim is to store original files and completed work on the NAS (or burn to Bluray etc).
    I am looking at a PC solution, as I can obviously get more horsepower for less $$ than a laptop solution. 
    I have built PC's in the past but not with high frequency and this will be the biggest budget one I will have attempted. I have been researching alot over the last few weeks about sytems and components and found this forum to be very good in dealing with hardware specs and requiremnts in a very proffesional way.
    I am now at the point where I getting a little muddled with which way to go and still have a lot of research to complete.  My approach is to tackle each of the components needed one at a time in a fairly hierarchial manner.
    What the PC will be used for..
    This PC will be used primarily for the video editing and some gaming (when I have time).  AlLso any other horsepower intensive apps if needed (I have a laptop and other comps for general duties).
    Budget
    My budget is fairly rigid at $2500 AUD (so I am not looking at a Zeon solution LOL). The budget is to include:
    Case                              ?
    CPU                            Intel I7 2600K (based on my research this seems to be the best way to go with my budget and needs)
    CPU Cooler                  Standard Intel supplied Cooler (seems to perform reasonably well even when moderately overclocking (~4.0 - 5.0 khz) 
    MOBO                           ?
    RAM                              ?
    Graphics Card                 ?
    BLURAY Writer               ?
    PSU                               ?
    HDD Storage               1 SSD and 3 HDD's with 2 in Raid "0"
    OS                              Windows 7 64 Bit
    23 inch Screen               ?
    Questions
         Motherboard
    I guess my issues with MOBO slection revolve firstly around which chipset to go with Z68 (newer) or the P67?  It seems the Z68 is feature rich, however I also seem to feel that the Quick sync and SRT would be better disabled with what I am setting the machine up for? So therefore what advantage is there with going with Z68 if any? or am I better off getting a more established P67 chipset based board?
    I also see that some boards have the Nvidia NF200 for expanding bandwidth on the restrictive 16 PCIe lanes available on the 1155 socket boards given I am only looking at one decent Graphics card is this a chip I should avoid (as I have read this can cause latency with only one graphics card)?
    Another thing I have noticed is some boards have a PLX PEX8608 chip which seems to manage the limited PCIe lanes better if other cards are plugged in?
    I also see some boards have the Marvell Sata 3 controller on them that does not seem to perform as well as the native Intel Sata 3 controller on the Southbridge in tests.  I guess I have no real idea of when I would be looking at stretching the bandwidth and wonder whether I need to concern myself with 4 x sata 3 connections (2 intel and 2 Marvell)?
    One last question I see there is now MOBO's available with PCIe 3.0 available (even though there are no devices that can utilize it) is this even worth being a consideration or is it not really of any importance to the slection process?
    In summary it appears there is lots of goodies on offer with different chipsets and boards, however I do not want to waste budget on things I have no use for or gimmicks.
         CPU Cooler
    It is my intent to start with the factory supplied Intel bundled cooler and invest the money not spent on this item on better graphics card etc. For moderate Overclocking it seems to perform ok.... am hoping this will be ok?
        HDD Storage
    At this stage I am not up to speed with the exact storage devices I need, I am initially looking at whether my ideas for a storage system have merit? Please bear in mind I am not a CSpro user as of yet and so some of this is just based on research with no base knowledge....?
    1 x ~120Gb SSD                                    for OS and Programs
    1 x ??Gb/TB HDD 7200 rpm                    for Media Projects
    2 x ?? Gb/TB HDD 7200 rpm in raid "0"    for Media Cache and Preview Files
    Will the onboard Raid controller accommadate the above adequately?
        Graphics Card
    I am looking at Nvidia as far as I can tell so that I may make use of the CUDA threads and as far as type I assume I pick the best one of the approved list (adobe approved list)?  I am still confused ast to whether there is any benefit from a using a twin GPU card, its unclear to me whether the CUDA can tap into both of the GPU's on such a card? Of course budget restraint will come into play here.
         Ram
    I am looking at 4 x 4gb dual channel Ram cards to give a total of 16Gb total (DDR 3)  as for brands, types and frequencies I have no idea yet and need to cover off some of the above first before my research gets too wide?
         PSU and Case
    I am hoping for a modular device for this, however I was thinking this and the case are a low priority at this stage (until some of the other solutions are verified).
         Blur Ray writer /reader
    With me using my NAS for media streaming I will not be burngin to many Blu ray disks, however I will be reading a few so that I can upload them onto the NAS via this unit.  I have no idea what is a good or bad unit or what to look for in this area?
         Monitor
    I have found some cheap solutions in the 23" sizing for a main screen (~160 AUD) supported by my existing 17' monitor, however is there anything I should be looking for in particular with the monitor I choose?
    I will update each section with what is decided on so that it may help others who are having the same tough decisions to make?
    Even if we just tackle the Motherboard first I would be greatfull...
    Thanks for reading and again all assistance is appreciated.
    Regards
    Jody

    Ok well after much reading I have got the following as the setup that shoe horns in at $2500 ish...
    Interested in thoughts for Premiere pro:
    Component Model $ each Stat Ice Store
    Case
    UNKNOWN AT THIS STAGE BUDGET $200
    Power Supply
    FSP Aurum Series 750W Modular Power Supply $139.00 PCCASEGEAR
    Motherboard
    ASUS P8P67 Deluxe REV 3 $212.00 I-Store
    Processor
    Intel I7 2600k Gen 2 $324.00 All needs Computer
    CPU Cooling
    Thermalright Silver Arrow CPU Cooler $89.00 PCCASEGEAR
    Memory
    G.Skill Ripjaws X F3-12800CL8D-8GBXM (2x4GB) DDR3 $79.00 $158.00 PCCASEGEAR
    OS/Programs Drive
    Patriot 120G Wildfire SSD SATA3  $289.00 Umart
    Capture/work Drive
    2 x  Samsung SpinPoint F3 1TB HD103SJ setup in Raid "0" $54.00 $108.00 Green Box IT
    Render to Drive
    2 x  Samsung SpinPoint F3 1TB HD103SJ setup in Raid "0" $54.00 $108.00 Green Box IT
    Dual/Quad Head Video
    Gigabyte GeForce GTX 580 Super Overclock $589.00 PCCASEGEAR
    DVD-RW
    LG BH12LS38 Optical Media (OEM) $68.71 Mega Buy
    Operating System
    Windows 7 64 Bit Pro $129.00 Umart
    Monitor
    Samsung S23A300B 23in Widescreen LED Monitor $149.00 Netplus  $2,362.71
    Total
    This will be supported by a 10tb 5 disc NAS on Gigabit connection for long term secure storage.

  • Uninstalled new version, horrible. Installed the older version and now it won't open! HELP WANT MY MUSIC!

    I installed the new version thinking it would be the same, It was horrible! uninstalled it... Installed the older version and now it won't open and when I try it says it can't because the library can't open because it was used on a newer version. Come on! I just want my music! How do I open this and get my music back.
    I put my Ipod in and it still says the same thing, what's going on? Please help me!

    I don't know whom to thank first-- b noir for telling me about the Lorraine fix or Lorraine for figuring out the fix. THE LORRAINE FIX WORKED FOR ME!!! (I feel a little like I am advertising "Hooked on Phonics" with that last line!)
    Thank you doesn't say it strongly enough, but THANK YOU b noir and Lorraine for your help. I was to the boiling point last night and starting to get there tonight. Now I am resting easy and thankful that there is a community of computer users out there who care enough to troubleshoot problems together and work together to figure out a solution--and then to take the time to post and share information.
    I would STRONGLY suggest that anyone who is having the iTunes issues where iTunes just plain won't open at all after downloading the newest version and has a pc with Norton Internet Security 2005 try the "Lorraine Method."
    I am so happy I think I might sing. Or not--I will let my songs on iTunes do the singing for me now that I can again!!!!!!!
    And to those still looking for answers--be patient--I now know how incredibly frustrating this can be and I hope that you all find your solutions very very soon!!
    --Alexis

  • Two iphones on one itunes account...problems galore..help wanted!!

    My wife and I both have an iphone and are delighted with it except for this problem..
    I bought mine first (phone 1), set up itunes and had no problems, it synced nicely, i downloaded music etc and ll was going well... the App store also work fantastically... my wife, based on my success (and the fact that her nokia N97 was pants) decided to get herself an iphone (phone 2). When signing up the contract in store we were told that "just, plug the phone into the laptop if you already have itunes and itunes will reognise it as a second device and act accordingly...." WRONG!!!
    What actually happened was that the new phone, synced with itunes with all my details and lost all of my wifes phone numbers she had entered onto it, it got worse, after deleting all the numbers that she didnt want and putting her phone book back as she wanted it, she synced it again, this time itunes took the details from her phone and stored them in itself, next i came along and synced my phone and lost all my work numbers, all my music too and ended up with my wifes details.... Now when i access the App store i have to enter her password.. sometimes.. sometimes i have to enter my own and sometimes neither will work and i cannot download anything at all. Its all become one big mess...
    I want an expert to untangle this mess for us as, at the moment i no longer sync my phone at all for fear of losing all the details again so of course im not getting the most from my phone. I phoned teh geek squad and they said... when you start itunes just hold down the CTRL button as you launch it and it will start a second account... it did but im sure that has added to the problem.
    Im no itunes expert but need this sorted to enjoy the device the way it was intended...
    Please help...

    Sorry things haven't worked the way you expected. You can sync as many devices as you want to the same itunes account, selecting under the various tabs what you want on each device and itunes will keep it all straight upon subsequent syncs. It appears you may not have properly selected what content you want on each device. To sort this out, start by reading this article on syncing. Most of your questions will be answered in that article. Post back after reading with specific questions related to specific content.
    http://support.apple.com/kb/HT1386

  • Help-Want to lock Time Machine back-up from being deleted

    Hello there,
    I used to have a macbook pro from november of 2006 that was loaded up with data from graduate school. As it was getting quite old, I wanted to get a newer laptop and chose the macbook air for many reasons. However, it doesn't have nearly as much storage/memory, so I could only transfer a fraction of the data files from my old laptop (pro) to the new one (air).
    I am currently using TimeMachine to back up everything to a 4 terabyte external hard drive. Even though I originally transferred all the data via this drive and had a mirrored back up of everything in its entirety from my old macbook pro, now when I view the external hard drive only my macbook air is listed under Backups.backupdp.
    I can still view all the original data and files from the macbook pro in my oldest back up, however, as I begin to fill up the hard drive I worry that this back up might eventually get deleted. Is there anyway to specifically cordone off this back up so that it is never deleted? I essentially want to lock it but am unsure if this is even possible, let alone how to do it.
    Any help you could provide would be greatly appreciated. Thank you so much!!
    All my best,
    pyo_pyo

    I think I follow your post..
    AFAIK there is no way to stop TM from eventually deleting the material from the oldest backup.. Indeed just hoping that the data is stored until the drive is full is not necessarily going to work.
    You need to have another storage and copy the backups.backupdb to it. Store this drive in a draw somewhere.
    Do you still have the old laptop . if so do not do a TM backup of it. Do a direct disk image plus copy and paste and perhaps TM as well.. of all the files and store that. Much easier when you later need access to a file to get it direct rather than extract it from a backup.
    1TB drives are now so cheap .. if the data has any value to you. Go and buy one or two.. spread it around. Store offsite. If anything is valuable it is valuable to store offsite as well.

  • Help wanted! Can't boot Snow Leopard, neither from HD nor disc!

    Hi.
    I tried to install Windows in Bootcamp on my wife's MacBook Pro 15" 2.4Ghz (with OSX SL), but something went wrong in the process and I now want to start all over by erasing the Bootcamp partition entirely.
    But, as I try to start up in MacOSX it just stops at the start sound over and over again.
    Can't shortcut by force starting it from MacOSX (command-X), from disc (command-C) or as a firewire disc (command-T).
    I also can't eject the Snow Leopard DVD from the drive bay.
    All it does is trying to boot and making the start up sound over and over and over and....
    Help is VERY much appreciated, please!

    Try starting in Safeboot and see if you get any further. To eject the DVD hold the left mouse button of a wired mouse on startup.

  • Change documents for customer Z table - serious help wanted

    Hi all,
    I am no beginner and I don't expect any comments from beginners.
    Situation: My customer wants to replace the material valuation transactions MRN1 MRN2 MRN3 due to bad performance and locking problems with own developed programs.
    The valuation results will be stored in a customer Z-Table on a monthly base. For auditing and transparency purposes, this Z-table has to get a change object and the update routines will have to write change documents.
    Due to the expected size of the new Z-table, it is not advisable to simply switsch on table logging.
    In this huge project (and in none I participated!) nobody ever implemented the change document process for a Z-table. <b>BUT EVERYBODY CAN TELL YOU THI IS NO PROBLEM AT ALL.</b>
    I read some documentation at SAP and serached for threads or blogs here. I could not find anything desribing that in depth.
    So before I start, I'd be happy to get some hints from people who created own change documents and implemented the process. Links to documentation and other helpful pages are also welcome.
    If I can keep the process simple, I'd like to create a BLOG on this - because I think, in the future it will get more and more difficult to pass the auditing process with undocumented features and uncontrolled table changes.
    TIA.
    Regards,
    Clemens

    Hi,
    Please check this thread.
    http://www.sapdevelopment.co.uk/tips/changedoc/cd_createch.htm
    Once you create your change document object using generate update pgm option then  please check the WRITE document fm.
    I have done this long back i am updating CDHDR and CDPOS for 2 table YATT and YATTPLANTS. Here YATT have single record (header table) and YATTPLANTS have multiple records (item table)
    function yatt_write_document           .
      call function 'CHANGEDOCUMENT_OPEN'
        exporting
          objectclass             = 'YATT           '
          objectid                = objectid
          planned_change_number   = planned_change_number
          planned_or_real_changes = planned_or_real_changes
        exceptions
          sequence_invalid        = 1
          others                  = 2.
      case sy-subrc.
        when 0.                                   "ok.
        when 1. message a600 with 'SEQUENCE INVALID'.
        when 2. message a600 with 'OPEN ERROR'.
      endcase.
    if upd_yctc                           ne space.
       call function 'CHANGEDOCUMENT_SINGLE_CASE'
         exporting
           tablename              = 'YATT                          '
           workarea_old           = o_yatt
           workarea_new           = n_yatt
            change_indicator       = upd_yattc
            docu_delete            = 'X'
         exceptions
           nametab_error          = 1
           open_missing           = 2
           position_insert_failed = 3
           others                 = 4.
        case sy-subrc.
          when 0.                                "ok.
          when 1. message a600 with 'NAMETAB-ERROR'.
          when 2. message a600 with 'OPEN MISSING'.
          when 3. message a600 with 'INSERT ERROR'.
          when 4. message a600 with 'SINGLE ERROR'.
        endcase.
      endif.
      if upd_yctcauthplnts                  ne space.
        call function 'CHANGEDOCUMENT_MULTIPLE_CASE'
          exporting
            tablename              = 'YATTPLANTS                 '
            change_indicator       = upd_yattplants
            docu_delete            = 'X'
          tables
            table_old              = yyattplants
            table_new              = xyattplants
         exceptions
           nametab_error          = 1
           open_missing           = 2
           position_insert_failed = 3
           others                 = 4.
        case sy-subrc.
          when 0.                                "ok.
          when 1. message a600 with 'NAMETAB-ERROR'.
          when 2. message a600 with 'OPEN MISSING'.
          when 3. message a600 with 'INSERT ERROR'.
          when 4. message a600 with 'MULTIPLE ERROR'.
        endcase.
      endif.
      call function 'CHANGEDOCUMENT_CLOSE'
        exporting
          objectclass             = 'YATT           '
          objectid                = objectid
          date_of_change          = udate
          time_of_change          = utime
          tcode                   = tcode
          username                = username
          object_change_indicator = object_change_indicator
          no_change_pointers      = no_change_pointers
        exceptions
          header_insert_failed    = 1
          object_invalid          = 2
          open_missing            = 3
          no_position_inserted    = 4
          others                  = 5.
      case sy-subrc.
        when 0.                                   "ok.
        when 1. message a600 with 'INSERT HEADER FAILED'.
        when 2. message a600 with 'OBJECT INVALID'.
        when 3. message a600 with 'OPEN MISSING'.
    *    WHEN 4. MESSAGE A600 WITH 'NO_POSITION_INSERTED'.
    * do not abort, if positions are not inserted!!!
        when 5. message a600 with 'CLOSE ERROR'.
      endcase.
    endfunction.

Maybe you are looking for

  • Reg sending mail attachment

    Hi, im working on sending report output as mail attachment in pdf format.. but im not getting the required output,,,i.e., even after entering email addresses in the selection screen....im not getting any mail to the respective mail-ids.. im pasting t

  • Memory leak in external interface SetReturnValue?

    I'm having trouble with a memory leak in my application. I'm hoping someone out there can help me find a fix or workaround, or tell me what I'm doing wrong. The leak seems to be coming from the flash external interface; specifically, IShockwaveFlash.

  • SUBCONTRACT PROCESSING AGAINST PRODUCTION ORDER

    DEAR GURUS, SCENARIO - PRODUCTION ORDER HAS 10 OPERATIONS OUT OF WHICH OPERATION 10 TO 20 - IN HOUSE 20 TO 40 - EXTERNAL 40 TO 50 - IN HOUSE 60 - EXTERNAL 70 TO 100 IN HOUSE.  PLEASE LET ME KNOW THE ENTIRE PROCESS WITH REGARD TO CREATION OF BOM, SUBC

  • How to find spanish textbooks for ipads?

    I need to order Spanish books for my MS and High School students. They all have ipads.

  • General authorizations do not apply

    estimated in the menu general authorizations, changes do not apply and there is no error message. Someone who can help me solve this problem. Thank you.