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: 

How to delete space in an internal table

former_member184119
Active Contributor
0 Kudos
940

Hi All,

In internal table I want to compress the leading space

After searching I found Condense and SHIFT LEFT DELETE leading space commands work it is written...

but when I write code A single space is appreaing in between the two fields...can any body help me where I am going wrong??

Ex:

data: begin of itab occurs 1 ,

PSAtext TYPE CHAR15,

psa type btrtl,

end of itab.

now o/p BEFORE CHANGE IS :


SBI-CT    |1023

After condense is SBI-CT |1023

bETWEEN SBI-CT AND | there is a additional space. How can we avoid that?

Sas

Edited by: saslove sap on Sep 29, 2010 7:43 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
288

CONCATENATE filed1 fild2

INTO result.

condens no-gap result.

append it. single line

12 REPLIES 12

Former Member
0 Kudos
289

CONCATENATE filed1 fild2

INTO result.

condens no-gap result.

append it. single line

0 Kudos
288

Can you please elobrate a bit....?

What happens if position text(Field1) is "senior office"

Will this also gets mixed as senioroffice???

Sas

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos
288

The space after first field in internal table is separator b/w diff. columns.

0 Kudos
288

Its not coming all the fields:

For example:


SBI-UT   |1023|US

Then after condense:

SBI-UT |1023|US

Regards

sas

No space between 1023|us

Edited by: saslove sap on Sep 29, 2010 8:05 AM

0 Kudos
288

Hi,

You can check the below options,

PACK statement,

CONDENSE WITH NO-GAPS.

Thanks,

Pawan

0 Kudos
288

Well Condense No-gaps works perfectly....

But when I field which is having internal space that is also supressing as I said above...

Please let me know for any other alternative for this?

Regards

sas

Former Member
0 Kudos
288

Hi

i beleive this is because the spacing while defining the fields in the table.

the field will take the space defined during table declaration.

Thanks

lalit

0 Kudos
288

I can change my field definition also...

What you want me to change to achieve this?

Regards

sas

0 Kudos
288

Well this is what I am going to solve this

data:begin of STRING OCCURS 1 ,

S1 TYPE STRING,

END OF STRING.

loop at itab.

concatenate itab-f1 itab-f2 into string-s1 seperated by '|'.

append string.

end of itab.

then I can transfer this string to Application server.

Thanks for all the contributions.

Regards

sas

0 Kudos
288

Hi,

Application server

you should have told this in your question.

0 Kudos
288

What difference it makes now Keshava?

any good alternative for this?

Sas

kesavadas_thekkillath
Active Contributor
0 Kudos
288

If you move it right justified then you will get a space in beginning. Whatever is happening is correct.

Your internal table field size is larger than the content in it !!!