cancel
Showing results for 
Search instead for 
Did you mean: 

LOCATE, SUBSTR_AFTER, SUBSTR_BEFORE is not working with SPACE delimiter in SAP HANA DML STATEMENT?

SBLSVRamana
Explorer
0 Kudos
1,155

Hi ,

I'm trying to find the position or string based on STRING function in AMDP Method using SQL below Statements.

select locate( lv_text_as, ' ' ) INTO lv_len FROM dummy;

select substr( lv_text_as, 1, lv_len ) from dummy;

SELECT substr( lv_text_as, lv_len, length( lv_text_as ) - lv_len ) from dummy;

----------------------------------------------------------------------------------------------------------------

select substr_before( lv_text_as, ' ' ) INTO lv_text_bs from dummy;

SELECT substr_after( lv_text_as, ' ' ) INTO lv_text_as from dummy;

----------------------------------------------------------------------------------------------------------------

lv_len = locate( lv_text_as, ' ' );

lv_text_bs = substr( lv_text_as, 1, lv_len );

lv_text_as = substr( lv_text_as, lv_len, length( lv_text_as ) - lv_len );

None of the above statements is working due to SPACE as delimiter.

Could you please help me to solve the above issue.

Regards,

Ramana.

View Entire Topic
Cocquerel
Active Contributor

try to replace your one space string ' ' by CHAR(32)
You can refer to the following note 2262114 - One Space Handling for ABAP in SAP HANA