05-14-2016 9:21 PM
Hi, everybody.
I want to translate the statement
DATA:
value type char10 value ' X',
target type char01.
SHIFT value left deleting leading space
target = value(1).
into ABAP 7.40
target = shift_left( val = value....).
But how do I write "deleting leading space" in shift_left? sub = space does not work (due to documentation of shift_left and tests)....
05-14-2016 11:29 PM
Hi Ralf,
according to ABAP Keyword Documentation ist is
target = shift_left( val = value, sub = space ).
If the argument sub is given a character string in substring, all substrings in the character string from text are removed on the left or right that match the content of substring.
I don't see the reason for sub = space does not work due to documentation, but you may even omit the sub argument:
If none of the arguments places, circular, or sub are specified, the functions work as if the sub argument has been passed a blank character. All blank characters to the left or right are removed.
That means
target = shift_left( value ).
should do the trick. (In this case, an explicit val= can also be omitted.)
Sorry, no access to 740, but doesn't it work like this?
Regards Clemens
Message was edited by: Clemens Li (Sorry, had to read the documentation with care)
05-14-2016 11:29 PM
Hi Ralf,
according to ABAP Keyword Documentation ist is
target = shift_left( val = value, sub = space ).
If the argument sub is given a character string in substring, all substrings in the character string from text are removed on the left or right that match the content of substring.
I don't see the reason for sub = space does not work due to documentation, but you may even omit the sub argument:
If none of the arguments places, circular, or sub are specified, the functions work as if the sub argument has been passed a blank character. All blank characters to the left or right are removed.
That means
target = shift_left( value ).
should do the trick. (In this case, an explicit val= can also be omitted.)
Sorry, no access to 740, but doesn't it work like this?
Regards Clemens
Message was edited by: Clemens Li (Sorry, had to read the documentation with care)
07-01-2016 6:25 PM
Another solution could be:
DATA: VALUE TYPE char10 VALUE ' X'.
DATA(target) = conv char01( condense( value ) ).