cancel
Showing results for 
Search instead for 
Did you mean: 

Strings

Former Member
0 Kudos

I want to find the length of a string and if the less than 40 chars.

I want to append the remaining zeros to the string.

Edited by: Wilian Segatto on Jan 29, 2010 1:10 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Raj,

Where do you want to do this?

If you want to do this in a characteristic, you can define this characteristic as string, with a length of 40, then you can select an ALPHA routine, this routine checks the length of a string and fill it with zeros until it achieves the maximun length, in this case 40.

This routine doesn't work with alphanumeric values, for instance, if you have defined length of 6 and you insert a valu 455 then alpha writes this internal value 000455 but if you insert 45A, alphas make no change to this value.

I hope this can help you.

Regards.

Marín.

Message was edited by:

Ulises Marí

Former Member
0 Kudos

i am doing that for product numbers ,

LOOP AT IT_MATKEY INTO wa_matkey.

len = strlen( wa_matkey-ext_matnr ).

len = 40 - len.

do len times.

concatenate '0' wa_matkey-ext_matnr into wa_matkey-ext_matnr.

enddo.

SELECT SINGLE matid FROM /sapapo/matkey INTO matguid WHERE matnr = wa_matkey-ext_matnr.

i am using this code in a user exit, it_matkey is the import paramter of the function module, when the products are CIFed they are stored in it_matkey.

Unless i am writing the above code for product ids with numbers ,select statement is not working.

Answers (0)