Application Development and Automation 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: 
Read only

String Field

former_member515329
Participant
0 Likes
1,386

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
Read only

Former Member
0 Likes
1,347

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
Read only

Former Member
0 Likes
1,348

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

Read only

0 Likes
1,347

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

Read only

0 Likes
1,347

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

Read only

0 Likes
1,347

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

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

Read only

0 Likes
1,347

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

Read only

0 Likes
1,347

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

Read only

0 Likes
1,347
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.
Read only

0 Likes
1,347

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?

Read only

0 Likes
1,347

yes it will. try a gui_download on it and check

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,347

21 blank spaces after it

???