Skip to Content

Design Studio - max string variable length

All,

We are running DS 1.6 with Bex queries. Quick background:

I'm working on a proof of concept that involves taking all values of a field from one query (after the Bex variable Prompt selections are made) and passing these values to other queries as a filter. The end result would be a report that offers various views of the same base population.

Due to the well-documented lack of a global script array variable in Design Studio, I initially took an array variable, converted it into a global string variable, and planned to use this variable post-startup to avoid having to re-calculate a new array variable at every step. Example below:

var Students_Arr=DS_PROGRAM_INPUT.getMembers("ZHESTUDNT", 1000000);
 Student_List="";
Students_Arr.forEach(function(element, index) 
{Student_List=Student_List+element.internalKey+',\n';}); 

This works correctly if I choose a relatively small population on the initial prompt screen (i.e. a small number of values for "ZHESTUDNT"). If I choose a larger population (in this case, approx. 35,000 values for ZHESTUDNT, which is 9 characters long per value, equaling approx. 350,000 characters), when the script executes, I get the standard generic error message

"Error during script processing

Error during script processing. Contact the Application Designer to resolve the issue"

I am guessing there is some limit on the length of a string variable that is being exceeded - does anyone have info on that limit?

I'm trying to remain SDK-free in my solution, so my current plan is to make a global script that recreates the array variable whenever needed.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 13, 2016 at 02:39 PM

    Hi Scott,

    Using getMembers() and a string variable for such high volumes of data is not going to be very effective from a performance perspective and will be limited by length as you've discovered.

    The scenario of filtering one BEx Query based on the results of another is best implemented by using Replacement Path Variables of type "Replacement with Query", as described in the following document: Replacement Path Variables - Replacement with Query - They May Save You Some Time

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Mustafa. I believe that for this project, the most efficient way to proceed will still be to use variables within Design Studio, even if the variable used is a temporary script array that has to be recreated each time it's used.

      The interface we are working on will involve giving users a choice between multiple variable screens, all of which have different selection criteria to select an initial population. In addition to multiple selection criteria options, the user also has multiple choices in terms of output queries to view this population for. Using only replacement would require that each selection/output combination have its own output query. I think our population is sufficiently limited in size such that as long as I avoid using a string variable to contain filter values, we should be OK.

      Thanks

      Scott

  • Oct 11, 2016 at 07:28 PM

    Did you increase the "fetch size" limit as shown in this archived thread? See https://archive.sap.com/discussions/thread/3651038

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 13, 2016 at 01:30 PM

    Hi Tammy,

    Thanks for the response. In this case, I don't believe the array fetch size is the issue. I say this because if I remove the string conversion step (the step that allows me to store my array as a global variable), everything runs without incident. At this point, the array has successfully reached 35k records without issue.

    The problem seems to be solely the length of the created string. It seems to happen at some length between 10k and 100k characters - my field I'm converting from array to string is 10 characters per row, so this equates to 1,000 -10,000 values.

    I'm just wondering if anyone knows how to find this string length limit outside of trial and error and if it can be adjusted anywhere. If not, I can work around the limitation - I had hoped, however, to be able to store some pretty large arrays as global script variables, and I can't do so until SAP potentially adds array global script variables to Design Studio.

    Thanks!

    Scott

    Add comment
    10|10000 characters needed characters exceeded