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

Urgent task

Former Member
0 Likes
601

Hi all,

This is my code for downloading ...

first time when i executing its working and downloading to the path .But when I am

executing and downloading to the same path its showing short dump "ACCESS DENIED " .So how to write code to over write the excel(xls) file.

my code

-


DATA: DATEI_PC TYPE STRING VALUE 'c:\MATNR_1.XLS'.

DATA:BEGIN OF I_HEADING OCCURS 0,

TEXT1(20),

TEXT2(20),

TEXT3(20),

TEXT4(20),

TEXT5(20),

TEXT6(20),

TEXT7(20),

TEXT8(20),

TEXT9(20),

TEXT10(20),

TEXT11(40),

TEXT12(20),

TEXT13(20),

TEXT14(20),

END OF I_HEADING.

I_HEADING-TEXT1 = 'MATNR'.

I_HEADING-TEXT2 = 'WERKS'.

I_HEADING-TEXT3 = 'DISPO'.

I_HEADING-TEXT4 = 'LGORT'.

I_HEADING-TEXT5 = 'LABST'.

I_HEADING-TEXT6 = 'MBRSH'.

I_HEADING-TEXT7 = 'MATKL'.

I_HEADING-TEXT8 = 'MEINS'.

I_HEADING-TEXT9 = 'MAKTX'.

I_HEADING-TEXT10 = 'VKORG'.

I_HEADING-TEXT11 = 'EBELN'.

I_HEADING-TEXT12 = 'EBELP'.

I_HEADING-TEXT13 = 'VBELN'.

I_HEADING-TEXT14 = 'POSNR'.

APPEND I_HEADING.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

EXPORTING

FILENAME = datei_pc

WRITE_FIELD_SEPARATOR = 'X'

CHANGING

DATA_TAB = i_heading[].

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

EXPORTING

FILENAME = DATEI_PC

WRITE_FIELD_SEPARATOR = 'X'

append = 'X'

CHANGING

DATA_TAB = I_TAB[].

CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

EXPORTING

DOCUMENT = datei_pc.

5 REPLIES 5
Read only

Former Member
0 Likes
530

Hi Satya,

I think it is not a problem. Try Changing the Previous file name or move it to other location and re-execute.

This might solve your problem.

Reward all the helpful answers.

Regards

Read only

Former Member
0 Likes
530

Hi Satya,

This problem generally ariases in computers in network, where you will not have access to the C drive. Instead you try to download file to Desktop.

Read only

Clemenss
Active Contributor
0 Likes
530

Urgent task

Read only

Former Member
0 Likes
530

Hi..

Satya..

Please make sure that The previous downloaded file is not opened ,while you are executing the program again...

If you are opened the file and ,if you execute the program with the same file name it will give you that type of short dump..

so close that file and try again executing the program with out changing any code or filename...

If it helps reward with points..

Regards Rk

Read only

Former Member
0 Likes
530

HI Satya,

I copy pasted your code, to test this in various ways .I found one small sytax error,which I represented in BOLD.I executed this several times it is executing succesfully............

DATA: DATEI_PC TYPE STRING VALUE 'c:\MATNR_1.XLS'.

DATA:BEGIN OF I_HEADING OCCURS 0,

TEXT1(20),

TEXT2(20),

TEXT3(20),

TEXT4(20),

TEXT5(20),

TEXT6(20),

TEXT7(20),

TEXT8(20),

TEXT9(20),

TEXT10(20),

TEXT11(40),

TEXT12(20),

TEXT13(20),

TEXT14(20),

END OF I_HEADING.

I_HEADING-TEXT1 = 'MATNR'.

I_HEADING-TEXT2 = 'WERKS'.

I_HEADING-TEXT3 = 'DISPO'.

I_HEADING-TEXT4 = 'LGORT'.

I_HEADING-TEXT5 = 'LABST'.

I_HEADING-TEXT6 = 'MBRSH'.

I_HEADING-TEXT7 = 'MATKL'.

I_HEADING-TEXT8 = 'MEINS'.

I_HEADING-TEXT9 = 'MAKTX'.

I_HEADING-TEXT10 = 'VKORG'.

I_HEADING-TEXT11 = 'EBELN'.

I_HEADING-TEXT12 = 'EBELP'.

I_HEADING-TEXT13 = 'VBELN'.

I_HEADING-TEXT14 = 'POSNR'.

APPEND I_HEADING.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

EXPORTING

FILENAME = datei_pc

WRITE_FIELD_SEPARATOR = 'X'

CHANGING

DATA_TAB = i_heading[].

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

EXPORTING

FILENAME = DATEI_PC

WRITE_FIELD_SEPARATOR = 'X'

append = 'X'

CHANGING

<b>DATA_TAB = i_heading[]. " instead DATA_TAB = I_TAB[].</b>

CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

EXPORTING

DOCUMENT = datei_pc.

Reward,if helps.

Regards,

V.Raghavender.