‎2008 May 09 6:05 AM
Hi Experts
I am using Fm GUI_DOWNLOAD to download the material master data in excel . Program working fine.
in excel file material no display like 34567 it should display like 00000034567. in my internal table matnr has leading zero. But excel dont have zero.
Pls help me out.
‎2008 May 09 6:30 AM
Hi Kumar,
in GUI_DOWNLOAD give the FILETYPE as DBF and checkout if it works
or
in the excel file , right click on that column>format cellschoose text
Hope it will solve your problem..
Reward points if useful..
Thanks & Regards
ilesh 24x7
‎2008 May 09 6:14 AM
Hi,
Yes, you should convert it, you can use the function module CONVERSION_EXIT_MATN1_INPUT.
Regards
Kiran Sure
‎2008 May 09 6:23 AM
Hi
My internal table has leading Zero but excel dont have
Following is my code. pls help me
FORM get_data .
SELECT mandt matnr meins laeda aenam
FROM mara
INTO TABLE it_mara
WHERE matnr IN s_matnr
AND mtart IN s_mtart.
IF NOT it_mara[] IS INITIAL.
SELECT matnr werks
FROM marc
INTO TABLE it_marc
FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr
AND werks = p_werks
AND mmsta IN s_mmsta
AND dispo IN s_dispo
AND beskz IN s_beskz
AND lgpro IN s_lgpro
AND lgfsb IN s_lgfsb.
SELECT matnr maktx
FROM makt
INTO TABLE it_makt
FOR ALL ENTRIES IN it_marc
WHERE matnr = it_marc-matnr
AND spras = 'E'.
SELECT matnr zppqt zspqt zpmqt_3
INTO TABLE it_zmpkg
FROM zmpkg
FOR ALL ENTRIES IN it_marc
WHERE matnr = it_marc-matnr
AND werks = p_werks.
ENDIF.
LOOP AT it_mara.
READ TABLE it_marc WITH KEY matnr = it_mara-matnr.
IF sy-subrc EQ 0.
READ TABLE it_makt WITH KEY matnr = it_mara-matnr.
IF sy-subrc EQ 0.
READ TABLE it_zmpkg WITH KEY matnr = it_mara-matnr.
IF sy-subrc EQ 0.
it_material-mandt = it_mara-mandt.
it_material-matnr = it_mara-matnr.
it_material-maktx = it_makt-maktx.
it_material-meins = it_mara-meins.
it_material-laeda = it_mara-laeda.
it_material-aenam = it_mara-aenam.
it_material-werks = it_marc-werks.
it_material-zppqt = it_zmpkg-zppqt.
it_material-zspqt = it_zmpkg-zspqt.
it_material-zpmqt_3 = it_zmpkg-zpmqt_3.
it_material-date = sy-datum.
it_material-time = sy-uzeit.
it_material-user = sy-uname.
it_material-file = p_pcfile.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
EXPORTING
input = it_material-meins
LANGUAGE = 'EN'
IMPORTING
LONG_TEXT =
output = it_material-meins
SHORT_TEXT =
EXCEPTIONS
UNIT_NOT_FOUND = 1
OTHERS = 2
.
ENDIF.
APPEND it_material.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
FORM download_data_pc .
DATA: lv_filename TYPE string.
CLEAR lv_filename.
MOVE p_pcfile TO lv_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_filename
filetype = 'ASC'
write_field_separator = 'X'
append = 'r'
TABLES
data_tab = it_material
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
ENDIF.
ENDFORM. " DOWNLOAD_DATA_PC
‎2008 May 09 6:16 AM
Hi Kumar,
Pass it on to type N variable while sending on to your excel sheet ..
Regards,
Santosh
‎2008 May 09 6:18 AM
Hi,
U can also use concatenate command.
concatenate '000000' material_no into lv_matr.
Thanks
‎2008 May 09 6:23 AM
Hi
If u will put matnr inside double quote then zeros will be prined in excel , e.g take one char field of size say 12 and concatenate '"' matnr '"' into that char field. now download it inot excel.
Removeing zeros is inbuilt feature of xl but if cell type is text then zeros will not be deleted.
Reward if useful
‎2008 May 09 6:28 AM
Hi,
This is not the problem of your code or FM.
This is the excel sheet problem. Normally integers having leading zeros are not shown in excel.
Reward if helpful
‎2008 May 09 6:30 AM
Hi Kumar,
in GUI_DOWNLOAD give the FILETYPE as DBF and checkout if it works
or
in the excel file , right click on that column>format cellschoose text
Hope it will solve your problem..
Reward points if useful..
Thanks & Regards
ilesh 24x7
‎2008 May 09 6:35 AM
Hi ilesh
I changed the file type. it is working fine. Thanks a lot.
‎2008 Jul 21 1:05 PM
‎2008 Jul 24 8:03 AM
Hi,
If my matnr is 0000001000 and 00123456 then how should I remove those leading zero? for matnr field?
Thanks