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

serial number

Former Member
0 Likes
1,153

Hi All,

I have noe table control in the second screen.

in that i am displaying the item details along with the serial number.

the serial number is the char of 18 lenth.

it should not show the leading zeros .

but it it is showing the leading zeros.

how to delete the leading zeros.

Can any one help me .

Thnaks&Regards.

Ramu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,011

Hi,

before passing the Internal table data to table control write your logic,

Loop at ITAB.

call function 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = ITAB-FIELD

IMPORTING

output = ITAB-FIELD.

MODIFY ITAB index SY_TABIX.

ENDLOOP.

Regards

Sudheer

Hi All,

I have noe table control in the second screen.

in that i am displaying the item details along with the serial number.

the serial number is the char of 18 lenth.

it should not show the leading zeros .

but it it is showing the leading zeros.

how to delete the leading zeros.

Can any one help me .

Thnaks&Regards.

Ramu.

7 REPLIES 7
Read only

gopi_narendra
Active Contributor
0 Likes
1,011

if it a char field follow thsi way -

U can either use this function module also

CONVERSION_EXIT_ALPHA_OUTPUT

or

SHIFT <yourField> LEFT DELETING LEADING '0'

or

try NO-ZERO option of WRITE statement

or

Another way is to create another variable of type I and assign the value into it

example:

DATA: L_NUMC(08) TYPE N.

DATA: L_INT TYPE I.

L_NUMC = '00000018'.

L_INT = L_NUMC.

Result will be = 18.

-


<b>if not change the data type to number and then it will not show the leading zeros.</b>

Hope this helps

Regards

- Gopi

Read only

Former Member
0 Likes
1,011

Hi,

u can use the function module for removing leading zeros

CONVERSION_EXIT_ALPHA_INPUT (adding zeros)

CONVERSION_EXIT_ALPHA_OUTPUT (removing zeros)

Regards

Sudheer

Read only

sathish_perumal
Active Participant
0 Likes
1,011

Hi Ramu,

You can suppress Zero's using String operation command SHIFT. If it comes even after that declare the same table again with serial number doesnot refer to the data element or the transparent table but should be CHAR18. Then suppress all zero's and update the new table and use this table to display the contents in table control.

Regards,

Sathish

Note : Reward useful answers

Read only

0 Likes
1,011

Hi,

Field SERNR is a character domain GERNR 18 characters so should not show leading zeros

I am getting the serial number into internaltable t_item along with some more information.

thie internal table linked to table control.

when i am going to display in tablecontrol before that i need to delete the zeros.

where i need to write the logic.

Thanks&Regards.

Ramu.

Read only

0 Likes
1,011

Hi,

Here is the sample code.You need to write before you populate the values in table control.

data s1 type sernr value '045'.

pack s1 to s1.

write s1.

Read only

0 Likes
1,011

Hi Ramu,

in the PBO Module of Table control

flow logic

PBO.

loop with tab ctrl.

module read_tab_ctrl.

endloop.

module read_tab_ctrl.

read table itab.

if sy-subrc = 0.

shift <itab-field> left deleting leading '0'.

....

....

endif.

endmodule.

<b>IF YOU CAN NOT UNDERSTAND PASTE UR PBO TABLE CONTROL MODULE HERE.</b>

Regards

- Gopi

Read only

Former Member
0 Likes
1,012

Hi,

before passing the Internal table data to table control write your logic,

Loop at ITAB.

call function 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = ITAB-FIELD

IMPORTING

output = ITAB-FIELD.

MODIFY ITAB index SY_TABIX.

ENDLOOP.

Regards

Sudheer