Retrieving the union of letters from two or more character strings

Dear Gurus,
Need your help in writing ABAP logic for the below requirement.
Assume we have Var1 = 'ABCD' , Var2 = 'CDEF' and Var3 = 'EFGH'. The requirement is to populate Var4 with union of the letters from the above three strings. That means, Var4 should be equivalent to 'ABCDEFGH' after the logic is executed. Can any body help in writing this logic.
Appreciate your quick help.
Thanks
Aryan

Here's an algorithm that might work for you.. I'm sure there are plenty more!
report zlocal_jc_union.
parameters:
  p_var1(10)            type c default 'ABCD',
  p_var2(10)            type c default 'CDEF',
  p_var3(10)            type c default 'EFGH'.
start-of-selection.
  perform logic.
*&      Form  logic
form logic.
* "Work out unique letters and keep them in sequence.
  data:
    l_union(300)        type c,
    l_byte(1)           type c,
    l_offset            type i.
  concatenate
    p_var1
    p_var2
    p_var3 into l_union. "append them together
  format reset.
  write: / 'Before:', l_union(80).
*" then remove duplicates, one at a time...
  do.
    l_byte = l_union+l_offset(1).
    do.
      replace l_byte with space into l_union.
      if not sy-subrc is initial. "no more to replace
        exit.
      endif.
    enddo.
    l_union+l_offset(1) = l_byte. "replace original value
    condense l_union no-gaps.
    write: / 'Offset', l_offset, l_union(80).
    add 1 to l_offset.
    if l_offset = strlen( l_union ). "run out of bytes
      exit.
    endif.
  enddo.
endform.                    "logic

