Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to find string last 4 chars

hi,

i need to get the last 4 chars of the string with that i have to compare.

or..

in bdc i have to upload the data from flat file that may be .txt / .xls.. which FM we have to use for to upload.

any suggestions .. pl..

Tags:
Former Member
Former Member replied

Hi,

try this:

DATA: STR TYPE STRING VALUE 'testfrom2007'.

DATA: CSTR(4).

DATA: STRL TYPE I.

*

STRL = STRLEN( STR ).

IF STRL > 4.

STRL = STRL - 4.

CSTR = STR+STRL(4).

ELSE.

CSTR = STR.

ENDIF.

*

WRITE: CSTR.

regards, Dieter

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question