Concat function or equivalent for CDS view?

Trying to create a CDS view and looking to combine multiple character fields (e.g. first_name + last_name) and am wondering if this is possible? Am on CRM NW 7.4 SP5 on HANA.
Using the arithmetic function gives me the following.
Data type CHAR is currently not supported in an arithmetic expression
Looking at the official documentation here, it doesn't appear to be included?
ABAP Keyword Documentation
I can always create a AMDP or even a HANA native view, just wondering if anyone has come across the same issue and found a solution within CDS view?
Thanks in advance,
Sean.

Hi Sean,
there's no concatenate function as of 7.4 SP5.
A workaround in OpenSQL (if that's the combination you use), you could use the columns of your choice in the projection list like (I use literals in the example for simplicity):
'a' as a,
'b' as b
and concatenate later by means of OpenSQL:
select a && b from <cds_view> into ….
However, if you want to use the view in an ALV this does not help you, I know…
Cheers,
  Jasmin

Similar Messages

  • Exists in CDS view

    Hi
    I wonder if the Exists condition can be used in the CDS view (WHERE EXISTS (SELECT *  FROM .... ) .
    I actually never managed to used subqueries in any cds view so I wonder if this is a limitation for CDS view or if I just do not get the syntax right.
    Thanks for any feedback and examples!
    Christelle

    Hi, subqueries are not yet supported. In the CDS-editor you may press F1 and browse the documentation to find out what features are supported. You will not find an EXISTS there.

  • Screen Structure for Extended View" in "Overview of Notification Type"

    Dear Members,
    When I am using the function "Screen Structure for Extended View" in "Overview of Notification Type" in SPRO, I am not able to make any changes to "Tab Page Allocation" and areas under "Screen Area"  What should i do to overcome this.
    Thanks & Regards

    Hi,
    The  "Tab Page Allocation" setting determines how many sub-screens can be added to the tab. It is therefore not possible to change this field for some tabs which are designed to be single screen only. Example - 10\TAB10 (items), 10\TAB11 (tasks).
    Should be changeable on tabs that allow multiple subscreens. Exampel - 10\TAB02 (Additional data).
    -Paul

  • Using HANA SQL Functions in select list of CDS Views

    Dear Expert,
    Kindly please let me know if we can use the HANA SQL Function (Ex: ADD_DAYS, SECONDS_BETWEEN) in the select list of CDS Views?
    If I create a CDS like below I get error that timestamp is not supported.
    For Example:
    @AbapCatalog.sqlViewName: 'ZMR_H_CA'
    @EndUserText.label: 'CAG A'
    define view viewname
    with parameters start_ts:abap.dec( 15, 0 ) , end_ts:abap.dec( 15, 0 )
    as select from table {
    key resource_key,
    TO_TIMESTAMP(begtstmp) as start_tmp,
    TO_TIMESTAMP(begtstmp) as end_tmp
    where
    (begtstmp > $parameters.start_ts or endtstmp > $parameters.start_ts )
    and
    (begtstmp < $parameters.end_ts or endtstmp < $parameters.end_ts )
    Thanks,
    Giri

    Hi Giri,
    the list of provided features can be found in the ABAP Language Documentation (F1 in the CDS View).
    As CDS in ABAP is abstracted from the database layer, the database features are not directly accessible. That means, you cannot use any HANA or MaxDB feature available. So the answer to your question is no. The reason for this is, that ABAP CDS views can be created on all SAP-supported databases, hence, we can only provide those features, supported by all databases.
    Having said this, there are some exception, e.g. the CDS views with input parameters, which are not supported by all databases. In these cases, you'd have to additionally use the utility class CL_ABAP_DBFEATURES (see http://scn.sap.com/community/abap/blog/2014/10/10/abap-news-for-740-sp08--abap-core-data-services-cds) for more details.
    Best,
      Jasmin

  • Not able to use CONCAT in CDS View

    Hello,
    My requirement is to prepare a field by concatenating 'PR' in front of the field and use it in a CDS view.
    I am getting the below error while doing it.
    Is the issue with my HANA version or the code is wrong.

    Dear Abhishek,
    which Version of the ABAP stack do you have?
    The CDS function concat is only supported starting with Netweaver 740 SP08.
    Best Regards, Thomas

  • PL/SQL equivalent for networkdays function

    Hi,
    Is anyone aware of a PL/SQL equivalent for the Excel "networkdays" function, that returns the number of whole workdays between 2 dates?
    Thanks!
    Phil

    To calculate the number of days between january 1st and today, use the following.
    1* select trunc(sysdate) - trunc(to_date('01-jan-05')) from dual
    SQL> /
    TRUNC(SYSDATE)-TRUNC(TO_DATE('01-JAN-05'))
    58

  • Does pages have an equivalent for Word's option of viewing a document in "online layout"?

    Does pages have an equivalent for Word's option of viewing a document in "online layout"?

    With online layout you can have the page of your document fill up as much of the screen as you want while being able to zoom the viewing of your text or words to any percentage you want. In pages, I can zoom or stretch the document to fit the full width of the screen, but the view the actual text or words themselves correspondingly enlarges as well.

  • Material creation for All VIEW using BAPI Function modules

    Dear All,
                 I want to create materials for all views using BAPI F.Ms. By using BAPI_MATERIAL_SAVEDATA i have extended materials for for only specified views. now my requirement is to create Material with All views including Classfication view also. For this i found BAPI_OBJCL_CREATEFM.
             Tell me that shall i use both Fm's at time to create material.Will it work? According to my knowledge we need to create Characters first ,then we should  assign this character to this class, then while creation of material we should select this class .
            so pls guide me the procedure to follow for both FM's .
    Note : Pls don't suggest me LSMW OR BDC procedure.
    regards,
    Prashanth Maturu.

    Hi prashanth,
    U can use both the FM. using BAPI_MATERIAL_SAVEDATA u can create all the views and for classification view use BAPI_OBJCL_CREATE. before assigning class to material u hve to make sure that the characteristics are uploaded and is attched to the class using transaction CL03.
    Regards,
    Anil N.

  • ORA-01732: what functions are allowed for view creation?

    Hi,
    i try to create a view, where i can delete rows. Here my view
    CREATE OR REPLACE VIEW myview as select * from (select * from orders order by starttime) where rownum < 4
    If i try to delete a row i get:
    SQL Error: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
    (translation: data manipulation for this view not allowed)
    Breaks the rownum the view? I tested it with rank() over and this breaks it too...

    sql>
    CREATE OR REPLACE VIEW myview
    as
    select * from (select * from emp order by hiredate) where rownum<4;
    View created
    sql>
    create or replace trigger trig1
    instead of delete
    on myview
    for each row
    begin
    delete from emp
    where empno = :old.empno;
    end;
    Trigger created.
    sql>select * from myview;
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7499  ALLEN  SALESMAN  7698  20-FEB-81  1600  300  30 
    7521  WARD  SALESMAN  7698  22-FEB-81  1250  500  30 
    7566  JONES  MANAGER  7839  02-APR-81  2975     20 
    sql>
    delete from myview
    where rownum=1;
    1 row deleted.
    sql>select * from myview;
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 
    7521  WARD  SALESMAN  7698  22-FEB-81  1250  500  30 
    7566  JONES  MANAGER  7839  02-APR-81  2975     20 
    7698  BLAKE  MANAGER  7839  01-MAY-81  2850     30
    Message was edited by:
            jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Questions on CDS Views with input parameters

    Dear Experts,
    1. Can we call a CDS View (or generated database view) with input parameters inside an AMDP? I am looking for something similar to the feature in HANA where we can consume calculation view with filters inside SQL Script?
    2. I understand we can next CDS Views, but how we can next (call) a CDS View with input parameters inside another CDS View?
    Thanks,
    Giri

    Hi Thomas,
    I get the below error that the CDS View's generated table function cannot take field from AMDP.
    I have a requirement to query the CDS View using 2 timestamps (start & end). So, in AMDP I have used the TIME_STAMP and try to pass it to the CDS View
    View code:
    define view Z_Ngi_Cag_A
    with parameters start_ts:abap.dec( 15, 0 ) , end_ts:abap.dec( 15, 0 )
    as select from table {
    resource_key
    where
    (begtstmp > $parameters.start_ts or endtstmp > $parameters.start_ts )
    and
    (begtstmp < $parameters.end_ts or endtstmp < $parameters.end_ts )
    I am calling using the below AMDP:
    DECLARE iv_start_date TIMESTAMP;
    DECLARE iv_end_date TIMESTAMP;
    SELECT CURRENT_TIMESTAMP INTO iv_start_date from dummy;
    SELECT ADD_DAYS(CURRENT_TIMESTAMP, 30) INTO iv_end_date from dummy;
    et_data =      SELECT * FROM ZMR_H_CA ( start_ts => iv_start_date, end_ts =>  iv_end_date );
    What could be wrong ? Is this not supported?
    Thanks,
    Giri

  • Equivalent of Materialized Views in SQL Server

    Hi
    we are migrating  Oracle Database to SQL Server 2012 and is looking for solution, equivalent to Materialized Views in Oracle.
    we had tried to implement indexed View, but that was not possible, because the MVs have outer joins, subqueries, aggregate functions and also there is no column in it which can act as a Primary Key.
    Please Help to get a solution for this issue.
    Regards
    Joyasree Mondal

    >use tempdb
    >drop table t
    >go
    >create table t(id int, constraint pk_t primary key (id))
    >
    >go
    >insert into t(id)
    >select top 1000 cast( cast( newid() as binary(4) ) as int)
    >from sys.objects o, sys.columns c
    >go 100
    >
    >
    >select id
    >from t with (index=pk_t, tablockx)
    >
    >
    >select id
    >from t with (index=pk_t, nolock)
    Still the same order.
    >> No, its always in the key order like I've shown here.
    > You are extrapolating from a single example.
    Actually, this information doesn't even come from my exampleS (there were quite a few so far). Its written in the article you posted here. My examples are meant to confirm that and explain why the ORDER BY clause is redundant in some cases.
    > I have.  ORDER BY in a view used to always return ordered results.  Then it didn't.
    Examples? References?
    >GROUP BY without an ORDER BY used to always return ordered results.  Then it didn't.  Many queries have >change the result ordering when you get a parallel plan.
    Now you finally admit ordered results would always be returned, even without an order by clause. We are in the right track it appears. The reason for this change of behavior is a variation in the logical operator used by the query optimizer, and not the
    way the engine reads pages from disk.
    In the beginning of times there was stream aggregate, an operator that would require its input to be sorted. And this is how a GROUP BY clause would ensure results were always ordered.
    But then his ugly cousin came and messed things up. He doesnt need an ordered input so yeah, order would be random. AGAIN, there are still ways of enforcing order here, through query hints, without requiring an order by clause, so this changes nothing.
    You have confirmed that for a given operator, results will always be ordered. Your own argument has, once again, proven my point.
    > Right.  But there are different _kinds_ of scans.  An ordered scan, where SQL Server reads rows based on the logical order of the index is just one kind. 
    It only won't scan in key order (by scheduling reads) if you change the transaction isolation level and hope for the worse. Because the key order scan is the best performing way of reading pages, this behavior (although possible) wasan't even observed in
    the example with NOLOCK/TABLOCK (known to cause allocation-order scans in larger tables) you posted above.
    > Other kinds include the parallel scan, the reverse scan,
    References?
    > the merry-go-round scan,
    Only applies to table scans, not indexes.
    http://technet.microsoft.com/en-us/library/ms191475%28v=SQL.105%29.aspx
    > And the allocation-order (or unordered) scan. 
    Only if you specify TABLOCK or NOLOCK query hints, which I haven't done. This is something that goes without saying, it's irrelevant to an indexed view scenario such as this one.
    Some people have also said it will perform an allocation-order scan if the index is too fragmented in SQL Server 2005, but as of 2012 it (probably) won't, as I have shown here. There is also no document anywhere in the internet (you are free to search for
    it), that would point us otherwise. If you have access to additional information, I would be more than happy if you could share it with us.
    Reference: http://sqlmag.com/database-development/quaere-verum-clustered-index-scans-part-iii
    > And don't take my word for it.  Take Conor Cunningham's:
    >If you need order in your query results, put in an ORDER BY.  It's that simple.  Anything else is like >riding in a car without a seatbelt.
    >No Seatbelt - Expecting Order without ORDER BY
    Again, with all due respect, did you read your own article? Did you read what I said earlier about having multiple I/O threads as a whole other situation? If you add new variables, OF COURSE the results will be different. Parallelism was disabled in the
    server I performed these tests on, but still you can control this by query hints, and you can enforce execution plans by using plan gudes.
    Its like I always say - it's always about the 0.001% of situations, the exceptions, rather than the general rule.
    Tell Mr Connor to add MAXDOP 1 to his querys OPTION clause and see if results are still unordered lol
    References:
    http://msdn.microsoft.com/en-us/library/ms190417.aspx
    http://msdn.microsoft.com/en-us/library/ms181714.aspx
    http://technet.microsoft.com/en-us/library/ms188611%28v=sql.105%29.aspx
    http://blogs.msdn.com/b/conor_cunningham_msft/archive/2008/08/27/no-seatbelt-expecting-order-without-order-by.aspx
    Imagining uncontrollable factors that would get an ordered input to be retrieved in an unordered manner is one of SQL Server's myths. There are a whole other people around who think the same way because of some experiences they had when they didn't know
    how to control the execution plan, and adding an order by clause is a very popular and easy shortcut to a complex problem. "In the worst cases it will just be redundant", they say. What they like to forget is that sorting has an often high cost,
    and it can be avoided by taking advantage of indexes.

  • Is there a logic:match equivalent for JSTL?

    In a search page I execute a query which returns an array of objects (All objects are of the same object type and are cast to Object[]) and each object has many attributes. I tried using <logic:iterate>, but I was never successful in having it display any results. I believe this had something to do with the entire array being passed via session scope instead of just one record and me not specifying it properly with <logic:iterate>. I was able to successfully use <c:forEach> and it worked right away. I stuck with using that because of its "just works" ability in addition to using a lot of other JSTL code. However, one of the attributes that is being printed out needs to be parsed and is of the form "Yxxx". <logic:match> covers this very nicely, but when I specify it in the below code it is not able to find my variable in any scope.
    <c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
        <logic:match parameter='${myResults}' property='pin' value='Y'>
            <c:out value="Preeti"/>
        </logic:match>
    </c:forEach>I have done several google searches, but I haven't found a JSTL equivalent for <logic:match>. If there is one could someone please tell me what it is? In addition, although <logic:match> is great I still need to print out a substring of that attribute. Could someone tell me how to do that? If this is not possible could someone please tell me if its possible to use <logic:iterate> with an array of objects like I was attempting to do initially so that I could use <logic:match> at least?
    Thanks to all of you for your time.

    Yes you can use the logic:iterate tag. I think you have to specify the type of the exposed variable though. I prefer the forEach loop.
    I think you are using the wrong attribute in the logic:match tag. You should be using the "name" attribute rather than "parameter"
    Parameter attribute refers you to a request parameter, and I pretty sure you don't want that.
    So given the collection of objects in the session attribute "result"
    This should loop through them all, and see if they start with the letter 'Y'
    <c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
        <logic:match name='myResults' property='pin' value='Y'>
            <c:out value="Preeti"/>
        </logic:match>
    </c:forEach>As for the latter bit, are you using a JSP2 container and JSTL1.1? It would appear so seeing as you are trying to use EL expressions in the logic:match tag.
    If so, you could make use of the JSTL function library:
    <c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
       <c:if test='${fn:startsWith(myResults.pin, "Y")}'>
          <c:out value="${fn:substring(myResults.pin, 1, -1)}"/>
        </c:if>
    </c:forEach>And I've just spotted a very cool function in there: substringAfter
    <c:forEach var="myResults" items="${sessionScope.result}" varStatus="status">
          <c:out value='${fn:substringAfter(myResults.pin, 'Y')}'/>
    </c:forEach>Cheers,
    evnafets

  • How to use Special Characters in CONCAT function or another form with Xquer

    Hello everyone
    I'm using PS3 OEPE within message flow (proxy)and I'm using Xquery.
    I'm using the CONCAT function, but this does not allow me to concatenate special characters not allowed, for example:
    I want to concatenate these strings:
    String1 = “&amp;lt;get-person&amp;gt;&amp;lt;id-person&amp;;gt;”
    String2 = “123”
    String3 = “&amp;lt;/id-person&amp;;gt; &amp;lt;/get-person&amp;gt;”
    I want to represent characters regex. It means no XML characters
    Someone knows some way, any function that allows me to concatenate in OSB these values with Xquery?
    Edited by: chromosoma on Sep 5, 2012 5:59 PM

    Hi,
    It seems to me you're doing things in the most complicated way possible...
    Firstly, you should use codepoints-to-string not the reverse... Secondly, the function work with decimals, not hexa
    http://www.xqueryfunctions.com/xq/fn_codepoints-to-string.html
    http://www.xqueryfunctions.com/xq/fn_string-to-codepoints.html
    This works...
    concat(codepoints-to-string(38),'lt',codepoints-to-string(59),'get-person')But this also works... Note that I've inserted a space between the &amp; and the lt so the forum formatting can show it...
    let
    $String1 := "& lt;get-person& gt;& lt;id-person& gt;",
    $String2 := "123",
    $String3 := "& lt;/id-person& gt;& lt;/get-person& gt;"
    return
         concat($String1,$String2,$String3)And, finally this also works... So what's the reason for escaping &lt; and &gt; with &amp;lt and &amp;gt; and why codepoints?
    let
    $String1 := "<get-person><id-person>",
    $String2 := "123",
    $String3 := "</id-person></get-person>"
    return
         concat($String1,$String2,$String3)Cheers,
    Vlad

  • SQL Concat function seem not to work properly in SQL query data model. BIP 11g

    I try to use this function to show entire name CONCAT(name, ' ', surname) and it doesnt show the surname. it looks like it only tooks 2 arguments. I use it with the option "Add element by expression" within a SQL Query - Data set.
    Lucia

    i don't believe you
    please post more info, may be screen or sql or some more useful statement
    CONCAT(name, ' ', surname) and it doesnt show the surname
    may be because for some case "surname" is empty  or may be you incorrect use concat function
    one way mentioned by BluShadow is " || " operator  - http://docs.oracle.com/cd/B28359_01/server.111/b28286/operators003.htm#SQLRF51156
    and another is concat function http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions026.htm#SQLRF00619
    so for your case it can be like
    CONCAT(CONCAT(name, ' '), surname)

  • When we will go for TABLE, VIEW

    Hi Experts,
    I have doubt regarding Generic DS . If Standard DS are not match with the Business Requirement , then we will create Generic DS.
    But iam asking What is the Exact Requirement to go for Generic DS in SD and MM. At what instance Standard DS are not match with the requirement in SD and MM Applications.
    When we will go for TABLE, VIEW, FUNCTION MODULE, INFOSET
    in realtime, What is Exact Requirement to go with these .
    Plz provide Solutions ASAP.
    I will allocate points to those who help me in detail. My advance thanks who respond to my query.

    Hi,
    as this is one of those questions already asked a lot of times I would strongly suggest to use the search functionality in the forums ASAP.
    regards
    Siggi

Maybe you are looking for

  • Excel 2007 .xlsm Application compatable with Windows 8.1

    I have finely lost the plot, for weeks I have been trying to load an Excel macro .xlsm file created on a Windows 7, with Office 2007 Professional on to a brand new computer running Windows 8.1 with Office 2007 Enterprise. on opening the file in Excel

  • Events in ABAP

    Hi Guys, I am new to ABAP , I am little bit confused how the events like INITIALIZATION to END-OF-PAGE will trigger. Also I am confused with multiple selections in select options and Ranges. Please let me know the difference between both. Thanks in A

  • IE 9.0 proxy failover not working correctly - Is there a bug fix or IE setting to correct this behavior

    I am testing proxy pac file  failover using IE 9.0.8112 and testing three choices using an automatic configuration file.  I shut down the first proxy to test the fail over to the second. Firefox 20.0.1 and chrome work correctly, but IE 9.0 does not.

  • How do you build for 2.x/3.x?

    Hi, I got my ad hoc distribution working recently and it made me more aware of the .app file I will give Apple. Can you make one set of binaries that works on iphone os 2.x and 3.x? Is the way you do that to specify iphone Device 3.0 as the target an

  • Struggling to migrate sharepoint sites developed on dev or qa over to production

    So, user 1 comes along and wants to put together a new site. He wants to use SharePoint Designer to set up pretty colors, create a new theme and use it, create a series of custom lists, etc. Meanwhile, on these same machines, there is a variety of In