Register Login

Separate Alphabets & Numbers In Any String.

Updated May 18, 2018

REPORT: ZSEPARATE_NUMBERS_ALPHABETS.

DATA: result TYPE string,

count TYPE i,

cnt TYPE i,

lv_alphabets TYPE string,

lv_numbers TYPE string.

cnt = 0.

PARAMETERS f1(50) TYPE c.

count = STRLEN( f1 ).

IF count IS NOT INITIAL.

 DO count TIMES.

   result = f1+cnt(1).

IF result CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

CONCATENATE lv_alphabets result INTO lv_alphabets.

CLEAR result.

ELSE.

CONCATENATE lv_numbers result INTO lv_numbers.

CLEAR result.

ENDIF.

cnt = cnt + 1.

ENDDO.

ENDIF.

WRITE:/ 'The Albhabets Are :', lv_alphabets.

WRITE:/ 'The Numbers Are :', lv_numbers.

Find more solution on SAP ABAP Transaction Codes 

Input :

abc123def456qrs789

Output Screen Shot:

Thanks & Regards,

A.Uttam


×