1

I want to select the length of the string ( LGOBE ) minus 4.

But i get this error: "In the function "SUBSTRING", the parameter number "3" must be an ABAP variable. This is not the case for the expression that starts with "LENGTH"."

What I understand from this message is that i cannot use a function as the third parameter, is this interpretation correct? If so, is there an alternative for me to remove the last 4 places of the string inside the select statement? Thank you.

  SELECT
  SUBSTRING( LGOBE,1, LENGTH( LGOBE ) - 4 ) AS TEST1,
  LGOBE, WERKS
  FROM T001L INTO TABLE @DATA(IT_FINAL)
  UP TO 100 ROWS.

  CL_DEMO_OUTPUT=>DISPLAY( IT_FINAL ).
1

1 Answer 1

3

Checking the 754 documentation:

SUBSTRING( sql_exp,pos,len ) sql_exp: see below

pos: Literal, host variable, or host expression with the ABAP type b, s, i, int8

len: Literal or host constant with the ABAP type b, s, i, int8

Now 755:

SUBSTRING( sql_exp,pos,len )

Substring sql_exp from the position pos with length len. pos and len must be specified so that the substring is within sql_exp. sql_exp: see below

pos: SQL expression with the ABAP type b, s, i, int8

len: SQL expression with the ABAP type b, s, i, int8

Interestingly I cannot find that mentioned in the release notes itself. So either you upgrade to 755 release or you'll have to do the processing in ABAP after selection.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer. I don't have reputation enough to upvote but thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.