Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP 7.40: shift val left deleting leading space => shift_left( val = val ) ???

ralf_wenzel_heuristika
Active Participant
0 Kudos

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)....

1 ACCEPTED SOLUTION

Clemenss
Active Contributor
0 Kudos

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)

2 REPLIES 2

Clemenss
Active Contributor
0 Kudos

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)

JPT
Participant

Another solution could be:


DATA: VALUE TYPE char10 VALUE '    X'.

DATA(target) = conv char01( condense( value ) ).