Similar Messages

  • Fm or metod that retrieve the lock object name from the table name

    HI ALL,
    there is FM or method that retrieve the lock object name from the table name ?
    Best regards
    Nina

    CALL FUNCTION 'ENQUEUE_REPORT'            
    EXPORTING                                
    gclient                     = sy-mandt   
    gname                       = 'RCTMV'         "Table Name
      GTARG                       = ' '       
      GUNAME                      = SY-UNAME  
    IMPORTING                                 
      number                      =           
      SUBRC                       =           
      TABLES                                  
        enq                         =  lt_seqg3
    EXCEPTIONS                               
       communication_failure       = 1        
       system_failure              = 2        
       OTHERS                      = 3

  • HT1766 how to retrieve the back up files from the itunes

    how to retrieve the back up files from the itunes

    What are you trying to do...extract data from your backup? If so, you need something like this:
    http://www.iphonebackupextractor.com/

  • "Retrieve the COM class factory from component with CLSID {623F456-...etc}

    When i try to run on Window server 2008 R2 it gives following error
    "Retrieve the COM class factory from component with CLSID {623F456-...etc} failed due to the followi
    i developed application in xp  it run fine

    Hi
    When you make an ard select the target CPU x86 rather then any CPU in advanced compile options(Properties-> Compile-> Advance Compile Options)
    hope it helps
    Regards
    Rupinder

  • HT201272 I lost my itunes library, now i tried to retrieve the music i purchased from apple and i am only getting part of it!

    Cant retrieve the music i purchased from apple videos etc,
    I called cust service she want me to pay 49 us dollars for a tech support I told her i dont need tech support i do need my files that i purchased available for download, she insisted I hang up.
    I need help from you guys, I am student full time so no extra cash to pay for apple bills.
    regards

    Sue,
    I recommend an external drive to maintain your music.  All your purchases are held in iCloud...so redownloading should be easy.  Also, Home sharing is a great way to transfer to a new computer, but in the case of hard drive failure your options are limited.  Home sharing is specifically for transferring to another pc.  Good luck!

  • How to retrieve the data/property value from portalapp.xml

    Hi I would like to retrive the some common data from the portalapp.xml file
    <application>
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
          </application-config>
      <components>
        <component name="DynZMMGR">
          <component-config>
            <property name="ClassName" value="DynZMMGR"/>
            <property name="SecurityZone" value="DynZMMGR/high_safety"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/DynJspZMMGR.jsp"/>
          </component-config>
          <component-profile/>
        </component>
        <component name="dynpagedel">
          <component-config>
            <property name="ClassName" value="dynpagedel"/>
          </component-config>
          <component-profile/>
        </component>
        <component name="VARIANTLIST">
          <component-config>
            <property name="ClassName" value="com.sap.ep.r3rpts.VARIANTLIST"/>
            <property name="SecurityZone" value="com.sap.ep.r3rpts.VARIANTLIST/high_safety"/>
          </component-config>
          <component-profile/>
        </component>
        <component name="DynZMM33">
          <component-config>
            <property name="ClassName" value="DynZMM33"/>
            <property name="SecurityZone" value="DynZMM33/high_safety"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/DynJspZMM33.jsp"/>
          </component-config>
          <component-profile/>
        </component>
      </components>
      <services/>
    </application>
    The above is my portalapp.xml file .
    I want to retrieve the common data across the component.
    These  datas are common across the components .
    I kmow by putting the data inside the
    component name="DynZMM33">
          <component-config>
            <property name="ClassName" value="DynZMM33"/>
            <property name="SecurityZone" value="DynZMM33/high_safety"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/DynJspZMM33.jsp"/>
          </component-config>
    <component-profile>
       <property name="UserID" value="userid"/>
       <property name="password" value="password"/>
    </component-profile>
    </component>
    this becoms component specific ... which I can retriev the by using
    String ClientVal = request.getComponentContext().getProfile().getProperty("Client");
    in doContent()  method ..
    But this way i have to specify these properties in all the component.. which is repetetive in nature.
    I would rather put it in common location and want to retrieve the info from the portalapp.xml...
    How to achieve this
    I am using "AbstractPortalComponent"  .
    thanks
    pkiran

    Hi Prashanth,
    see Reading another iView's profile personalized values and Validate PCD URI
    Anyhow, maybe you should implement a service which returns the values (from the service profile). This would be more clean for accessing global values.
    Hope it helps
    Detlev

  • How to retrieve the doc format data from the database?

    Hi Experts,
         I need to retrieve the doc files ( Cv's) from data base to my presentation server. In order to do that what is the field I can use?

    You can use officecontrol UI element for displaying doc files.
    below are some important links
    [Office Control|http://help.sap.com/saphelp_nw04/helpdata/en/5d/a0b16a9d2e4e4d8b2322af6728263f/content.htm]
    [example|http://help.sap.com/saphelp_srm40/helpdata/ru/ef/3483789514b748b6fe1f145e9685ab/content.htm]
    thanks
    sarbjeet singh

  • How to programmatically retrieve the real field name from a view object ?

    Dear all,
    when I map a business component (a database table) to a view, the fields are automatically converted by JDeveloper, for example, a field named 'user_id' in the oracle table definition, becomes 'userid' in the view.
    The question: how can I retrieve the right table column name from within a backing bean ? Please explain also what should I bind and how; should I use an iterator ?
    Another more: since we can change the label of a field on a view, how can then I get the mapping between the column name on the view and the column name on the table in the database ?
    Thanks in advance,
    Sergio.

    Hi Timo,
    many thanks for your answer.
    The rest of my question: you know we can drop a view from the DataControls onto a ADF page, with each field of the table having a label.
    That label is initially set like the internal table field name, so for instance, if user_id is the real table field name, userid will be the (by JDeveloper) internal renamed table field name, and the label would be userid too.
    If I then change the label text to, for example, "myUserid", the question is: how can I know which real table field does "myUserid" point to ?
    In other words, when my form is submitted, I want to know which field name has been changed and prepare an update sql in a bean.
    For this purpose I bind each view field to a validator function in the bean, and collect al the pairs "label_name + submitted value" in an hash table.
    Now inorder to build up that update query, I need the mapping between the label_name ("myUserid") and the real table field name ("user_id"). The question: how to map the label to the real table field name ?
    By the way, I'm using JDeveloper 11g rel. 2.
    Regards,
    Sergio.

  • How to retrieve the all user name from system domain(including login user)?

    Hi, I am trying to get the system domain all users name. But I unable to get the all user name except domain login user name. I used the below code. What I want to do to get the all user name from system domain. Kindly any one help me.
    Properties envVars = new Properties();
    Runtime r = Runtime.getRuntime();
    String OS = System.getProperty("os.name").toLowerCase();
         if ((OS.indexOf("nt") > -1) || (OS.indexOf("windows 2000") > -1 ) || (OS.indexOf("windows xp") > -1) )
              p = r.exec( "cmd.exe /c set" );
         BufferedReader br = new BufferedReader ( new InputStreamReader( p.getInputStream() ) );
         String line;
         while( (line = br.readLine()) != null )
              int idx = line.indexOf( '=' );
              String key = line.substring( 0, idx );
              String value = line.substring( idx+1 );
              envVars.setProperty( key, value );
         String domainDNSName = envVars.getProperty("USERDNSDOMAIN");
         String userName = envVars.getProperty("USERNAME");
         System.out.println("\n\n\n DOMAIN NAME == "+domainDNSName +" USERNAME == "+userName);
    Thanks & Regards
    Palani

    Thanks kajbj,
    I don't know, How many users in domain. I neet to get all the user names from my domain. User like A, B,C,D, E,F. I need to get this users name.
    public class Env {
         public static void main(String[] args) {
              System.out.println("USERDOMAIN: " + System.getenv("USERDOMAIN"));
              System.out.println("USERNAME: " + System.getenv("USERNAME"));
    Here , I am getting the login user name only. So i needs all user name. How to retrive or get this.
    Regards
    Palani

  • How to retrieve the protocol (http / https) from WDJ application URL

    Hi All,
    In my WDJ component, I need to get the ServerName, Port and the protocol (http / https) from the WDJ application URL. I am able to get the server name and the port but unable to get the protocol. Any help would be highly appreciated.
    Code I am using is :
    String ServerName = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerName();
    String port = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerPort();
    Regards,
    Srinivas Sistu

    Hello,
    The interface ServletRequest has the following methods:
    getProtocol:  Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
    getSchema: Returns the name of the scheme used to make this request, for example, http, https, or ftp. Different schemes have different rules for constructing URLs, as noted in RFC 1738.
    IWDRequest request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
    HttpServletRequest httpRequest = (HttpServletRequest) WDProtocolAdapter
           .getProtocolAdapter().getRequestObject().getProtocolRequest();
    String protocol = httpRequest.getScheme();
    String url = protocol + "://" + request.getServerName() + ":" + request.getServerPort();
    msgManager.reportSuccess(url);
    Regards,
    Jann Cortés

  • Merging two or more unique strings

    Hi,
    Problem: I want to be able to merge two or more completely different strings into a single string. These strings can contains any letter or number; I don't want to merge the entire string all the time I want to be able to merge certain parts of it for example: String A contains: "Have A" String B contains: "Nice Day" String C contains: "#1" I want to be able to combine these strings in any form such as: "1 Have Nice A Day #".
    I did a quite a bit of searching on Lab view I have found "Merge Query Expressions" but I don't think it will do what I am looking for I am still trying to get an output with it but I am unable to get at currently. I don't expect anyone to give me a flat out answer but if you could point me in the right direction I would be grateful. Any example I will happily accept thank you.
    Message Edited by MrSafe on 08-11-2008 12:32 PM
    Message Edited by MrSafe on 08-11-2008 12:32 PM

    You still haven't explained the logic of what you want to do (meaning how the program will know how to combine the strings), but you can probably do everything you want with these functions:
    Shift registers
    Concatenate Strings
    String Subset
    Searching for them should provide more data.
    If you want to learn more about LabVIEW, I suggest you try looking at some of these tutorials.
    Try to take over the world!

  • How to return the same SUM value from two tables

    Hello,
    I have the following data:
    SQL> SELECT * FROM t1;
         T1_ID   T1_VALUE
             1        500
             1        500
    SQL> SELECT * FROM t2;
         T2_ID   T2_VALUE
             1       1000
    SQL> SELECT t1_id, SUM(t1_value), SUM(t2_value)
      2    FROM t1, t2
      3   WHERE t1_id = t2_id
      4   GROUP BY t1_id;
         T1_ID SUM(T1_VALUE) SUM(T2_VALUE)
             1          1000          2000How is it possible that SUM(T2_VALUE) returns also 1000.
    Thank you

    Here's one way:
    with t1 as (select 1 t1_id, 500 t1_value from dual union all
                select 1 t1_id, 500 t1_value from dual),
         t2 as (select 1 t2_id, 1000 t2_value from dual)
    select t3.t3_id, t3.t3_sum, t4.t4_sum
    from   (select t1_id t3_id, sum(t1_value) t3_sum from t1
            group by t1_id) t3,
           (select t2_id t4_id, sum(t2_value) t4_sum from t2
            group by t2_id) t4
    where  t3.t3_id = t4.t4_id

  • Can I swap the CS2 registration numbers from two computers?

    Is there a way to swap two CS2 registration numbers on two computers without reinstalling the whole lot? Thanks!
    Paul

    I'm not so sure it can't be done. I don't remember the way CS2 worked
    but once you deactivate you may be prompted to remove the serial number
    from the machine. Go ahead and do that for both and then reactivate
    entering the correct serial number on the opposite machines.
    Bob

  • Is it possible to work on the same files/catalog from two different computers?

    My wife and I are photographers and work on two separate iMacs.  We just purchased an NAS and would like to know if we can both access the same files AND the Lightroom catalog from our respective computers.  All of the files are on the NAS but I can't figure out how to get her computer to recognize the catalog.  Any help would be greatly appreciated!
    -Brent

    Another option, since you already have the nas, is to get something like "Synchronize! Pro X",and use the nas to transfer the catalog back and forth.  You don't have to USB the catalog, just transfer it to the nas each time you are done, and before you start...
    Of course, I think both solutions are based on you not editing at the same time... i.e., both of you are making changes, as neither approach will work for that!
    Cheers!

  • How we retrieve the sent mails , drafts from mail

    I have a problem with retrieving sent mails, drafts and all other from mail.
    I am succeded in retrieving mails from inbox. please give me code for that
    this my code for retrieving inbox from mail.
    <%@page import="java.util.*,java.io.*,javax.mail.*,javax.mail.internet.*,javax.mail.search.*,javax.activation.*"%>
         <TABLE align="center">
         <tr>
         <td>
    <%
    String host = "pop.gmail.com";
              HttpSession hs=request.getSession(true);
    final String user=(String)hs.getValue("usid");
    final String password=(String)hs.getValue("pwd");
         String subjectSubstringToSearch = "";     
    try {
                        Properties props=new Properties();
                   props.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    props.setProperty("mail.pop3.socketFactory.fallback", "false");
    props.setProperty("mail.pop3.port", "995");
    props.setProperty("mail.pop3.socketFactory.port", "995");
    Session session1 = Session.getInstance(props,new javax.mail.Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication(user,password);
    Store store = session1.getStore("pop3");
    store.connect(host, user, password);
    Folder fldr = store.getFolder("INBOX");
    fldr.open(Folder.READ_WRITE);
    int count = fldr.getMessageCount();
    out.println(count + " total messages");
                        %>
                        </td>
                        </tr>
                        </table>
                        <br>
                        <table border="1">
                        <%
    for(int i = 1; i <= count; i++) {
    Message m = fldr.getMessage(i);
                             %>
                        <tr>
                             <%
    Date date = m.getSentDate();
    Address [] from = m.getFrom();
    String subj = m.getSubject();
    String mimeType = m.getContentType();
                             %>
    <td size="35"><%out.print(date);%></td>
    <td size="35">     <%out.print(from[0]);%></td>
    <td size="35"><%out.print(subj);%></td>
    <%}%>
                        </tr>
                        <tr>
                        <td>
                        <%
    String pattern = subjectSubstringToSearch;
    SubjectTerm st = new SubjectTerm(pattern);
    Message [] found = fldr.search(st);
    out.println(found.length +
    " messages matched Subject pattern \"" +
    pattern + "\"");
    for (int i = 0; i < found.length; i++) {
    Message m = found;
    Date date = m.getSentDate();
    Address [] from = m.getFrom();
    String subj = m.getSubject();
    String mimeType = m.getContentType();
    out.println(date + "\t" + from[0] + "\t" +
    subj + "\t");
                             %>
                             </td>
                             <tr>
                             <td>
                             <%
                             out.println(mimeType);
    %>
                             </td>
                        <td>
                             <%
    Object o = m.getContent();
    if (o instanceof String) {
    out.println("**This is a String Message**");
    out.println((String)o);
    else if (o instanceof Multipart) {
    out.print("**This is a Multipart Message. ");
    Multipart mp = (Multipart)o;
    int count3 = mp.getCount();
                                  %>
                             </td>
                        <td>
                             <%
    out.println("It has " + count3 +" BodyParts in it**");
    for (int j = 0; j < count3; j++) {
    BodyPart b = mp.getBodyPart(j);
    String mimeType2 = b.getContentType();
                                       %>
                             </td>
                        <td>
                             <%
    out.println( "BodyPart " + (j + 1) +" is of MimeType " + mimeType);
    %>
                             </td>
                        <td>
                             <%
    Object o2 = b.getContent();
    if (o2 instanceof String) {
    out.println("**This is a String BodyPart**");
    out.println((String)o2);
    else if (o2 instanceof Multipart) {
                                            %>
                             </td>
                        <td>
                             <%
    out.print(
    "**This BodyPart is a nested Multipart. ");
    Multipart mp2 = (Multipart)o2;
    int count2 = mp2.getCount();
                                            %>
                             </td>
                        <td>
                             <%
    out.println("It has " + count2 +"further BodyParts in it**");
    else if (o2 instanceof InputStream) {
                                            %>
                             </td>
                        <td>
                             <%
    out.println("**This is an InputStream BodyPart**");
    else if (o instanceof InputStream) {
                                  %>
                             </td>
                        <td>
                             <%
    out.println("**This is an InputStream message**");
    InputStream is = (InputStream)o;
    int c;
    while ((c = is.read()) != -1) {
                                       %>
                             </td>
                        <td>
                             <%
    out.write(c);
    fldr.close(true);
    store.close();
    catch (MessagingException mex) {
    mex.printStackTrace();
    catch (IOException ioex) {
    ioex.printStackTrace();
    %>
    </td>
    </tr>
    </table>

    Ramesh,
    To paraphrase [url http://asktom.oracle.com]Tom Kyte, "holy unreadable code, Batman!"
    Code is much more readable if you put "[ code ]" and "[ /code ]" (without the spaces and quotes) around your code samples.
    Seems to me this would be a function of how the email server you are connecting to works - perhaps there is a folder called "Sent Items" or "Drafts" that you can use in this line (note the code tags ;) :
    Folder fldr = store.getFolder("INBOX");Not sure if this is possible via POP, but it is in IMAP. Hint: use google and search for:
    javax.mail "sent items"
    you'll get some helpful information. Nothing to do with JDeveloper here.
    John

Maybe you are looking for