How to Aggregate String Fields

Hi
I have a Query in which i Use Sum to aggregate fields , now i have some new fields on the table which are String, i want to add those to same existing queries where Sum is happening. and i want those string values to get aggregated as well like for rows
where sum is  happening  for same rows i want a concatenated value for string field
like i have  two rows
             Field 1 (int)  -- Field 2(string) 
Row 1:     1                    'abc'
Row 2:      2                    'xyz'
When I aplly Sum(Field1) it returns 3 and i want to get back 'abc,xyz' for Field 2  is there a function there SQL which i can use ?
or any work around in SQL

Hi,
This concatinates all the rows , i need only those rows concatinated which sumed up toagather basesd upon group by caluse, so if have a group by  clause on Field 3 then i would like to see result as  Two resultant rows
Row 1:  Field1 = 3 and Field2 = 'abc,xyz'
Row 2:  Field1 = 7 and Field2 = 'JGG,AA'
is there a way to do this
Field 1 (int)  -- Field 2(string)       Field3 
Row 1:     1                    'abc'        1
Row 2:      2                    'xyz'        1
Row 3:      3                    'JGG'        2
Row 4:      4                    'AA'        3

Similar Messages

  • Purpose of using string field

    how to use string field and its purpose...

    STRING: Character string with variable length This data type can be used only in types (data elements, structures, table types) and domains. In the dictionary a length can be specified for this type (at least 256 characters). It can be used in database tables only with restrictions. For a description of them, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. The system proposes 132 characters as default for the output length. You cannot attach search helps to components of this type.
    SSTRING: Short character string with variable length. In the Dictionary the number of characters can be specified for this type (from 1 to 1333). This data type can be used only in types (data elements, structures, table types) and domains. It can be used in database tables. To do so, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. String fields of this type can be used in indexes and in the WHERE condition of a SELECT statement. You cannot use them in table keys

  • How to set a string field with people picker control group

    Hi Guys
    I have a problem with a form list, when I need to set a string field with de content of people picker control that have more than one "user".
    Is there any way to put in string a list of user like the people picker control shows in a form?
    The really problem is I don't know how to read an array of user in a formula rule.
    any example or idea should be appreciated.
    tnks.

    Hi ,
    Please try out in following way :
            /// <summary>
            /// Set value to people picket control
            /// </summary>
            /// <param name="key"></param>
            /// <param name="ppl"></param>
            /// <param name="item"></param>
            private void SetDatatoPeopleEditor(string key, PeopleEditor ppl, SPListItem item)
                try
                    if (item[key] != null)
                        string users = string.Empty;
                        SPFieldUserValueCollection userCol = new SPFieldUserValueCollection(web, item[item.Fields.GetField(key).Id].ToString());
                        foreach (SPFieldUserValue usrItm in userCol)
                            users += usrItm.User.ToString() + ",";
                        ppl.CommaSeparatedAccounts = users.Remove(users.LastIndexOf(","), 1);
                catch (Exception ex)
                    lblErrorMessage.Text = ex.Message;
    private SPUser GetAccountName(PeopleEditor accountPE)
                SPUser user = null;
                string strAccountName = String.Empty;
                try
                    for (int i = 0; i < accountPE.ResolvedEntities.Count; i++)
                        PickerEntity objEntity = (PickerEntity)accountPE.ResolvedEntities[i];
                        user = web.AllUsers[objEntity.Key];
                    return user;
                catch (Exception ex)
                return user;
    It works for me .

  • How i hide a field of a custom view in OAF 11

    Hi, im a new developer of OAF11.
    What should I do, to customize the Purchase Order screen, if then the requirement is to hide the field that i insert from extended VO.
    What I did was modify the XML of the page to add the field and then extended the original AM.
    I added the extended view into the custom AM to prevent that fail with the field that i insert.
    I must clarify that I modify the path of AM default for the path of the custom AM in the XML, then i upload the XML with the command import, and i see it the field in the page.
    I tried to hide another field that i created by customizing the page, but I couldnt do. That´s why i insert directly the field in the XML original.
    I Try to customize the driver involved with the page, but nothing happened.
    First try it on the controller Father and after the son.
    The page is in the POS module (iSupplier), and is POSVIEWPOG (PO Details).
    The code that attempts to hide the field is:
    OAApplicationModule am = paramOAPageContext.getApplicationModule(paramOAWebBean);
    OAViewObject oaviewobject1 =(OAViewObject)am.findViewObject("PosViewHeadersVO");
    if (oaviewobject1 != null)
    OARow row = (OARow)oaviewobject1.getCurrentRow();
    String vCustomType = (String)row.getAttribute("TypeName");
    if (vCustomType.equals("Blanket Agreement"))
    OAMessageStyledTextBean vHideField = (OAMessageStyledTextBean)paramOAWebBean.findChildRecursive("drbQuantity");
    vHideField.setRendered(true);
    else
    OAMessageStyledTextBean vHideField = (OAMessageStyledTextBean)paramOAWebBean.findChildRecursive("drbQuantity");
    vHideField.setRendered(true);
    Can anyone help me?
    If im grong other solution that i think is:
    How I can put a field on a page with code and how to hide the field with conditions?, consider that the field is from the VO extended.
    Thanks!!!

    Hi Yichao,
    Chk these links
    https://help.sap.com/saphelp_nw04/helpdata/en/5a/0c889a4d5911d2a5fb0000e82deaaa/content.htm
    http://help.sap.com/saphelp_45b/helpdata/en/cf/21ec5d446011d189700000e8322d00/frameset.htm
    thanks and regards
    srikanth.p

  • Add a carriage return in a Unbound String Field

    Post Author: Razzle00
    CA Forum: Formula
    Hi,
         How can I add a carriage return to an unbound string field in a crystal report.  I am using the bundled version of CR with MS Visual Studio 2003 & 2005.  My formula needs to look something like this....
    'Heading One:' + CARRIAGE RETURN + trim({tablename.fld_1}) + CARRIAGE RETURN + 'Heading Two:' + CARRIAGE RETURN  + trim({tablename.fld_2})
    this code all needs to be in 1 unbound string field.  Is this possible?
    Thanks,
    Razzle

    Post Author: SKodidine
    CA Forum: Formula
    To add a carriage return, add CHRW(13)
    For example:
    'Heading One:' & chrw(13) & 'sample text';
    will result in:
    Heading One:
    sample text

  • How to determine the field size

    I am going to make a multiplatform application that hopefully
    will run on linux and windows 2000.If the os is 2000, then I will use
    vb.net/aspx else I'll use java servlets. I make the connection
    to the web server ( through HTTP) not directly to database server.
    So, the resultset will be stored in the String object. The columns
    will be separated by delimeter. Our problem is how to determine
    the size and type of the fields of mssql,oracle and postgres database
    so that we can include it in the String object.
    Ex.
    String sResultSet=new String();
    ResultSet rs=statement.executeQuery(sSQL);
    while(rs.next()){
    sResultset=sResultSet + rs.getString(field1) + "||" + rs.getString(field2) + "||";
    vertical bars acts as delimeter
    supposedly this is the code:
    sResultset=sResultSet + rs.getString(field1) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||" + rs.getString(field2) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||";
    supposedly this is the code if rs.getFieldType() and rs.getFieldSize() methods are existing
    Anyone can give me an idea how to get the field type and field size of the database?
    thanks in advance

    Yes, but I dont know how to do it.
    Can you give me an example of using it.
    Thanks in advance

  • A record selection problem with a string field when UNICODE database

    We used report files made by Crystal Reports 9 which access string fields
    (char / varchar2 type) of NON-UNICODE database tables.
    Now, our new product needs to deal with UNICODE database, therefore,
    we created another database schema changing table definition as below.
    (The table name and column name are not changed.)
        char type -> nchar type
        varchar2 type -> nvarchar2 type
    When we tried to access the above table, and output a report,
    the SQL statement created from the report seemed to be wrong.
    We confirmed the SQL statement using Oracle trace function.
        SELECT (abbr.) WHERE "XXXVIEW"."YYY"='123'.
    We think the above '123' should be N'123' because UNICODE string
    is stored in nchar / nvarchar2 type field.
    Question:
    How can we obtain the correct SQL statement in this case?
    Is there any option setting?
    FYI:
    The environment are as follows.
        Oracle version: 11.2.0
        ODBC version: 11.2.0.1
        National character set: AL16UTF16

    With further investigating, we found patterns that worked well.
    Worked well patters:
        Oracle version: 11.2.0
        ODBC version: 11.2.0.1
        National character set: AL16UTF16
        Report file made by Crystal Reports 2011
        Crystal Reports XI
    Not worked patters:
        Oracle version: 11.2.0 (same above)
        ODBC version: 11.2.0.1 (same above)
        National character set: AL16UTF16 (same above)
        Report file made by Crystal Reports 2011 (same above)
        Crystal Reports 2008 / 2011
    We think this phenomenon is degraded behavior of Crystal Reports 2008 / 2011.
    But we have to use the not worked patters.
    Anything wrong with us? Pls help.
    -Nobuhiko

  • How to add a field to the selection screen and when the user enters ...

    hi all,
    can any one plesase send the code of how to add a field to seletiion screen and when the user enters in the field , it should be store in the database table , the table is MKPF and the field is BKTXT.  Thanks.

    Hi Kripa,
       If u r using PNP ldb then the screen u will get is the screen for that ldb and if u want to add some more fields then u define using selection-screen..as follows
    SELECTION-SCREEN BEGIN OF BLOCK mysel WITH FRAME TITLE text-111.
    PARAMETERS: n_in_en  RADIOBUTTON GROUP g1,
                q_ev  RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK mysel.
    SELECTION-SCREEN BEGIN OF BLOCK mysel1 WITH FRAME TITLE text-222.
    PARAMETERS: r_date TYPE sy-datum DEFAULT sy-datum.
    SELECTION-SCREEN END OF BLOCK mysel1.
    SELECTION-SCREEN BEGIN OF BLOCK mysel2 WITH FRAME TITLE text-333.
    PARAMETERS:f_ver(3) TYPE c DEFAULT 1,
               c_no(10) TYPE c DEFAULT '9D0161',
               u_id(15) TYPE c,
               password(15) TYPE c,
               r_email(30) TYPE c DEFAULT PARAMETERS: s_not TYPE c AS CHECKBOX.
    PARAMETERS:t_run TYPE c  AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK mysel2.
    SELECTION-SCREEN BEGIN OF BLOCK mysel3 WITH FRAME TITLE text-444.
    SELECTION-SCREEN BEGIN OF BLOCK mysel4 WITH FRAME TITLE text-555.
    PARAMETERS: p_ser  RADIOBUTTON GROUP g2,
    a_ser  RADIOBUTTON GROUP g2.
    SELECTION-SCREEN END OF BLOCK mysel4.
    SELECTION-SCREEN BEGIN OF BLOCK mysel5 WITH FRAME TITLE text-666.
    PARAMETERS:p_path TYPE string.
    SELECTION-SCREEN END OF BLOCK mysel5.
    SELECTION-SCREEN END OF BLOCK mysel3.
    u will get this additional screen after the screen of ldb.
    I hope this will help u..
    Thanks & Regards
    Ashu Singh.

  • How to set Character field's Format Mask?

    dear all,
    how to set Character field's Format Mask?
    i searched the forum and found the following, where can i use this code and how to change and set its format mask.
    SRW.SET_FORMAT_MASK('mask');
    Thanks
    Muhammad Nadeem

    Nadeem,
    If you have database 10g, look into function REGEXP_REPLACE. Otherwise you can also try this (you might already know).
    SELECT SUBSTR('CHHOCMIPO07020001', 1,2)||'-'||SUBSTR('CHHOCMIPO07020001' ,3,2)||'-'||
    SUBSTR('CHHOCMIPO07020001' , 5,2)||'-'||SUBSTR('CHHOCMIPO07020001' , 7,3)||'-'||
    SUBSTR('CHHOCMIPO07020001' , 10,2)||'-'||SUBSTR('CHHOCMIPO07020001' , 12,2)||'-'||
    SUBSTR('CHHOCMIPO07020001' , 14,4)
    FROM dual
    CH-HO-CM-IPO-07-02-0001
    If you have to use this at many places, create a function, pass the raw value, manipulate the string and return.
    FS

  • String Field rendering as Number Field in CR Basic for VS2008

    I recently migrated from CR for VS2005 to CR Basic for VS2008 and am creating my first report using CR 2008. The SQL result set returns rows containing strings (nvarchar), integers and decimal (7,2) fields.
    The report is getting all rows in the result set, but the string fields as defined in the SQL are 1) rendering in the report as numbers, and 2) showing as empty. The non-string fields render fine. I tried reformatting the report field to string, but only the Number tab appears in the formatting dialog. I also tried converting the SQL field result into an unbound string field, as well as tried the ToText function, but the results were the same. I suspect the field appears empty because of the formatting issue.
    How can I get CR Basic for VS2008 to render a string (nvarchar) field as a string?

    Try placing the field inside a formula field or inside a text field.  That should cause the field to be shown no matter what type of data it is.  If the data is still not showing, then perhaps it is not being returned properly. 
    Things to check:
    -Are you connecting directly to the tables - or are you connecting to a stored procedure?  If you are connecting to a stored procedure and you are using Temp Tables, then make sure you add the line "SETNOCOUNT ON" to your stored proc.
    -Run SQL profiler - see what query is being made, then try running that exact same query through the SQL admin console (Or some other utility that lets you run SQL queries)
    Thanks
    Shawn

  • Idoc to String field

    Hello everybody,
    I want to map the content of an Idoc to one String field, but I don't know how to do this. Can anybody help me?
    Best regards
    Martin

    Hello everybody,
    thanks for your advices, but I have a general problem. My Mapping is IDOC to StringField. But when I start testing the Message Mapping by loading an IDOC as XML-File, I have no values when I display the Queue. I did the mapping as mentioned in the Blog.
    What is my error?
    Thanks and best regards,
    Martin

  • HOW CAN I SEND FIELD SYMBOL TO SUBROUTINE

    HAI,
             HOW CAN I SEND FIELD SYMBOL TO SUBROUTINE
             HOW CAN I COME BACK FROM 5TH INTERACTIVE REROT TO 2ND
    INTERACTIVE REPORT.
    THANK YOU.
    ASHOK

    Hi
    Write some code in the program to come to 2nd list from 5th list
    if sy-lsind = 5.
       sy-lsind = 2.
    endif.
    for field symbols see the doc
    Field Symbols
    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
    Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
    All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
    Field symbols provide greater flexibility when you address data objects:
    If you want to process sections of fields, you can specify the offset and length of the field dynamically.
    You can assign one field symbol to another, which allows you to address parts of fields.
    Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    You can also force a field symbol to take different technical attributes from those of the field assigned to it.
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    check the below links u will get the answers for your questions
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
    Syntax Diagram
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Extras:
    1. ... TYPE type
    2. ... TYPE REF TO cif
    3. ... TYPE REF TO DATA
    4. ... TYPE LINE OF type
    5. ... LIKE s
    6. ... LIKE LINE OF s
    7. ... TYPE tabkind
    8. ... STRUCTURE s DEFAULT wa
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
    Effect
    This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
    You can only use one of the additions.
    Example
    Output aircraft type from the table SFLIGHT using a field symbol:
    FIELD-SYMBOLS <PT> TYPE ANY.
    DATA SFLIGHT_WA TYPE SFLIGHT.
    ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... TYPE type
    Addition 2
    ... TYPE REF TO cif
    Addition 3
    ... TYPE REF TO DATA
    Addition 4
    ... TYPE LINE OF type
    Addition 5
    ... LIKE s
    Addition 6
    ... LIKE LINE OF s
    Addition 7
    ... TYPE tabkind
    Effect
    You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
    This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
    The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
    Example
    Address components of the flight bookings table SBOOK using a field symbol:
    DATA SBOOK_WA LIKE SBOOK.
    FIELD-SYMBOLS <SB> STRUCTURE SBOOK
    DEFAULT SBOOK_WA.
    WRITE: <SB>-BOOKID, <SB>-FLDATE.
    Related
    ASSIGN, DATA
    Additional help
    Declaring Field Symbols
    Reward points if useful
    Regards
    Anji

  • Remove leading numbers in string field

    I have a string field "01-Submitted" and wold like to remove the "01-".  How can this be done?

    Hi Create a formula:
    split(field,"-")[2];
    place this in the detail and see if prints the values.
    Regards,
    Vinay

  • Random Characters insterted into Crystal Reports string fields

    I'm having a problem where random characters are being inserted into string fields in my crystal reports, I talked to a representative and they are unable to fix the problem, so I'm asking here if someone has a workaround.  The characters are always outside of the normal set of characters, so I'd like to know if there is a way to only allow certain characters in a given field using formulas.  (for example, at a very simple level, i would input a list of "legal characters" and the field in crystal wouldn't display anything but those characters)
    thanks for your time and help

    Sorry, i think I've been a bit imprecise so far
    So these characters ONLY appear when printing the report and not when previewing the report in Crystal Reports?
    They appear when previewing, when actually printing, everything after the characters is cut off
    Are you printing directly from CR or from Enterprise/Infoview or another custom application?
    From CR (both to PDF and paper)
    When did you update your print driver last?
    Not sure, although this may be moot since it also shows up in the preview?
    Have you printed on another printer and does it too exhibit the same behavior?
    Same as above?
    Was the report created by you in CRXI? Are your regional settings set to English (language)?
    Yes I created the report in CRXI, and in terms of the regional settings, I'm not sure but would assume so, how do I check/change this?

  • String Fields Length

    Hi,
    Length of string fields in my crystal report are locked to 20 by default, but my data source's query's field length is 50.  How can I fix the crystal report to show all 50 characters in the report?
    Thanks and regards,
    Al

    Hi Hitesh and Crystalier,
    Thanks for your replies.
    I check marked "Can Grow" option and it didn't work.
    Database is SQL Server 2005 and my connection is OLE DB (ADO).  The database field is VARCHAR(50).
    I noticed, under the Field Explorer -->  Database Fields, the type of the field is showing as "String [20]".  But the field in the datasource (SQL Server 2005) is Varchar(50).  Also, when I right-clicked Browse Data on the field on Field Explorer, the data that was returned are all trimmed to 20 characters.
    Thanks and regards,
    Al

