Application Development and Automation 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: 
Read only

Truncating the leading zero's

Former Member
0 Likes
2,120

Hi experts,

I have an ALV output, in which one of the fields is equipment number (equi-equnr).

There are some leading zero's that I need to truncate from the ALV output.

How can I achieve this? The code is as given below:

fieldcatalog-fieldname = 'EQUIPMENT_NUMBER'.

fieldcatalog-seltext_m = 'Equipment Number'.

fieldcatalog-col_pos = 5.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

Thanks,

Ajay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,813

Hello,

Your requirement is that you need to display the equipment number in the ALV without the leading zeroes.

Ypur code is


fieldcatalog-fieldname = 'EQUIPMENT_NUMBER'.
fieldcatalog-seltext_m = 'Equipment Number'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

Just before append statement add the following


fieldcatalog-no_zero = 'X'.

.

Now try the same it should solve your problem.

Regards,

Sachin

Edited by: Sachin Dargan on Jan 19, 2010 7:34 AM

Hi experts,

I have an ALV output, in which one of the fields is equipment number (equi-equnr).

There are some leading zero's that I need to truncate from the ALV output.

How can I achieve this? The code is as given below:

fieldcatalog-fieldname = 'EQUIPMENT_NUMBER'.

fieldcatalog-seltext_m = 'Equipment Number'.

fieldcatalog-col_pos = 5.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

Thanks,

Ajay.

10 REPLIES 10
Read only

anup_deshmukh4
Active Contributor
0 Likes
1,813

lzero field in the field catlog should be marked 'X'

hope this solves your problem

Edited by: Anup Deshmukh on Jan 19, 2010 7:23 AM

Read only

0 Likes
1,813

Hi Anup,

I did this:

fieldcatalog-fieldname = 'EQUIPMENT_NUMBER'.

fieldcatalog-seltext_m = 'Equipment Number'.

fieldcatalog-col_pos = 5.

fieldcatalog-lzero = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

Unfortunately, it does not work....

Any other way out?

Thanks,

Ajay.

Read only

Former Member
0 Likes
1,813

for leading Zero's use this function module.

CONVERSION_EXIT_ALPHA_OUTPUT

lzero(1) type c, field catalog

Edited by: dharma raj on Jan 19, 2010 11:54 AM

Read only

Former Member
0 Likes
1,813

Hi,

Try by passung

FS_FIELDCAT-edit_mask = '==ALPHA'. to fieldcatalog.

Nag

Read only

Former Member
0 Likes
1,813

Hi,

Look the below example

*--replace wa_itab-matnr to equi-equnr

call function 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = wa_itab-matnr

IMPORTING

output = wa_itab-matnr.

regards,

Amit

Read only

Former Member
0 Likes
1,814

Hello,

Your requirement is that you need to display the equipment number in the ALV without the leading zeroes.

Ypur code is


fieldcatalog-fieldname = 'EQUIPMENT_NUMBER'.
fieldcatalog-seltext_m = 'Equipment Number'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.

Just before append statement add the following


fieldcatalog-no_zero = 'X'.

.

Now try the same it should solve your problem.

Regards,

Sachin

Edited by: Sachin Dargan on Jan 19, 2010 7:34 AM

Read only

0 Likes
1,813

Hi Friends,

The solution provided by Sachin has worked:

fieldcatalog-no_zero = 'X'.

I do not understand why the lzero thing is not working

Anyways, thanks all for the valuable suggestions.

Thanks,

Ajay.

Read only

arpit_shah
Contributor
0 Likes
1,813

Hi Ajay,

In field catalog there is a optionlzeron for removing leading zero

fieldcatalog-lzero = 'X'.

or you can use FM for removing leading zero.

CONVERSION_EXIT_ALPHA_OUTPUT

Thanks & Rgds,

Arpit

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,813

Hi Ajay,

In fieldcat pass ref_fieldname = 'EQUNR' and ref_tabname = 'AFIH'.

It will work fine.

Thanks,

Vinod.

Read only

Former Member
0 Likes
1,813

Hi

Loop at internal table and do SHIFT <field_name> LEFT DELETING LEADING 0 and store it in a temp_variable and display this temp_variable in the field catalog.

Thanks

Subha