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: 

To trim leading zeroes

Former Member
0 Kudos

Hi,

I need to trim the leading zeroes from my field.

Eg: I am taking the field length as 6, but if my value is only of 4 digits then its coming as 004216.

I need this value to be 4216 only.

I cant change the field length to 4 as there may be values that may be more then 4 upto 6 digits.

Kindly help.

Thanks,

Manish

1 ACCEPTED SOLUTION

former_member705122
Active Contributor
0 Kudos

Hi,

Shift <var>left deleting leading '0'.

DATA : 
  w_var(6) VALUE '004216'.
  
  SHIFT w_var LEFT DELETING LEADING '0'.
  WRITE : w_var.

Regards

Adil

10 REPLIES 10

GauthamV
Active Contributor
0 Kudos

hi,

use CONDENSE statement.

Former Member
0 Kudos

hii

use following FM

data: wa_output(25) type c.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
    input         = '0000004265'
 IMPORTING
   OUTPUT        = WA_OUTPUT.
write 😕 wa_output.

regards

twinkal

Former Member
0 Kudos

use FM

CONVERSION_EXIT_ALPHA_OUTPUT

former_member705122
Active Contributor
0 Kudos

Hi,

Shift <var>left deleting leading '0'.

DATA : 
  w_var(6) VALUE '004216'.
  
  SHIFT w_var LEFT DELETING LEADING '0'.
  WRITE : w_var.

Regards

Adil

Former Member
0 Kudos

hi...

use keyword pack and unpack

regards

vivek

Former Member
0 Kudos

Hi,

You Can use the function module.

CALL FUNCTION 'BKK_DELETE_LEADING_ZERO'

CHANGING

C_FIELD = IT_LIPS-MATNR.

using above FM you can pass the material number, then execute above FM get deleting with leading zeros.

Tanks surendar

Former Member
0 Kudos

Hi dude,

shift v_abc LEFT DELETING LEADING '0'.

try this

Regards,

ramki

Former Member
0 Kudos

Thanku all

My Query solved

Edited by: MANISH GUPTA on Sep 2, 2008 8:08 AM

Former Member
0 Kudos

Hi Manish

Refer above thread

Regards,

Syf

Former Member
0 Kudos

Hi

using FM 'conversion_exit_Alpha_ouput' u can display

Regards

Laxmi