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 remove space while giving the output in abap???

Former Member

WRITE:/ sy-vline, 'At the end of:' , ITAB-ERNAM , 'Total count is:' ,I.

the above thing i m mentioning in my prg and in output there is space between 'total count is:' and the variable I,

there is also space between the value of itab-ernam and the msg 'total count is'....

pls help me to remove the space...

i tried with condense and replace command but it's not working...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

create a char field and then condense the count field with no gaps to this char field. And then display this char field. This should work for you.

Regards,

Anil

10 REPLIES 10

venkateswaran_k
Active Contributor
0 Kudos

Hi

The Numeric values are always right justified.  So there you see the space between the label and the value.

If you do not want space, you can use the justification option in the Write Statement.

Regards,

Venkat

0 Kudos

Hi,

Try NO-GAP addition.

Regards.

From:

http://help.sap.com/saphelp_45b/helpdata/en/34/8e732f6df74873e10000009b38f9b8/frameset.htm

WRITE: 'A' NO-GAP, 'B' NO-GAP, 'C'.  "Output: ABC

If NO-GAP was not specified here, the output would have been "A B C " because one blank is always implicitly generated between consecutive output fields.

Ajit_K_Panda
Product and Topic Expert
Product and Topic Expert

Hi,

Try with left justified or no-gap.

it will work.

Former Member
0 Kudos

This can be the reason because for Integer value. Integer, float and Packed data type are right Justified.

You had tried with condense statement, Right, Condense statement removes more then one space but one space will be there .

So try with CONDENSE <c> [NO-GAPS]. This will remove all space.

data lv_string type string.

concatenate Total count is:' ,I into lv_string.

condense lv_string no-gaps.

WRITE:/ sy-vline, 'At the end of:' , ITAB-ERNAM , lv_string.

And if you want to remove leading zero form I for this you can use 'CONVERSION_EXIT_ALPHA_OUTPUT' function module.

former_member184569
Active Contributor
0 Kudos

It would work fine with NO-GAP addition.

WRITE:/ sy-vline, 'At the end of:' , ITAB-ERNAM , 'Total count is:' NO-GAP , I.


http://help.sap.com/saphelp_470/helpdata/en/9f/db9e3d35c111d1829f0000e829fbfe/content.htm

Former Member
0 Kudos

Hello,

In addition of using the NO-GAP and CONDENSE abap statements, you must also ensure that the datatype you using is appropriate.

For example:

data g_type_i type i.

g_type_i = 01.

WRITE:/ sy-vline, 'At the end of:' , sy-uname , 'Total count is:' , g_type_i.

WRITE:/ sy-vline, 'At the end of:' , sy-uname , 'Total count is:' NO-GAP , g_type_i.

data g_type_n type n.

g_type_n = 01.

WRITE:/ sy-vline, 'At the end of:' , sy-uname , 'Total count is:' , g_type_n.

WRITE:/ sy-vline, 'At the end of:' , sy-uname , 'Total count is:' NO-GAP , g_type_n.


In this example the type i contains space compared to the type n.

Thanks and Kind Regards,

Yovish.

Former Member
0 Kudos

hi,

create a char field and then condense the count field with no gaps to this char field. And then display this char field. This should work for you.

Regards,

Anil

p_soobhany
Participant
0 Kudos

Try writing to a variable of type char, condense the variable an write it to screen

Former Member
0 Kudos

thanks all for replying your help really helped me to solve my prob....

0 Kudos

If your problem resolve. Then kindly close this thread by marking correct and helpful ans., so that if someone having same doubt can directly look at that correct ans.