Maybe you are looking for

  • Why do I need Library at root level AND a library in the admin user folder?

    I have three user accounts in my macbook, I share it with two brothers. I'm the "administrator". Under my user account there is a library folder, same as with the other two users. But I also have a library folder at the root level when I open the "Ma

  • Is There A Simple Text Editor/Composter & Line Art Plug-In Available

    Yes, I know it has been addressed in other posts in the past but I wanted to know if any new tools are available since the update to 3.XX, outside of open a picture in a "Book" project and adding text in a border or downloading BorderFX, neither of w

  • J1IIN reversal accounting document not reflected in SD document flow

    Dear Experts, I have created a billing document and then posted excise through J1IIN. When I reverse the Billing through VF11 there are two accounting documents generated(one for billing and other for Excise reversal). But the Excise reversal account

  • How to move the UIs in layout?

    Hi everyone, In NetWeaver Developer Studio I have the Views which under a Web dynpro. I want to move the UIs in the screen on right clicking the view  and choosing 'edit'. But nothing happened. I can't do anything in the 'layout' . So could anyone te

  • Keyboard and a mouse for the ipad

    hi,i do know that there is a keyboard for the ipad that works by bluetooth, but i want to know if there is also a mouse for the ipad (by bluetooth or usb) and how could i get one and configurate it.