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: 

Delete leading spaces

Former Member
0 Kudos
21,722

Hello,

I want to delete leading spaces of one field, which is of type STPOX-MNGLG its a quantity field.

Regards,

Amey

7 REPLIES 7

Former Member
0 Kudos
2,961

Hi,

Use Condense statement if it is Script or Smartform &STPOX-MNGLG(C)& : Script or Smartform

In case of others move that variable to a char type var of same length and use condense statement after that.

It works....

venkata_ramisetti
Active Contributor
0 Kudos
2,961

Hi,

Why you want to delete leading space in Qty field.

If this is for display in the outout, you can use WRITE wtih LEFT-JUSTIFIED option.

If my understanding is not corerct, Can you please give more details about your issue.

Thanks,

Ramakrishna

Former Member
0 Kudos
2,961

Hi Amey,

For quantity fields first you need to move to char field and do it.

SHIFT V_CHAR LEFT DELETING LEADING space.

Or else it wont work. Even I got the same problem long back.I dint in that way only.

Thanks & Regards,

Siir.

former_member188685
Active Contributor
0 Kudos
2,961

Hi Use condense.

regards

vijay

former_member181962
Active Contributor
0 Kudos
2,961

Hi Amey,

pass it to a character variable and then remove the leading spaces by

using the condense command.

Regards,

ravi

Former Member
0 Kudos
2,961

Amey,

You can try "condense" with "No-gaps" options

Here is an example

DATA: BEGIN OF NAME,

TITLE(8) VALUE ' Dr.',

FIRST_NAME(10) VALUE 'Michael',

SURNAME(10) VALUE 'Hofmann',

END OF NAME.

CONDENSE NAME NO-GAPS.

The contents of NAME is now "Dr.MichaelHofmann".

Since the field string NAME is interpreted and handled like a

type C field, the CONDENSE statement treats it as a whole and

ignores any sub-fields. The contents of the sub-field would

therefore now be as follows:

NAME-TITLE = 'Dr.Micha'

NAME-FIRST_NAME = 'elHofmann '

NAME-SURNAME = ' '

Former Member
0 Kudos
2,961

Hi Amey,

2 ways to do it:

1. Declare another variable <Var1> of type C of 15 characters long.

WRITE <varible of type STPOX-MNGLG> to <var1>.

condense <Var1>.

2. Since it is a quantity field, the value is right justified, try formatting the output as left justified.

Naveen.