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: 

String Field

former_member515329
Participant
0 Kudos

I am having one string field...

data : lv_str type string...

i m passing lfa1-name1 which is having around 10 char(suppose)...in the output i need to set this field as 24 chars..

if pass lv_str = 'RAM'.

the left space for the string field set as 24 chars i need to pass as null spaces...

so..for this lv_str in the output i need tp show RAM and 21 blank spaces after it...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this.

Instead of string try with char


data : lv_str(24) type c.

lv_str = 'RAM'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_str
IMPORTING
OUTPUT = lv_str.

write: lv_str.

Regards,

Vikranth

10 REPLIES 10

Former Member
0 Kudos

Hi,

Check this.

Instead of string try with char


data : lv_str(24) type c.

lv_str = 'RAM'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_str
IMPORTING
OUTPUT = lv_str.

write: lv_str.

Regards,

Vikranth

0 Kudos

here string is the mandatory.....i cant use char

0 Kudos

Hi,

Well then if ur meaning 21 zero's before the value and you have to use only string, even this will work


data : lv_str(24) type string.
 
lv_str = 'RAM'.
 
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_str
IMPORTING
OUTPUT = lv_str.
 
write: lv_str.

Regards,

Vikranth

0 Kudos

yes..i want 21 blank spaces after the name...

use of FM 'conversion_exit..' is not working...

0 Kudos

Hi, Ravi

By the way you Remove the message added by Moderator ?

Your Subject Line is also against the Forum Rules Please Check Link for Forum Rules

Please always USE Meaningful Subject Line

Faisal

0 Kudos

Hi,

A string will consider zeros with space and thus using string alone you cant do this. Declare one more char variable and try this.


data: var type string.
data: var1(24)  type c.

var = 'RAM'.
var1 = var.

translate var1 using '0'.

write: var1.

Regards,

Vikranth

0 Kudos
data : lv_str type string,
          lv_int typ i.

lv_str = 'RAM'.
lv_int = strlen( lv_str ).

lv_int = 24 - lv_int.

do lv_int times.
  concatenate lv_str space into lv_str.
enddo.

0 Kudos

data : lv_str type string,

lv_int typ i.

lv_str = 'RAM'.

lv_int = strlen( lv_str ).

lv_int = 24 - lv_int.

do lv_int times.

concatenate lv_str space into lv_str.

enddo.

will this work???

as i am sending the output to txt file....will i be able to see spaces in txt file?

0 Kudos

yes it will. try a gui_download on it and check

kesavadas_thekkillath
Active Contributor
0 Kudos

21 blank spaces after it

???