Skip to Content

Concatenating String to Display Details Error

Referencing code posted by @abhilash.kumar on 06/21/2012, I am trying to collect detail records in a single field. In some cases, the code below works, but in others, I receive an error stating, "String length is less than 0 or not an integer". I realize that I'm getting this error because there are some blank values being returned and the code is subtracting from zero, I just don't know how to fix it and after perusing discussions, I haven't came to a conclusion. Any help is greatly appreciated!

This is going into my details section:

WhilePrintingRecords;
stringvar array arr;
numbervar i;
if not({Customer.Country} in arr) then
(
    i := i + 1;
    redim preserve arr[i];
    arr[i] := {Customer.Country};
);
arr[i]

This is going into my footer section:

WhilePrintingRecords;
stringvar array arr;
stringvar fin;
numbervar j;
for j := 1 to ubound(arr) do
fin := fin + arr[j] + ", ";
left(fin,len(fin)-2);

Referencing: https://archive.sap.com/discussions/thread/3195910

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 08 at 07:35 AM

    Hi Scott,

    Change the code on the footer to:

    WhilePrintingRecords;
    stringvar array arr;
    Join(arr, ", ");

    -Abhilash

    Add comment
    10|10000 characters needed characters exceeded