Skip to Content
author's profile photo Former Member
Former Member

left() in CE_FUNCTIONS

Hi @ all,

we have the following sql statement in a calculation view.

var_out = select vbep.mandt, vbep.vbeln, vbep.posnr, max(left(mbdat,6)) as mbdatmax, sum(bmeng) as bmeng, vbep.lifsp

from "FP3040"."VBEP" vbep

group by vbep.mandt,

vbep.vbeln,

vbep.posnr,

vbep.lifsp

Would it be possible to receive the same result with CE_Functions?

We tried the following but it seems that the combination of max(left()) is not feasable within CE_AGGREGATE().

var_table = CE_COLUMN_TABLE("FP3040"."VBEP", ["MBDAT", "BMENG", "MANDT", "VBELN", "POSNR", "LIFSP"]);

var_out = CE_AGGREGATION(:var_table, [max(left("MBDAT", 6)), sum("BMENG")],["MANDT","VBELN","POSNR","LIFSP"]);

Thanks a lot for you input.

Flo

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Nov 21, 2012 at 12:21 PM

    Hi Florian,

    You can do almost everything on CE but it's normally needed more instructions (One SQL can sometimes require 6 or more steps to achieve same result), try the projection below for your case:

    var_table = CE_COLUMN_TABLE("FP3040"."VBEP", ["MBDAT", "BMENG", "MANDT","VBELN", "POSNR", "LIFSP"]);

    var_proj = CE_PROJECTION(:var_table,

    ["MBDAT","BMENG","MANDT","VBELN","POSNR","LIFSP",

    CE_CALC(' leftstr("MBDAT",6) ',VARCHAR(6)) as "PERIOD"]);

    var_out = CE_AGGREGATION(:var_table, [max("PERIOD"), sum("BMENG")],["MANDT","VBELN","POSNR","LIFSP"]);


    Regards, Fernando Da Rós

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.