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: 

Fixed Length Strings.

Former Member
0 Kudos

Hi ,

I have to download a longtext from SAP.

The length of the longtext has to be fixed 5000 ie...Even if the length of the longtext from SAP is 1000 remaining 4000 spaces should get appended.

I am moving the long text into a variable l_line which I have declared in the following way L_LINE(5000).

But after moving the longtext into this variable it still shows the actual length of the longtext whereas I need 5000 fixed length.

How to solve it.

Thanks,

7 REPLIES 7

madan_ullasa
Contributor
0 Kudos

Hi,

There should be something called 'respect' space or something liek that in ECC5.0 and above... not sure.. just check it out... i am in 4.6C now... so cannot do it fro u ...

regds,

Madan...

Former Member
0 Kudos

Hi Renu Raj,

Just WRITE the LONG TEXT again in to the variable with RIGHT

JUSTIFIED. It will prefixes SPACEs and STRLEN will return 5000.

i.e. as follows,



  WRITE : L_LINE TO L_LINE RIGHT-JUSTIFIED.
  CNT_LEN = STRLEN( L_LINE ).

Now the CNT_LEn will have '5000'.

While you process the LONG TEXT, just CONDENSE it and go ahead. It will remove LEADING SPACEs.

i.e. as follows,



  CONDENSE L_LINE.
  CNT_LEN = STRLEN( L_LINE ).

Now CNT_LEN will have an actual length.

Regards,

R.Nagarajan.

-


We can -


0 Kudos

Hi Nagarajan,

It really did help a lot....Now the length of the longtext is 5000 but the space is getting appended before the string , while downloading it looksodd.I require the space after the string.

Any idea as to how to do it...

Thanks..

0 Kudos

Hi Renu Raj,

While processing the data from the file just CONDENSE it and process it as i said earlier.

Is it possible? Any issue on using this?

Regards,

R.Nagarajan.

-


We can -


0 Kudos

Hi Nagarajan,

When I use condense after the write statement the length becomes the original length of the longtext,and not 5000.Any clue as to how to overcome this...

Thanks...

0 Kudos

Hi Renu Raj,

You want the STRING LENGTH as 5000 irrespective of the

actual length. For this only LEADING SPACEs added.

While proceesing this data, if LEADING SPACEs are not wanted, then using CONDESE statement we removed it.

What else?

Regards,

R.Nagarajan.

-


We can -


0 Kudos

Hi Nagarajan,

Using the above mentioned logic we are making the string length as 5000,but once we use condense the string length becomes the original length from the table.

If we do not use condense spaces are getting appended before the string but the user wants the space appended after the string.

Any idea as to how to do it.

Thanks.