Need Java code for random text.

To all you Java programmer Gurus out there.
How hard is it to make a small Java program whose whole purpose is to ask a user how many random characters they want and then proceeds to generate a text file full of RANDOM characters A-Z and a-z ?
The characters could repeat it does not matter as long as they repeat randomly.
I've found all kinds of code examples for Random password generators and things like that but none quite do what I want them to do.
sample of what the output file might look like
"fdfbgHBukOKiIkolpPkmNytTrFvDsVbNmNHyygrRDeDsSEfFGHGjJkjKKoJH"
Thank You kindly in Advance

JasonP wrote:
To all you Java programmer Gurus out there.
How hard is it to make a small Java program whose whole purpose is to ask a user how many random characters they want and then proceeds to generate a text file full of RANDOM characters A-Z and a-z ? Not hard, in fact not hard at all.
Thank You kindly in AdvanceYou're quite welcome!

Similar Messages

  • I Need Java code for following Algorithm

    * I Need Java code for following algorithm. Kindly any one help.
    1. Read the contents (ideas and its corresponding scores) from two files named as 'a' and 'b'.
    2. Stored the file 'a' contents in array a[].
    3. Stored the file 'b' contents in array b[].
    4. compare both files like
    if(a.equals(b[j])
    Writing the common idea and add the score from file 'a' and 'b'.
    else
    write the uncommon idea and its score..
    For example :
    Form Agents.txt
    action,65
    architecture,85
    eco-,15
    essay,30
    form,85
    form,85
    link,40
    tangent,25
    Form Agents1.txt
    Black holes,69
    essay,78
    Herewith i have above mentioned two files named as Form Agents and Form Agents1.
    Form Agents has eight fields
    Form Agents1 has two fields
    --> 'essay' is common in two files, so store the idea 'essay' and add the score from Form Agents score is '30' and Form Agents1 has 78 (essay 108).
    Finally it stores idea in another file with uncommon fields also.
    Please help us.

    We have tried with following code.
    But we cant add the scores.
    For Example:
    Form Agents.txt --> has "essay,30"
    Form Agents1.txt --> has "essay,78"
    Result is: essay,108
    Finally it stores idea in another file with uncommon fields also.
    So Any one pls correct the following code.
    try
    DataOutputStream o1=new DataOutputStream(new
    FileOutputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
    World\\Project\\Material\\art\\System Agents\\Form Agents\\CandidateResponses\\Form
    Agents.txt"));
    //Reading the contents of the files
    BufferedReader br= new BufferedReader(new InputStreamReader(new
    FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
    World\\Project\\Material\\art\\System Agents\\Form Agents\\Ideological\\Form
    Agents.txt")));
    BufferedReader br1= new BufferedReader(new InputStreamReader(new
    FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
    World\\Project\\Material\\art\\System Agents\\Form Agents\\Related\\Form
    Agents.txt")));
    while((s=br.readLine())!=null)
    s1+=s+"\n";
    while((s2=br1.readLine())!=null)
    s3+=s2+"\n";
    int numTokens = 0;
    StringTokenizer st = new StringTokenizer(s1);
    String[] a = new String[10000];
    String[] br_n=new String[10000];
    int i=0;
    while (st.hasMoreTokens())
    s2 = st.nextToken();
    a=s2.substring(0,s2.length()-3);
    s6=s2.substring(s2.length()-2);
    br_n[i]=s6;
    i++;
    numTokens++;
    int numTokens1 = 0;
    StringTokenizer st1 = new StringTokenizer (s3);
    String[] b = new String[10000];
    String[] br1_n=new String[1000];
    int j=0;
    while (st1.hasMoreTokens())
    s4 = st1.nextToken();
    b[j]=s4.substring(0,s4.length()-3);
    s7=s4.substring(s4.length()-2);
    br1_n[j]=s7;
    j++;
    numTokens1++;
    int x=0;
    for(int m=0;m<a.length;m++)
    for(int n=0;n<b.length;n++)
    if(a[m].equalsIgnoreCase(b[n])){
    int sc=Integer.parseInt(br_n[m]);
         int sc1=Integer.parseInt(br1_n[n]);
    int score=sc+sc1;
         o.writeBytes(a[m]+","+score+"\n");
    break;
    else
    o.writeBytes(a[m]+","+br_n[m]+"\n");
    break;
    }catch(Exception e){}

  • I need java code for chating application

    i need java code for chating application. plz help me

    GANGINENI wrote:
    i need java code for chating application. plz help meGIYF.
    [http://today.java.net/pub/a/today/2006/10/05/instant-messaging-for-jabber-with-smack.html|http://today.java.net/pub/a/today/2006/10/05/instant-messaging-for-jabber-with-smack.html]
    File under: lern2Google

  • I need Java code for a simple graphical hit counter for a webpage

    I was wondering if anybody out there could send me some code for a simple graphical hit counter for a webpage. All the sites that I've visited are garbage and of no use to me. Please help me.
    Colin

    Not as easy as you'd imagine with applets. You need some way to store the hits, usually through a file on the server. That's not gonna happen in a hurry for 2 reasons -
    - Applets can't read/write files
    - Your web server usually won't let you run programs on their machine (ie, programs that listen for socket connections from applets, then load/read/write/close a file).
    In short, no, there is no simple java solution (that I know of).
    Cheers,
    Radish21

  • Need Javascript code for changing text field color

    Looking for a Javascript code to change the textfield background color and edge color in acrobat?  (without any xfa reference)

    The background color is the fillColor field property: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.705.html
    and the edge color is the strokeColor property: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.723.html

  • I need php code for copy paste our all histroy of browser in a text page.

    I need php code for copy paste our all histroy of browser in a text page can any one send me the code please.

    You can use an application like GarageSale for doing this....
    http://www.macupdate.com/info.php/id/16035/garagesale

  • Needed a code for Creating a Log File in java so that its size is limited

    Hi
    I need the code for developing a log file using threads so that the log file size is limited
    and if the size of the log file is increasing above 1Mb,another log file has to be created automatically and the log have to be printed into that new file.
    Thanks in advance

    package cms.web.log;
    import java.io.*;
    import java.util.Calendar;
    import cms.web.WebUser;
    *     Log is generated by JEditor 1.0.0
    *     @Project      : cms
    *     @Version      : 1.0.0
    *     @Created date : 11:07:40  PM Thursday, 25/07/2002
    *     @Author       :
    *     @Organization :
    *     @Copyright    : (c) 2002
    *     An utility class used to write information, especially error messages, to
    *     log file so that they can be viewed at later time by administrators.
    *     Extra information such as date & time they occures & where they are thrown...
    *     are automatically included and append to the end of log file.
    *     Log files will increase with the format "name_n" where n is file counter
    public class Log implements Serializable
          *     logs marker
         static final String START= "\n\0";
          *     parent directory that contains log files
         private static File parent;
         private PrintStream out;
         private String name;
          *     to count how many log for the current stream
         int counter;
          *     maximum number of logs for each log file
         int max;
         public static void init(File parent)
              if (!parent.exists())
                   parent.mkdirs();
              Log.parent= parent;
         public Log(String name, int max)
              this.name= name;
              this.max= max;
              file= getLastFile();
              counter= countLogs(file);
              out= openStream(file);
         public synchronized void appendLog(String log)
              if (log == null || log.length() == 0)
                   return;
              count();
              try {
                   out.println(START+ counter+ " | "+ getCurrentTime()+ " | "+ log);
                   out.flush();
              } catch (Exception e) {}
          *     Append the given log to log file.
         synchronized void appendLog(String msg, WebUser user)
              if (msg == null || msg.length() == 0)
                   return;
              count();
              try {
                   out.println(START+ counter+ "----------------------------------------------------------");
                   out.println(getCurrentTime());
                   out.println(user != null? "User:"+ user.getFullName(): "User: public user");
                   out.println(msg);
                   out.println("\n----------------------------- end -----------------------------\n");
                   out.flush();
              } catch (Exception e) {}
          *     Append the given exception to log file
         synchronized void appendLog(Throwable error, WebUser user)
              if (error == null)
                   return;
              count();
              synchronized (out)
                   try {
                        out.println(START+ counter+ "----------------------------------------------------------");
                        out.println("Exception occured at "+ getCurrentTime());
                        out.println(user != null? "User: "+ user.getFullName(): "User: public user");
                        error.printStackTrace(out);
                        out.println("----------------------------- end -----------------------------\n");
                        out.flush();
                   } catch (Exception e) {}
         private String getCurrentTime()
              Calendar c= Calendar.getInstance();
              return
                   parse(c.get(Calendar.HOUR_OF_DAY))+ ":"+               // 0 --> 23
                   parse(c.get(Calendar.MINUTE))+ ":"+                     // 0 --> 59
                   parse(c.get(Calendar.SECOND))+ " "+                     // 0 --> 59
                   parse(c.get(Calendar.DAY_OF_MONTH))+ "/"+                 // 1 --> 31
                   parse(c.get(Calendar.MONTH)+ 1)+ "/"+                     // 1 --> 12
                   c.get(Calendar.YEAR);                                        // yyyy
         private String parse(int n)
              return n< 10? "0"+ n: ""+ n;
         private void count()
              counter++;
              if (counter> max)
                   incrementFile();
                   counter= 1;
         private void incrementFile()
              File file= null;
              int n= 0;
              while ((file= new File(parent, name+ n+ ".log")).exists())
                   n++;
              if (out != null)
                   out.close();
              out= openStream(file);
         private PrintStream openStream(File file)
              try {
                   if (file.exists())
                        return new PrintStream(new FileOutputStream(file.getPath(), true));
                   else
                        return new PrintStream(new FileOutputStream(file.getPath()));
              } catch (IOException e) {
                   throw new RuntimeException(e.getMessage());
         private int countLogs(File file)
              int count= 0;
              InputStream in= null;
              try {
                   in= new FileInputStream(file);
                   int n;
                   while ((n= in.read()) != -1)
                        if (n == '\0')
                             count++;
              } catch (IOException e) {
              } finally {
                   if (in != null)
                        try {
                             in.close();
                        } catch (IOException e) {}
              return count;
         private File getLastFile()
              File file= new File(parent, name+ "0.log");
              File curr;
              int n= 1;
              while ((curr= new File(parent, name+ n+ ".log")).exists())
                   file= curr;
                   n++;
              return file;
         protected void finalized()
              if (out != null)
                   out.close();

  • I need ready code for a simple paint program today

    hi all I need ready code for a simple paint program today for me ics projct
    plz give me a halp on this give me what you have with you and it is so good if it look like this :
    Design a GUI based drawing Java application that works like a simple paint program
    1-There should be a number of buttons for choosing different shapes to draw. For example, there should be a button for rectangle. If user presses the rectangle button, then he can draw a rectangle using mouse. Similarly, there should be a button for each shape(rectangle, circle, ellipse, and line etc.
    2-The shapes can be filled with different colors.
    3-There should be option of moving .
    4- There should also be three menus including File, Shape, and Color menu.
    i. File menu can have menu items New and Exit. If user selects New, the drawing area will be cleared and all shapes will be erased.
    ii. Shape menu will serve the same purpose as of feature 2 described above. It will have menu items for drawing all the different shapes. For example, there will be menu item for rectangle; so user can draw a rectangle by selecting the menu item for rectangle.
    iii. Color menu will serve the same purpose as of feature 3 described above. It will have menu items for all the colors which are shown in color buttons. The user can select a color from this menu and then click inside a shape to fill it with the selected color.

    Read the Swing tutorial. There are sections on how to use menus and painting and all other kinds of stuff you need to do this homework assignment. Nobody here is going to write the code for you:
    http://java.sun.com/docs/books/tutorial/uiswing/TOC.html

  • Code for "Convert Text into Speech"

    I am developing a website for blinds. I need a code for read the text and convert into speech.
    It is very urgent and may help for all blind people.

    HI
    This is very nice concept for blind people I will also try to help u...
    Please refer attached file as well as there is API available of  iSpeech.org use that to convert tedt to speech...
    ALL D BEST.

  • If any one has java code for any video compression algorithm

    i need a complete java code for video compression step by step

    i need a complete java code for video compression step by step

  • Need a code for Customer exit for extractor 0WBS_ELEMT_ATTR

    Hi Guys,
    I need a code for following requirement.
    I have appended some fields to standard extractor 0WBS_ELEMT_ATTR which normally takes data from PRPS table. But the new fields will be getting data from PRTE and PROJ table. with common keys. Following is my code which is not working. Please help me out, I am not good in abap. Please note some lines are commented.
    Thanks,
    H
    CODE:::::
    form 0wbs_elemt_attr  tables i_t_data structure biw_prps.
      data: it_wbs_prps like biw_prps occurs 0.
      data wa_prps like it_wbs_prps.
    data: begin of it_wbs_prps occurs 0,
             PSPNR like prps-pspnr,
             POSID like prps-posid,
             PBUKR like prps-PBUKR,
             IZWEK like prps-IZWEK,
             USR10 like prps-USR10,
             USR00 like prps-USR00,
             USR02 like prps-USR02,
             OBJNR like prps-OBJNR,
           end of it_wbs_prps.
    data wa_prps like it_wbs_prps.
      data: begin of it_wbs_prps1 occurs 0,
              PSPNR like prps-pspnr,
              POSID like prps-posid,
            end of it_wbs_prps1.
      data wa_prps1 like it_wbs_prps1.
      data: begin of it_wbs_prte occurs 0,
              posnr like prte-posnr,
              PSTRT like prte-PSTRT,
              PENDE like prte-PENDE,
              ESTRT like prte-ESTRT,
              EENDE like prte-EENDE,
              ISTRT like prte-ISTRT,
              IENDE like prte-IENDE,
            end of it_wbs_prte.
      data wa_prte like it_wbs_prte.
      data: begin of it_wbs_proj occurs 0,
              PSPNR like proj-pspnr,
              PLFAZ like proj-plfaz,
              PLSEZ like proj-plsez,
            end of it_wbs_proj.
      data wa_proj like it_wbs_proj.
    refresh: it_wbs_prte, it_wbs_proj.
    *it_wbs_jest.
    if i_t_data[] is not initial.
    Get data from PRPS WBS Master Data
         select pspnr posid PBUKR IZWEK USR10 USR00 USR02 objnr
           into corresponding fields of table it_wbs_prps
           from prps
            for all entries in i_t_data
          where POSID = i_t_data-POSID.
         sort it_wbs_prps by posid.
    Get data from PRPS1 WBS Master Data
          select pspnr posid
           into corresponding fields of table it_wbs_prps1
            from prps
            for all entries in i_t_data
         where POSID = i_t_data-POSID.
        sort it_wbs_prps1 by posid.
    Get data from PRTE Scheduling Data for Project Item
         if it_wbs_prps1[] is not initial.
         select posnr PSTRT PENDE ESTRT EENDE ISTRT IENDE
           into corresponding fields of table it_wbs_prte
           from prte
            for all entries in it_wbs_prps1
          where posnr = it_wbs_prps1-pspnr.
         sort it_wbs_prte by posnr.
         endif.
    Get data from PROJ Project Master Data
         if it_wbs_prps1[] is not initial.
         select pspnr PLFAZ PLSEZ
           into corresponding fields of table it_wbs_proj
           from proj
           for all entries in it_wbs_prps
          where pspnr = it_wbs_proj-pspnr.
         sort it_wbs_proj by pspnr.
         endif.
    loop at i_t_data.
       clear: wa_prps1, wa_prte, wa_proj.
       read table it_wbs_prps into wa_prps with key
                  posid = i_t_data-posid binary search.
       read table it_wbs_prte into wa_prte with key
                  posnr = wa_prps1-pspnr.
       read table it_wbs_proj into wa_proj with key
                  pspnr = it_wbs_proj-pspnr.
             i_t_data-zzPBUKR = wa_prps-pbukr.
             i_t_data-zzIZWEK = wa_prps-IZWEK.
             i_t_data-zzUSR10 = wa_prps-USR10.
             i_t_data-zzUSR00 = wa_prps-USR00.
             i_t_data-zzUSR02 = wa_prps-USR02.
              i_t_data-zzPSTRT = wa_prte-PSTRT.
              i_t_data-zzPENDE = wa_prte-PENDE.
              i_t_data-zzESTRT = wa_prte-ESTRT.
              i_t_data-zzEENDE = wa_prte-EENDE.
              i_t_data-zzISTRT = wa_prte-ISTRT.
              i_t_data-zzIENDE = wa_prte-IENDE.
              i_t_data-zzPLFAZ = wa_proj-PLFAZ.
              i_t_data-zzPLSEZ = wa_proj-PLSEZ.
        modify i_t_data.
    endloop.
    endif.
    endform.                    " 0wbs_elemt_attr

    Hi,
    it_wbs_prps1 .
    If you are going to use this internal table to check for a null condition, shouldn't you first assign the data package to it?
    For example,   it_wbs_prps1 = i_t_data[].
    Because you are now using  it_wbs_prps1 to select data from a table and it doesn't have any data.
    Please check.
    -RMP
    Edit : Please ignore this. I didn't see that you are actually filling the internal table. Sorry!
    Edited by: RMP on Oct 18, 2010 12:16 PM

  • Need a code for finding prime no.s from 0 to 100.

    Hi,
    i need a code for finding prime no.s from 0 to 100.
    Please help me out.
    Regards,
    Santosh Kotra.

    hai santosh,
    here is an example program to find the prime number...........
    EXAMPLE:
    DATA: BEGIN OF primes OCCURS 0,
            number TYPE i,
            exp    TYPE i,
          END OF primes.
    DATA: w_mult TYPE i,
          w_limi TYPE i,
          w_prem TYPE i.
    DATA: w_outp TYPE text132.
    DATA: w_rtime TYPE i,
          w_stime TYPE p DECIMALS 3.
    DEFINE add_part.
      sy-fdpos = strlen( &1 ) + 1.
      &1+sy-fdpos(*) = &2.
      condense &1.
    END-OF-DEFINITION.
    PARAMETERS: p_numb TYPE i,                "number to check
                p_fact TYPE c AS CHECKBOX,    "display components
                p_nbpr TYPE c AS CHECKBOX.    "nb of primes
    START-OF-SELECTION.
      GET RUN TIME FIELD w_rtime.
      IF p_nbpr IS INITIAL OR p_numb LE 12000.
        PERFORM eratostene USING p_numb.
        add_part w_outp p_numb.
        READ TABLE primes WITH KEY number = p_numb.
        IF sy-subrc = 0.
          add_part w_outp 'is prime'.
        ELSE.
          IF p_fact IS INITIAL.
            add_part w_outp 'is not prime'.
          ELSE.
            add_part w_outp '='.
            w_limi = p_numb.
            LOOP AT primes WHERE exp GT 0.
              CHECK primes-number LE w_limi.
              IF w_prem GT 0.
                add_part w_outp '*'.
              ENDIF.
              IF primes-exp GT 1.
                add_part w_outp '('.
                add_part w_outp primes-number.
                add_part w_outp '^'.
                add_part w_outp primes-exp.
                add_part w_outp ')'.
              ELSE.
                add_part w_outp primes-number.
              ENDIF.
              w_limi = w_limi / ( primes-number ** primes-exp ).
              IF w_limi = 1.
                EXIT.
              ENDIF.
              w_prem = 1.
            ENDLOOP.
          ENDIF.
        ENDIF.
        WRITE: / w_outp.
        IF NOT p_nbpr IS INITIAL.
          DESCRIBE TABLE primes LINES sy-tmaxl.
          CLEAR: w_outp.
          add_part w_outp 'Number of primes:'.
          add_part w_outp sy-tmaxl.
          WRITE: / w_outp.
          SKIP.
          LOOP AT primes.
            WRITE: / primes-number.
          ENDLOOP.
        ENDIF.
      ELSE.
        PERFORM factors.
      ENDIF.
      GET RUN TIME FIELD w_rtime.
      w_stime = w_rtime / 1000000.
      SKIP.
      CLEAR: w_outp.
      add_part w_outp 'Calculation time:'.
      add_part w_outp w_stime.
      WRITE: / w_outp.
          FORM eratostene                                               *
    FORM eratostene USING in_number TYPE i.
      DATA: BEGIN OF no_primes OCCURS 0,
              number TYPE i,
            END OF no_primes.
      DATA: cnum TYPE i,
            dnum TYPE i,
            limi TYPE i,
            mult TYPE i,
            puis TYPE i,
            cmod TYPE i.
      IF NOT ( p_fact IS INITIAL AND p_nbpr IS INITIAL ).
        limi = in_number.
      ELSE.
        limi = sqrt( in_number ).
      ENDIF.
      cnum = 2.
      WHILE cnum LE limi.
        READ TABLE no_primes WITH KEY number = cnum.
        IF sy-subrc NE 0.
          primes-number = cnum.
          mult = 2.
          puis = 1.
          dnum = mult * cnum.
          WHILE dnum LE in_number.
            READ TABLE no_primes WITH KEY number = dnum.
            IF sy-subrc NE 0.
              no_primes-number = dnum.
              APPEND no_primes.
            ENDIF.
            IF NOT p_fact IS INITIAL.
              cmod = dnum MOD ( cnum ** puis ).
              IF cmod = 0.
                cmod = in_number MOD ( cnum ** puis ).
                IF cmod = 0.
                  primes-exp = puis.
                  puis = puis + 1.
                ENDIF.
              ENDIF.
            ENDIF.
            mult = mult + 1.
            dnum = mult * cnum.
          ENDWHILE.
          APPEND primes.
          CLEAR: primes.
        ENDIF.
        cnum = cnum + 1.
      ENDWHILE.
    ENDFORM.
          FORM factors                                                  *
    FORM factors.
      DATA: ex_factors TYPE string,
            mod        TYPE i,
            still      TYPE f,
            factor     TYPE i,
            exponent   TYPE i,
            square     TYPE f,
            fac_string TYPE text40,
            exp_string TYPE text40.
      IF p_numb LE 3.
        ex_factors = p_numb.
      ELSE.
        factor = 2.
        still  = p_numb.
        DO.
          CLEAR: exponent.
          mod = still MOD factor.
          WHILE mod = 0.
            exponent = exponent + 1.
            still    = still div factor.
            mod      = still MOD factor.
          ENDWHILE.
          IF exponent EQ 1.
            fac_string = factor.
            CONCATENATE ex_factors '*'  fac_string
                                   INTO ex_factors
                           SEPARATED BY space.
            CONDENSE ex_factors.
          ELSEIF exponent GT 1.
            fac_string = factor.
            exp_string = exponent.
            CONCATENATE ex_factors '* (' fac_string
                                   '^'   exp_string ')'
                                   INTO  ex_factors
                           SEPARATED BY space.
            CONDENSE ex_factors.
          ENDIF.
          factor = factor + 1.
          square = factor ** 2.
          IF square GT still.
            EXIT.
          ENDIF.
        ENDDO.
        IF still GT 1.
          CATCH SYSTEM-EXCEPTIONS convt_overflow = 1.
            fac_string = factor = still.
          ENDCATCH.
          IF sy-subrc NE 0.
            fac_string = still.
          ENDIF.
          CONCATENATE ex_factors '*' fac_string
                                INTO ex_factors
                        SEPARATED BY space.
          CONDENSE ex_factors.
        ENDIF.
        SHIFT ex_factors UP TO '*'.
        SHIFT ex_factors BY 2 PLACES.
      ENDIF.
      WRITE: / p_numb RIGHT-JUSTIFIED.
      IF ex_factors CA '*^'.
        WRITE: '=', ex_factors.
      ELSE.
        WRITE: 'is prime'.
      ENDIF.
    ENDFORM.
    HOPE THIS WILL BE HELPFULL.
    regards
    praba.

  • Why I need a code for rent a film and where ist the code? (I dont have a card)

    Why I need a code for rent a film and where ist the code? (I dont have a card)

    it's unclear what you mean
    you say you dont have a card which I guess is you don't have a creditcard
    in which case the other option is to pay by a giftcard which include a code which you put in
    because to rent you have to pay otherwise it's not really renting

  • I need a code for verifiing my emailadress. How do get a new one ?

    Photoshop Elements 12
    Share
    Try to send email directly from Photoshop elements
    The program ask for a code to verifiing my emailadress
    I need a code for verifiing my emailadress. How do get a new one ?

    Check your email.  The screen capture says that they sent one to the email address listed.

  • Provide the java code for the following scenario.

    Hi Experts,
    I have tried with all the combinations for this scenario. As per my understanding i require java code for the following scenario
    so that it becomes easy........
    I require a Message mapping for this Logic.
    In the Source there are 4 fields and, the Target side, the fields should appear like this.
    Source Structure- File
    Record
    |-> Header
    Order_No
    Date
    |-> Item
    Mat_No
    Quantity
    Target Structure-IDoc
    IDoc
    |-> Header
    |-> Segment
    Delivery_Order_No
    Recv_Date
    |-> Item
    |-> Segment
    Delivery_Order_No
    Material_Num
    Recv_Quantity.
    The Logic is for every Order number an IDOC is generated.And if the Material num matches then the quantity should be added. and important note is that the material numbers are different for every order number. That means if a material number is 2 in the order number A. Then the material number can never be 2 in any of the order numbers.Here is the following with an example for the above scenario.
    For example:-
    we have
    Source Structure- File
    Order-no Date Mat_No Quantity
    1 01/02/2011 A 10
    1 01/02/2011 B 15
    1 01/02/2011 A 10
    2 01/02/2011 C 10
    2 01/02/2011 C 10
    3 01/02/2011 D 20
    3 01/02/2011 D 10
    3 01/02/2011 E 25
    Target Structure-IDoc
    Delivery_Order_No Recv_Date Material_Num Recv_Quantity
    1 01/02/2011 A 20
    1 01/02/2011 B 15
    2 01/02/2011 C 20
    3 01/02/2011 D 30
    3 01/02/2011 E 25
    So for this example total of 5-Idocs created. That means for this example if Order_No is 1 When the Mat_No is A the quantity gets added. For this Scenario 1 IDoc with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) is generated by adding the quantity field in the Target Side. Similarly if Order_No is 1 when the Mat_No is B then separate IDoc is generated with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) in the Target Side. Similarly, if Order_No is 2 when the Mat_No is C, an IDoc is generated with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) by adding the quantity field in the Target Side. ike wise the process goes on upto 3.Kindly do the needy..
    Kindly provide the java code.
    Thanq very much in advance..

    what i have understood from ur example is that u want to generate an idoc for unique combination of  Order-no and Mat_No
    if yes then chk the below mapping..
    change the context of Order_No, Date, Mat_No and Quantity to Record (right click-> context)
    1)
    Order-no
    ----------------------concat[;]---sort----splitbyvalue(valuechanged)-----collapse context---IDoc
    Mat_No
    2)
    Order-no
    --------concat[;]---sort----splitbyvalue(value changed)---collapse context---UDF1--splitbyvalue(each value)--Delivery_Order_No
    Mat_No
    3)
    Order-no
    -----------concat[;]---sortbykey----------------------- \
    Mat_No                       /                            \
    Date--------------- /                                       \
    ----------------------------------------------------------FormatByExample-----collapsecontext---splitbyvalue(each value)----Recv_Date
    Order-no                                                 /
    -----------concat[;]---sort----splitbyvalue(value changed)
    Mat_No
    4)
    Order-no
    --------concat[;]---sort----splitbyvalue(value changed)---collapse context-UDF2--splitbyvalue(each value)--Material_Num
    Mat_No
    5)
    Order-no
    -----------concat[;]---sortbykey
    Mat_No                       /
    Quantity --------------- /
    ----------------------------------------------------------FormatByExample-----SUM(under statistic)----Recv_Quantity
    Order-no
    -----------concat[;]---sort----splitbyvalue(value changed)
    Mat_No
    UDF1:
    String [] temp= a.split(";");
    return temp[0];
    UDF2:
    String [] temp= a.split(";");
    return temp[1];

Maybe you are looking for