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: Accessing a part of a shifted field

ralf_wenzel_heuristika
Active Participant
0 Kudos

Hi,

I am still in trouble with ABAP 7.40, sometimes

DATA:
   charact TYPE c LENGTH 10 VALUE 'BLABLABLUB',
   target  TYPE c LENGTH 10.

target = shift_right( val = charact circular = 4 ).

IF target(4) EQ 'BLUB'.
* ....
ENDIF.

I'd like to have an alternative coding without field "target", which is needed for "target(4)"-expression. What I mean is a

IF shift_right( val = charact circular = 4 )(4) EQ 'BLUB'.  " <= of course, this does not work

* ....
ENDIF.

Anybody out there, who can help me?

1 ACCEPTED SOLUTION

former_member195402
Active Contributor
0 Kudos

Hi Ralf,

please try

If shift_right( val = charact circular = 4 ) CP 'BLUB*'.

Regards,

Klaus

5 REPLIES 5

former_member195402
Active Contributor
0 Kudos

Hi Ralf,

please try

If shift_right( val = charact circular = 4 ) CP 'BLUB*'.

Regards,

Klaus

0 Kudos

It's so simple..... *argh

0 Kudos

Hi Klaus. Would you know why doesn't (4) work?

0 Kudos

Dug up SAP documentation and there are apparently 3 operand positions -

  • read,
  • write
  • subfield access

String processing functions e.g., shift_right, can only be declared at "reader" positions.

kakshat
Advisor
Advisor
0 Kudos

Neither did SUBSTRING work