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: 

Regarding Leading Zeros.

former_member193471
Active Contributor
0 Kudos
250

Hello Friends,

How can I remove leading zeros in an Internal Table Value. I am writing a BDC for User Defined Transaction. Here BDCDATA-Fval contains length of 132 chars. When I append a value to BDCDATA, it is appending as right justified. when we try to populate a value in to Screen field(CURRENCY FIELD), it is taking first 10 chars(from leftside) which are Zeros(leading zeros). for that, I would like to remove leading zeros for internal table BDCDATA. How can I do it?

Thanks & Regards

Sathish Kumar

1 ACCEPTED SOLUTION

Former Member
0 Kudos
187

you can use the following statement to remove leading zeros from a char field.

shift BDCDATA-FVAL left deleting leading '0'.

-Kalyan

8 REPLIES 8

Former Member
0 Kudos
187

hi Sathish,

maintain the internal table field type as char.

Hope this helps,

Sajan Joseph.

Former Member
0 Kudos
187

Hi satish.

use this:

matnr = '000000000000001111'.

call function 'CONVERSION_EXIT_MATN1_OUTPUT'

exporting

input = matnr

importing

output = matnr.

or you can try out this way also:

shift matnr left deleting leading '0'.

opr this helps,

keerthi

0 Kudos
187

My Requirement is with Currency Field. It's not numeric field. it relates with cost. Is that FM, works with Currency field.

Thanks & Regards

Sathish Kumar

Former Member
0 Kudos
187

Hi Satish,

To remove leading zeros and leading blanks

Please use FM

CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal

CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external

Hope this resolves your query.

Reward all the helpful answers.

Regards

0 Kudos
187

Here I have to deal with Internal Table BDCDATA. for Individula fields, it is working fine, but with Internal table it is not working. Is there any other alternatives.

Thanks & Regards

Sathish Kumar

Former Member
0 Kudos
188

you can use the following statement to remove leading zeros from a char field.

shift BDCDATA-FVAL left deleting leading '0'.

-Kalyan

0 Kudos
187

Hello Kalyan

Thanks for ur solution, Now it is working fine.

Thanks & Regards

Sathish Kumar

Former Member
0 Kudos
187

Hi Sathish ,

Once you move the data into the work area of the BDC table , use the condense command (since the bdctable is char ) , this will remove all leading spaces so your value will be the one you actually want .

Hope this helps.

In case id does not please revert back.

Reagards

Arun