cancel
Showing results for 
Search instead for 
Did you mean: 

In fox formula, how to define a variable which is Character String length 4

Former Member
0 Kudos

Hi Expert,

I want to define a variable in fox formula. This variable not the type of any characteristic or key figure in Agg Level. But a Character which length 4.

I tried below:

DATA XXX  TYPE STRING.

While that length is 2.

Is there any way to define the string length is 4?

Thanks!

Accepted Solutions (0)

Answers (3)

Answers (3)

bishwajit_das
Active Contributor
0 Kudos

Hi,


DATA XXX  TYPE STRING.

where XXX is string variable any length.


but if you want to restrict a string to 4 characters, you can create an InfoObject (YYYY)  in BW with CHAR of length 4.Then use it accordingly


DATA XXX TYPE YYYY.


Wish that helps..


Regards,

Bishwajit


Former Member
0 Kudos

I just realize that when I use:

DATA AST  TYPE STRING.


Some time the length of AST is 2, some time the length is 3 because I saw another error message when I check another program, which use same type STRING, while the error message say:

Length of Parameter ASTYP(000004) and variable AST(000003) are inconsistent.


So I guess the type STRING is dynamic. I do not know which factor cause it think it should be 2 or 3...


Can anyone advice?


Thanks!


Former Member
0 Kudos

Hi,

Sounds weird ...

Could you please share the FOX code as well as ASTYP domain ?

BR,

former_member185177
Contributor
0 Kudos

Hi Dongkai,

You can try with the data element directly as mentioned below.

DATA XXX TYPE CHAR04.

or

DATA XXX TYPE CHAR004.

Regards,

Krishna Chaitanya.

Former Member
0 Kudos

Hi,

As I know type STRING doesn't have a lenght (only maximum 255, or more in the latest BW versions).

So you can't say STRING(4) in FOX.

Do you need exactly 4 characters lenght ?

For which purpose ? May be there is a workaround for it ...

BR,

Former Member
0 Kudos

Hi Andrey,

The reason I need exactly 4 characters is because I will call a function in this fox formula and export a parameter which require length 4.

And at first I do not believe type String have any length as well, well when I use type string and check the formula, below error message pop up. ASTYP is the function interface, AST is the one I use STRING to define.

Thanks!

Dongkai

Former Member
0 Kudos

Hi,

I think that there is a limitation in calling function modules in fox, you can't export string directly so change your logic and manage the string inside the FM and export in integer.

Hope it helps