Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Ouput a string in a calculated column(Sqlscript)

Hi there.

I am having issues with something that appears to be really simple.

I just want to add a calculated column in a projection and print a string in this row.

Like the example below:       

                  var_sales = CE_PROJECTION(:var_in,

                                    [                 

                                       "COMPANY",

                                       CE_CALC('SOME TEXT', varchar(100)) AS "TYPE"                                                                                                        

                                    ]

                  );

The odd thing is that if I put a INTEGER on 'SOME TEXT' it will work, but I need a string to be output.

In the graphical mode is really simple to do it, I just need to print the string in single quotes. But I have to do it in sqlscript because I am calling a procedure before it.

Former Member
replied

Quotes in SQLScript get tricky. The ' denotes the expression so you need to add another '' (triple quotes) to specify a string inside the expression. The following will compile.

var_sales = CE_PROJECTION(:var_in,

                                    [                

                                       "COMPANY",

                                       CE_CALC('''SOME TEXT''', varchar(100)) AS "TYPE"                                                                                                       

                                    ]

                  );

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question