cancel
Showing results for 
Search instead for 
Did you mean: 

working with variables

Former Member
0 Kudos

Hi everyone, I have been through a silly but still annoying problem in Data Services regarding variables.

I looked up a lot of place and I didnt find a answer for it.

I have a simple question and I already read sap material (sap bo data services book reference book).

Let put my example and also my understanding.

I created a global variable as varchar and I fixed a value which is a string without any special  data services character.

I want to compare this value on query transformation against a column which also is a string

if I just used $g_my_variable against the column and validate. it's work fine. however when I run the job. I got a error.

According to the book ds_reference:

     The square brackets ([]) indicate that the value of the expression should be substituted.

    

     The curly braces ({}) indicate that the value of the expression should be quoted with single quotation

     marks.

So according to this book I have to use curly braces. So I did it. when I validate. I got a error. According to sap material this is gonna to happen.

         Strings including curly braces or square brackets cause a processing error. You can avoid the error by

         preceding the braces or brackets with a backslash (\).

I have done it, but I still got the same error.

In this specific case my workaround was to include in my fixed value a quote. however I dont think it is the right way of doing things.

And I also saw many problem like this one. So I think someone should clarify this topic, but I think it is a bug software problem.

Thanks in advanced

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I really respect you that's why I will not answer accordingly your comment about (RT*M)

Because according to what I've written in my previous message:

According to the book ds_reference:

     The square brackets ([]) indicate that the value of the expression should be substituted.

    

     The curly braces ({}) indicate that the value of the expression should be quoted with single quotation marks.

and before I post this message I had read many others post.
Anyway I found my mistake.  In one of my variables at the creation screen  of a global variable in value part it was without quote.

former_member187605
Active Contributor
0 Kudos

You thought it was a bug, I just said it wasn't. It's always so easy to blame others for your own mistakes, isn't it?

But you're right, reading the manual is not enough, you've also got to apply correctly what's written.

Have a nice weekend!

Former Member
0 Kudos

Even though you are right about my mistake, now that I found the problem I think it's a design flaw in sap DS, because I was creating a variable through a screen.

I mean put a string M on value I didnt get any alert or error in this part even in the DF only when I tried to run the job I got a error message.


I know that every string  have to be put on quotes, however I was creating a variable through a software and I really think this software should give some message if something so simple got wrong.

I dont know if I made my point clean.


Anyway thanks so much with your help... You always share good material with the community that's why I told I RESPECT YOU SO MUCH.


Have a great weekend and keep helping us... thank you so much.




WRONG WAY...

THE VALUE MUST TO BE PUT IN QUOTES. 'M'

former_member187605
Active Contributor
0 Kudos

The values of global variables are not evaluated at compile time at all! Those values are only used for initialisation at runtime, in the order the global variables are defined. As a result, there cannot be compile-time errors, only run-time errors.

Consider those 2 examples (you can also see that a single quote is not mandatory for a variable of type varchar 😞


  1. Print($G_File_Name) prints: demo.xlsx.


  2. Print($G_File_Name) prints: NULL
Former Member
0 Kudos

Thanks so much. I gotta your point.
I am still learning about DS however I really liked and I didn't find any good site talking about what are SAP plans for DS with SAP HANA.

You could right something about it. Which is the strategy for DS and BW or if someone has already done it and you know the link you could share with me

And again thanks for your amazing help I really appreciate

former_member187605
Active Contributor
0 Kudos

Navigate to http://www.service.sap.com/roadmaps. Select Product and solution road maps > Database & Technology > SAP Data Services.

former_member187605
Active Contributor
0 Kudos

This is not a bug! RT*M.

The curly and square brackets are only used in scipting. They allow you to use the contents of global variables in character strings without having to rely on escape sequences or concatenations.

You normally don't need them at all when a global variable is used in a Query transform.