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

Leading ZERO?

Former Member
0 Likes
2,238

Hi,

I need to export LQUA-WERKS to excel..

But when exported I mis leading zeros?

40 need to be exported in excel 0040 ?

tnx,

Adibo.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,859

Hello Adibo,

Simplest way to achieve this is like below:


CONCATENATE ''''' LQUA-WERKS INTO lv_werks.

Here you are concatenating single colon ( ' ) with your plant number and moving it to char type variable.

Now when you use this variable to download into XL, It will show appending Zeros and it will not show your appended single colon.

This surely works..

<REMOVED BY MODERATOR>

thnx,

ags

Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:59 PM

12 REPLIES 12
Read only

Former Member
0 Likes
1,859

How r u exporting it?

If you r using some internal table then it will take data in the format present in internal table.

If you r exporting it from ALV, it will take as it is displayed in ALV.

So, in both cases, adjust your internal table data and then export.

G@urav.

Read only

0 Likes
1,859

I am exporting it from internal table..

Read only

0 Likes
1,859

adjust that column data in internal table to whatever format you want it to appear in EXCEL.

G@urav.

Read only

0 Likes
1,859

TYPES:  BEGIN OF ls_lqua,
            werks TYPE lqua-werks,
            matnr TYPE lqua-matnr,
            gesme TYPE lqua-gesme,
            meins TYPE lqua-meins,
            letyp TYPE lqua-letyp,
            lgtyp TYPE lqua-lgtyp,
            lgpla TYPE lqua-lgpla,
        END OF ls_lqua.
DATA: lt_lqua TYPE STANDARD TABLE OF ls_lqua,
      wa_lqua TYPE ls_lqua.

when I set breakpoint to see format of lt_lqua-werks, it is shown as 0040..but when exported 40 ?? strange

Read only

0 Likes
1,859

Do we have checked options and settings in Excel?

I think there should be some setting in Excel.

It must be giving 0040 when you download it into text file.

G@urav.

Read only

0 Likes
1,859

Hi

It depends on excel, not SAP.

As the code of plant is a number, excel manage the field as it was a numeric field, so it's deleting the leading zero.

Before opening the file u should set the colunm for WERKS as TEXT field.

Max

Read only

Former Member
0 Likes
1,859

Always best method would be........

through se16 download the data into text file then take out the header, open the blank excell sheet then open your text file in this excell. While opening the this file it will give you differnet options go with delimitor then in the next screen give the another '|' as the delimitor and with shift select all the columns in the below window go with next option

in the next screen select the text radio button and finish.... thats it u will get all the fields with leading zeros if exists in the original list.

Read only

Former Member
0 Likes
1,859

use the FM :

CONVERSION_EXIT_ALPHA_INPUT

this convert ure values or example a char(4) if u have a valu = 3, this function return = 0003

OR

CONVERSION_EXIT_ALPHA_OUTPUT

this quit the zeros example if u have a 0000056, only return 56

Read only

Former Member
0 Likes
1,860

Hello Adibo,

Simplest way to achieve this is like below:


CONCATENATE ''''' LQUA-WERKS INTO lv_werks.

Here you are concatenating single colon ( ' ) with your plant number and moving it to char type variable.

Now when you use this variable to download into XL, It will show appending Zeros and it will not show your appended single colon.

This surely works..

<REMOVED BY MODERATOR>

thnx,

ags

Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:59 PM

Read only

Former Member
0 Likes
1,859

Hi,

Not one solution has helped..But I solved it like this:

I exported file in TXT. Then when opening with excel chose option to change column WERKS as text!

Read only

0 Likes
1,859

Hi Adibo, Can you please explain me how you solved this issue. PLease share this with me.

Read only

0 Likes
1,859

Hi @CN,

I just exported lt_lqua as TXT file, that was enough..

When opening this file in EXCEL you can define werks column as TEXT, so leading zeros won't be deleted..